And there are nothing in TestApp except AndroidManifest.xml:
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.mycompany.test.app"
android:versionCode="1"
android:versionName="1.0">
...
</manifest>
And aapt says that
res/layout/main.xml:13: error: No resource identifier found for
attribute 'customValue' in package 'com.mycompany.test.lib'
How to avoid this except for no having custom attributes in library?
From aapt's point of view all the resources are compiled for the package name of the application (com.mycompany.test.app in your case), so your "customValue" attribute is defined in that namespace, and not in the namespace of the library.
At this time, the only solution is to remove the layout from the library and move it into the apps and edit the namespace to match the application package.
We'll look at fixing this. xav
On Thu, Jul 8, 2010 at 3:27 AM, Vladimir Lebedev-Schmidthof
> And there are nothing in TestApp except AndroidManifest.xml: > <manifest xmlns:android="http://schemas.android.com/apk/res/android" > package="com.mycompany.test.app" > android:versionCode="1" > android:versionName="1.0"> > ... > </manifest>
> And aapt says that > res/layout/main.xml:13: error: No resource identifier found for > attribute 'customValue' in package 'com.mycompany.test.lib'
> How to avoid this except for no having custom attributes in library?
> -- > You received this message because you are subscribed to the Google > Groups "Android Developers" group. > To post to this group, send email to android-developers@googlegroups.com > To unsubscribe from this group, send email to > android-developers+unsubscribe@googlegroups.com > For more options, visit this group at > http://groups.google.com/group/android-developers?hl=en
-- Xavier Ducrohet Android SDK Tech Lead Google Inc.
> From aapt's point of view all the resources are compiled for the
> package name of the application (com.mycompany.test.app in your case),
> so your "customValue" attribute is defined in that namespace, and not
> in the namespace of thelibrary.
> At this time, the only solution is to remove the layout from thelibraryand move it into the apps and edit the namespace to match the
> application package.
> We'll look at fixing this.
> xav
> On Thu, Jul 8, 2010 at 3:27 AM, Vladimir Lebedev-Schmidthof
> > And there are nothing in TestApp except AndroidManifest.xml:
> > <manifest xmlns:android="http://schemas.android.com/apk/res/android"
> > package="com.mycompany.test.app"
> > android:versionCode="1"
> > android:versionName="1.0">
> > ...
> > </manifest>
> > And aapt says that
> > res/layout/main.xml:13: error:No resource identifier found for> attribute'customValue' in package 'com.mycompany.test.lib'
> > How to avoid this except for no having custom attributes inlibrary?
> > --
> > You received this message because you are subscribed to the Google
> > Groups "Android Developers" group.
> > To post to this group, send email to android-developers@googlegroups.com
> > To unsubscribe from this group, send email to
> > android-developers+unsubscribe@googlegroups.com
> > For more options, visit this group at
> >http://groups.google.com/group/android-developers?hl=en
> --
> Xavier Ducrohet
> Android SDK Tech Lead
> Google Inc.
> Please do not send me questions directly. Thanks!
> On Jul 9, 8:18 pm, Xavier Ducrohet <x...@android.com> wrote:
> > Ah, there's a problem with the namespace.
> > From aapt's point of view all the resources are compiled for the
> > package name of the application (com.mycompany.test.app in your case),
> > so your "customValue" attribute is defined in that namespace, and not
> > in the namespace of thelibrary.
> > At this time, the only solution is to remove the layout from thelibraryand move it into the apps and edit the namespace to match the
> > application package.
> > We'll look at fixing this.
> > xav
> > On Thu, Jul 8, 2010 at 3:27 AM, Vladimir Lebedev-Schmidthof
> > > And there are nothing in TestApp except AndroidManifest.xml:
> > > <manifest xmlns:android="http://schemas.android.com/apk/res/android"
> > > package="com.mycompany.test.app"
> > > android:versionCode="1"
> > > android:versionName="1.0">
> > > ...
> > > </manifest>
> > > And aapt says that
> > > res/layout/main.xml:13: error:No resource identifier found for> attribute'customValue' in package 'com.mycompany.test.lib'
> > > How to avoid this except for no having custom attributes inlibrary?
> > > --
> > > You received this message because you are subscribed to the Google
> > > Groups "Android Developers" group.
> > > To post to this group, send email to android-developers@googlegroups.com
> > > To unsubscribe from this group, send email to
> > > android-developers+unsubscribe@googlegroups.com
> > > For more options, visit this group at
> > >http://groups.google.com/group/android-developers?hl=en
> > --
> > Xavier Ducrohet
> > Android SDK Tech Lead
> > Google Inc.
> > Please do not send me questions directly. Thanks!
> > > From aapt's point of view all the resources are compiled for the
> > > package name of the application (com.mycompany.test.app in your case),
> > > so your "customValue" attribute is defined in that namespace, and not
> > > in the namespace of thelibrary.
> > > At this time, the only solution is to remove the layout from thelibraryand move it into the apps and edit the namespace to match the
> > > application package.
> > > We'll look at fixing this.
> > > xav
> > > On Thu, Jul 8, 2010 at 3:27 AM, Vladimir Lebedev-Schmidthof
> > > > And aapt says that
> > > > res/layout/main.xml:13: error:No resource identifier found for> attribute'customValue' in package 'com.mycompany.test.lib'
> > > > How to avoid this except for no having custom attributes inlibrary?
> > > > --
> > > > You received this message because you are subscribed to the Google
> > > > Groups "Android Developers" group.
> > > > To post to this group, send email to android-developers@googlegroups.com
> > > > To unsubscribe from this group, send email to
> > > > android-developers+unsubscribe@googlegroups.com
> > > > For more options, visit this group at
> > > >http://groups.google.com/group/android-developers?hl=en
> > > --
> > > Xavier Ducrohet
> > > Android SDK Tech Lead
> > > Google Inc.
> > > Please do not send me questions directly. Thanks!
> > > > From aapt's point of view all the resources are compiled for the
> > > > package name of the application (com.mycompany.test.app in your case),
> > > > so your "customValue" attribute is defined in that namespace, and not
> > > > in the namespace of thelibrary.
> > > > At this time, the only solution is to remove the layout from thelibraryand move it into the apps and edit the namespace to match the
> > > > application package.
> > > > We'll look at fixing this.
> > > > xav
> > > > On Thu, Jul 8, 2010 at 3:27 AM, Vladimir Lebedev-Schmidthof
> > > > > And aapt says that
> > > > > res/layout/main.xml:13: error:No resource identifier found for> attribute'customValue' in package 'com.mycompany.test.lib'
> > > > > How to avoid this except for no having custom attributes inlibrary?
> > > > > --
> > > > > You received this message because you are subscribed to the Google
> > > > > Groups "Android Developers" group.
> > > > > To post to this group, send email to android-developers@googlegroups.com
> > > > > To unsubscribe from this group, send email to
> > > > > android-developers+unsubscribe@googlegroups.com
> > > > > For more options, visit this group at
> > > > >http://groups.google.com/group/android-developers?hl=en
> > > > --
> > > > Xavier Ducrohet
> > > > Android SDK Tech Lead
> > > > Google Inc.
> > > > Please do not send me questions directly. Thanks!
> > > > > Ah, there's a problem with the namespace.
> > > > > From aapt's point of view all the resources are compiled for the
> > > > > package name of the application (com.mycompany.test.app in your case),
> > > > > so your "customValue" attribute is defined in that namespace, and not
> > > > > in the namespace of thelibrary.
> > > > > At this time, the only solution is to remove the layout from thelibraryand move it into the apps and edit the namespace to match the
> > > > > application package.
> > > > > > And aapt says that
> > > > > > res/layout/main.xml:13: error:No resource identifier found for> attribute'customValue' in package 'com.mycompany.test.lib'
> > > > > > How to avoid this except for no having custom attributes inlibrary?
> > > > > > --
> > > > > > You received this message because you are subscribed to the Google
> > > > > > Groups "Android Developers" group.
> > > > > > To post to this group, send email to android-developers@googlegroups.com
> > > > > > To unsubscribe from this group, send email to
> > > > > > android-developers+unsubscribe@googlegroups.com
> > > > > > For more options, visit this group at
> > > > > >http://groups.google.com/group/android-developers?hl=en
> > > > > --
> > > > > Xavier Ducrohet
> > > > > Android SDK Tech Lead
> > > > > Google Inc.
> > > > > Please do not send me questions directly. Thanks!
> > > > > > Ah, there's a problem with the namespace.
> > > > > > From aapt's point of view all the resources are compiled for the
> > > > > > package name of the application (com.mycompany.test.app in your case),
> > > > > > so your "customValue" attribute is defined in that namespace, and not
> > > > > > in the namespace of thelibrary.
> > > > > > At this time, the only solution is to remove the layout from thelibraryand move it into the apps and edit the namespace to match the
> > > > > > application package.
> > > > > > > And aapt says that
> > > > > > > res/layout/main.xml:13: error:No resource identifier found for> attribute'customValue' in package 'com.mycompany.test.lib'
> > > > > > > How to avoid this except for no having custom attributes inlibrary?
> > > > > > > --
> > > > > > > You received this message because you are subscribed to the Google
> > > > > > > Groups "Android Developers" group.
> > > > > > > To post to this group, send email to android-developers@googlegroups.com
> > > > > > > To unsubscribe from this group, send email to
> > > > > > > android-developers+unsubscribe@googlegroups.com
> > > > > > > For more options, visit this group at
> > > > > > >http://groups.google.com/group/android-developers?hl=en
> > > > > > > Ah, there's a problem with the namespace.
> > > > > > > From aapt's point of view all the resources are compiled for the
> > > > > > > package name of the application (com.mycompany.test.app in your case),
> > > > > > > so your "customValue" attribute is defined in that namespace, and not
> > > > > > > in the namespace of thelibrary.
> > > > > > > At this time, the only solution is to remove the layout from thelibraryand move it into the apps and edit the namespace to match the
> > > > > > > application package.
> > > > > > > > And aapt says that
> > > > > > > > res/layout/main.xml:13: error:No resource identifier found for> attribute'customValue' in package 'com.mycompany.test.lib'
> > > > > > > > How to avoid this except for no having custom attributes inlibrary?
> > > > > > > > --
> > > > > > > > You received this message because you are subscribed to the Google
> > > > > > > > Groups "Android Developers" group.
> > > > > > > > To post to this group, send email to android-developers@googlegroups.com
> > > > > > > > To unsubscribe from this group, send email to
> > > > > > > > android-developers+unsubscribe@googlegroups.com
> > > > > > > > For more options, visit this group at
> > > > > > > >http://groups.google.com/group/android-developers?hl=en
Its not great but what I have been doing is using includes and redefining the include in the application project. You can still define the attribute in the library project, you can use simple framelayouts or whatever to define a fake placeholder layout in the library project, then in the application project define the real view. When compiling the real view in the application project it will override the library project. This allows the code to compile with the R.syles stuff in the lirbary, yet still have the views work too.
Any chance this has been fixed - or a workaround is available?
Library projects seem to be the best approach to release multiple versions of an app (ex: free/paid), and I was really hoping there is a better solution than to duplicate all of my custom layouts in both apps.
> Any chance this has been fixed - or a workaround is available?
> Library projects seem to be the best approach to release multiple versions
> of an app (ex: free/paid),
> and I was really hoping there is a better solution than to duplicate all of
> my custom layouts in both apps.
> This has been fixed (tested with latest SDK tools 10, platform API
> 11).
> On Feb 24, 12:41 pm, Romain <choicesm...@gmail.com> wrote:
> > Hi,
> > Any chance this has been fixed - or a workaround is available?
> > Library projects seem to be the best approach to release multiple versions
> > of an app (ex: free/paid),
> > and I was really hoping there is a better solution than to duplicate all of
> > my custom layouts in both apps.
> Is it now possible to declare a custom attribute in a library project
> and reuse it in multiple apps?
> If so, what xmlns does one use when declaring this attribute? The
> namespace of the library, or what?
> Thanks in advance.
> Joe
> On Mar 9, 3:48 am, "C. Plantier" <clemplant...@gmail.com> wrote:
> > This has been fixed (tested with latest SDK tools 10, platform API
> > 11).
> > On Feb 24, 12:41 pm, Romain <choicesm...@gmail.com> wrote:
> > > Hi,
> > > Any chance this has been fixed - or a workaround is available?
> > > Library projects seem to be the best approach to release multiple versions
> > > of an app (ex: free/paid),
> > > and I was really hoping there is a better solution than to duplicate all of
> > > my custom layouts in both apps.
You are accessing custom attributes in Java code but this thread is about using custom attributes in xml layouts. In your example that would be e.g. having parcel:color="@android:color/black" in cwac_colormixer_activity.xml. I'm not even sure why you need the namespace declaration in your layouts ( xmlns:parcel= "http://schemas.android.com/apk/res/com.commonsware.cwac.colormixer.demo") if you are not accessing the attributes in the xml. If you would then you would get a compilation error because the package name in your library project is com.commonsware.cwac.colormixer and not com.commonsware.cwac.colormixer.demo --> the compiler would't find the custom attributes.
On Wed, Mar 16, 2011 at 9:02 AM, Emanuel Moecklin <1gravity...@gmail.com> wrote: > You are accessing custom attributes in Java code but this thread is about > using custom attributes in xml layouts. > In your example that would be e.g. having > parcel:color="@android:color/black" in cwac_colormixer_activity.xml. > I'm not even sure why you need the namespace declaration in your layouts > (xmlns:parcel="http://schemas.android.com/apk/res/com.commonsware.cwac.colormixer.demo") > if you are not accessing the attributes in the xml. > If you would then you would get a compilation error because the package name > in your library project is com.commonsware.cwac.colormixer and not > com.commonsware.cwac.colormixer.demo --> the compiler would't find the > custom attributes. > As far as I can see there's no fix in Android 11.
Oops, sorry. I'll have to take a look at this.
BTW, AFAIK, the fix would be with the tools, not the SDK.
In my tests with the latest tools, the custom attribute's namespace
declaration in the library project needs to match the package
declaration of the including project. Correct?
As far as I can tell, this is a known limitation and the suggested
workaround is to copy the affected resources (e.g., main.xml in the
example above) into each of the including projects.
On Mar 16, 1:53 am, Clément Plantier <clemplant...@gmail.com> wrote:
> Issue 9656 says it's not possible to have custom attributes declared &
> used in library projects. This is fixed on SDK 11.
> About using an attribute that is declared in a library projet in
> multiple applications, I can't answer. Have you tried? What happens
> when you do it?
> On Mar 16, 6:26 am, joebowbeer <joe.bowb...@gmail.com> wrote:
> > Is it now possible to declare a custom attribute in a library project
> > and reuse it in multiple apps?
> > If so, what xmlns does one use when declaring this attribute? The
> > namespace of the library, or what?
> > Thanks in advance.
> > Joe
> > On Mar 9, 3:48 am, "C. Plantier" <clemplant...@gmail.com> wrote:
> > > This has been fixed (tested with latest SDK tools 10, platform API
> > > 11).
> > > On Feb 24, 12:41 pm, Romain <choicesm...@gmail.com> wrote:
> > > > Hi,
> > > > Any chance this has been fixed - or a workaround is available?
> > > > Library projects seem to be the best approach to release multiple versions
> > > > of an app (ex: free/paid),
> > > > and I was really hoping there is a better solution than to duplicate all of
> > > > my custom layouts in both apps.
On Wednesday, March 16, 2011 3:42:58 PM UTC-4, joebowbeer wrote:
> In my tests with the latest tools, the custom attribute's namespace > declaration in the library project needs to match the package > declaration of the including project. Correct?
It has to match the package declaration in AndroidManifest.xml otherwise the layout will not compile. If the package is the same as the including project then you are right but library projects make sense if you have at least two including projects (free and paid app e.g.) which will obviously have different package declarations if you want to publish them on Android market. With two including projects with different package declarations it's obviously not possible to match both.
> As far as I can tell, this is a known limitation and the suggested > workaround is to copy the affected resources (e.g., main.xml in the > example above) into each of the including projects.
See Xavier's post from July 2010. Please read the whole thread before repeating what others have written.
> On Wednesday, March 16, 2011 3:42:58 PM UTC-4, joebowbeer wrote:
> > In my tests with the latest tools, the custom attribute's namespace
> > declaration in the library project needs to match the package
> > declaration of the including project. Correct?
> It has to match the package declaration in AndroidManifest.xml otherwise the
> layout will not compile.
> If the package is the same as the including project then you are right but
> library projects make sense if you have at least two including projects
> (free and paid app e.g.) which will obviously have different package
> declarations if you want to publish them on Android market. With two
> including projects with different package declarations it's obviously not
> possible to match both.
> > As far as I can tell, this is a known limitation and the suggested
> > workaround is to copy the affected resources (e.g., main.xml in the
> > example above) into each of the including projects.
> See Xavier's post from July 2010. Please read the whole thread before
> repeating what others have written.
I don't think it has been fixed. Can't find anything in the SDK Tools
release notes and it still doesn't compile if the namespace doesn't
match the package declaration.
On Wed, Oct 19, 2011 at 12:51 AM, Izhovkin <izhov...@gmail.com> wrote: > Was this issue fixed in sdk tools r14?
> -- > You received this message because you are subscribed to the Google > Groups "Android Developers" group. > To post to this group, send email to android-developers@googlegroups.com > To unsubscribe from this group, send email to > android-developers+unsubscribe@googlegroups.com > For more options, visit this group at > http://groups.google.com/group/android-developers?hl=en
Im using a slightly better kludge. Instead of having to include the xml files, I declare the namespace as a string resource. So in your layout just do xmlns:my="@string/package_ns" then just have the project that uses it define the namespace. Seems to work ok.
On Tuesday, February 8, 2011 8:01:27 AM UTC-6, Adam Tybor wrote:
> Its not great but what I have been doing is using includes and redefining > the include in the application project. You can still define the attribute > in the library project, you can use simple framelayouts or whatever to > define a fake placeholder layout in the library project, then in the > application project define the real view. When compiling the real view in > the application project it will override the library project. This allows > the code to compile with the R.syles stuff in the lirbary, yet still have > the views work too.
On Tuesday, February 8, 2011 8:01:27 AM UTC-6, Adam Tybor wrote:
> Its not great but what I have been doing is using includes and redefining > the include in the application project. You can still define the attribute > in the library project, you can use simple framelayouts or whatever to > define a fake placeholder layout in the library project, then in the > application project define the real view. When compiling the real view in > the application project it will override the library project. This allows > the code to compile with the R.syles stuff in the lirbary, yet still have > the views work too.
On Tuesday, February 8, 2011 8:01:27 AM UTC-6, Adam Tybor wrote:
> Its not great but what I have been doing is using includes and redefining > the include in the application project. You can still define the attribute > in the library project, you can use simple framelayouts or whatever to > define a fake placeholder layout in the library project, then in the > application project define the real view. When compiling the real view in > the application project it will override the library project. This allows > the code to compile with the R.syles stuff in the lirbary, yet still have > the views work too.
On Tuesday, February 8, 2011 8:01:27 AM UTC-6, Adam Tybor wrote:
> Its not great but what I have been doing is using includes and redefining > the include in the application project. You can still define the attribute > in the library project, you can use simple framelayouts or whatever to > define a fake placeholder layout in the library project, then in the > application project define the real view. When compiling the real view in > the application project it will override the library project. This allows > the code to compile with the R.syles stuff in the lirbary, yet still have > the views work too.