I'm trying to create an android component that can be easily added to android projects as a jar library.
For this, I had to create new xml attributes in "res/values/attr.xml" that I add to my graphic xml element using the path:
xmlns:app="http://schemas.android.com/apk/res/com.component.mypackage"
Then I import this project as a jar library into another project. To create my graphic components in the new project, I must change the path below:
xmlns:app="http://schemas.android.com/apk/res/com.mylibrary"
But the path is incorrect: the custom attributes are not found.
I managed to integrate the R file in the library jar and I could access it from my xml to declare a custom component like this:
<PreferenceScreen
xmlns:android = "http://schemas.android.com/apk/res/android"
xmlns:app = "http://schemas.android.com/apk/res/com.myLibraryPackage">
<com.myLibraryPackage.mySelfComponent
android:title="Name"
android:key="name"
app:hintText="Input your name"
android:dialogTitle="Your name "
app:validator="com.myLibraryPackage.myValidatorClass" />
What is strange is that if I put my file attr.xml in resources of my project, it works, which means it find com.myLibraryPackage.mySelfComponent. In that case, why it can't find also com.myLibraryPackage ?
(I also tried replacing
xmlns:app="http://schemas.android.com/apk/res/com.myLibraryPackage"
by
xmlns:app="http://schemas.android.com/apk/res/com.myApplicationPackage"
but it still doesn't work)
I would have preferred to use a jar to facilitate its integration in a project !
Has anyone encountered a problem like this who could help me?
Thank you.