How to resolve the "Can't assign Id to resource" from Aapt2 command line?

110 Views Asked by At

I want to have my activity class inherited with the "AppCompatActivity" class as to use fragments in my code but it requires a themes.xml file that will be added in the application tag of the Android Manifest file.

I am able to compile other xml files like for icons, and widgets etc., into .flat files and generate R.java file using the Aapt2 command line tool provided by Android. But when I add this themes.xml file it requires Androidx library res values also because the parent attribute should be an appcompat theme.

So, I was able to find the required androidx res folders and compiled them into their own compiled res folders which contain only .flat files. After that the generated compiled folders were merged into a zip file.

Along with this I needed to compile the res folder which is available near android.jar .

enter image description here

During the link command as shown below it was failing with some error:

aapt2 link -o output.apk -I "Paste the path to android.jar" --java "Rjava" -R "flatfolders.zip" --auto-add-overlay --manifest "Paste the path to AndroidManifest.xml"

error: can't assign ID 0x010a0004 to resource your.package.name:anim/accelerate_decelerate_interpolator because package already has ID 1.

It says this ID is already assigned. These attributes I am not using in my xml files they are used somewhere in Androidx res folders.

Can somebody please help me in this? Whether whatever am I doing is it right or wrong? Help would be appreciated.

0

There are 0 best solutions below