Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7983891
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 4, 20262026-06-04T11:06:00+00:00 2026-06-04T11:06:00+00:00

Over time our Android project has expanded a great deal, and these days we

  • 0

Over time our Android project has expanded a great deal, and these days we are creating multiple branded APKs from the same source tree. This has become challenging due to the package naming requirements of Android.

We have all of our shared code in an Android Library project, which is included in the main application project. Plus we have Android library ‘overlays’ for branded resources that get applied for each brand. When we want to build a brand, we include a few extra properties for that brand that end up including the ‘overlay’ Android libraries before the main shared code Android Library. To illustrate:

AppProject
  Include: BrandALibrary or BrandBLibrary
  Include: SharedLibrary

SharedLibrary
-> src/..
-> res/..
BrandALibrary
-> res/..
BrandBLibrary
-> res/..

The ‘BrandALibrary or BrandBLibrary’ is switched at build time, by including .properties files at build time using command-line switches. Nothing too fancy there. The build script also must change the package name of the .APK at build time so that the two .APK files can coexist on a given device at the same time (mostly for QA purposes, since we don’t expect customers to have both at the same time… though they could).

Everything was working very well until our build broke today after adding a class to our shared code library project. In looking around for a reason why this is ocurring I stumbled upon the following web page, where the fellow had encountered the same issue and had fixed his version of aapt to make this work:

http://devmaze.wordpress.com/2011/05/22/the-case-of-android-libraries-and-custom-xml-attributes-part-2/

During our build, the following errors are presented in the logs:

    -pre-build:

-code-gen:
     [echo] ----------
     [echo] Handling aidl files...
     [aidl] No aidl files to compile.
     [echo] ----------
     [echo] Handling RenderScript files...
[renderscript] No renderscript files to compile.
     [echo] ----------
     [echo] Handling Resources...
     [aapt] Found Deleted Target File
     [aapt] Generating resource IDs...
     [aapt] E:\CSI\Neal\trunk\Clients\Android\MyAppSharedLib\res\layout\fancy_layout.xml:22: error: No resource identifier found for attribute 'state_add' in package 'com.myapp'
     [aapt] E:\CSI\Neal\trunk\Clients\Android\MyAppSharedLib\res\layout\fancy_layout.xml:22: error: No resource identifier found for attribute 'state_list' in package 'com.myapp'
     [aapt] E:\CSI\Neal\trunk\Clients\Android\MyAppSharedLib\res\drawable\fancy_button_selector.xml:4: error: No resource identifier found for attribute 'state_add' in package 'com.myapp'
     [aapt] E:\CSI\Neal\trunk\Clients\Android\MyAppSharedLib\res\drawable\fancy_button_selector.xml:4: error: No resource
identifier found for attribute 'state_list' in package 'com.myapp'
     [aapt] E:\CSI\Neal\trunk\Clients\Android\MyAppSharedLib\res\drawable\fancy_button_selector.xml:5: error: No resource
identifier found for attribute 'state_add' in package 'com.myapp'
     [aapt] E:\CSI\Neal\trunk\Clients\Android\MyAppSharedLib\res\drawable\fancy_button_selector_button_selector.xml:5: error: No resource identifier found for attribute 'state_list' in package 'com.myapp'

BUILD FAILED
C:\android-sdk\tools\ant\build.xml:539: The following error occurred while executing this line:
C:\android-sdk\tools\ant\build.xml:568: null returned: 1

My custom attributes are nothing spectacular, I’ve got a state_add, and state_list defined that I can use to set the default states for a control that shows a button with an icon that indicates which states should be shown. It’s like a ‘toggle’ button in a way, and I might end up replacing this control with a toggle button instead.

I followed this tutorial when I created this button.

My question is, finally (this guy is long winded isn’t he?), is there a way to ensure that aapt will ‘remap’ the package names used in custom attributes. If I even want to write more custom controls into our library, we will need appt to be able to do the following:

  • If a custom namespace is defined in the library project, remap that namespace to the namespace of the android application that is being built.

Am I missing something fundamental with the way custom attributes are mapped during an Ant build? Is there something simple I can do to fix my build issues?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-04T11:06:02+00:00Added an answer on June 4, 2026 at 11:06 am

    This was solved.

    For example:

    <?xml version="1.0" encoding="utf-8"?>
    <PreferenceScreen xmlns:android="http://schemas.android.com/apk/res/android"
        xmlns:custom="http://schemas.android.com/apk/res-auto" >
    ...
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am plotting line charts showing the change in price over time for multiple
The ASP.NET web app project I'm currently working on is getting slower over time
I'm in the middle of creating a fairly large flex application, and over time,
Our users have created MS-Excel spreadsheets which over time have evolved into fairly complex
Our software produces a lot of data that is georeferenced and recorded over time.
Over time, the code base I maintain has grown exponentially. We have a variety
Our application has over 15 different top-level mxml files to create individual controls that
Some time ago I thought an new statistics system over, for our multi-million user
We're experiencing a strange issue with our local NuGet package server. Over time, it
I've taken over a project and am having a hard time implementing the SSL

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.