I was trying to compile Android project using command line in Windows. When I use aapt to generate R file, it comes out an error as below:
D:\SampleProject\MyApplication>aapt package -f -m -J ./gen -S ./app/src/main/res
-I "D:\ProgramInstall\Android\Android SDK\platforms\android-21\android.jar" -M
./app/src/main/AndroidManifest.xml
.\app\src\main\res\values\styles.xml:4: error: Error retrieving parent for item:
No resource found that matches the given name 'Theme.AppCompat.Light.DarkAction
Bar'.
I've found that the Theme.Appcompact.Light.DarkActionBar is related to the APPcompat_v7 floder while the floder is under in the libs floder, How can I let the complier know where to find the lib it need?
I know its too late or you may have already found the answer also but still posting:
D:\SampleProject\MyApplication>aapt package **--auto-add-overlay** -f -m -J ./gen -S ./app/src/main/res **-S "path_to_prebuilts\prebuilts\devtools\extras\android\support\v7\appcompat\res\"** -I "D:\ProgramInstall\Android\Android SDK\platforms\android-21\android.jar" -M ./app/src/main/AndroidManifest.xml
Related
When I run this command :
"aapt.exe" package -f -m -M "AndroidManifest.xml" -I "android.jar" -S "\res" -J "\RJava" --auto-add-overlay
I receive the error : Found tag id where item is expected
It's this row in the values.xml that cause the problem :
<id name="view_tree_lifecycle_owner"/>
Note: with aapt2.exe it's work well, it's with aapt.exe that it's crash, but i need aapt.exe because I m building apk file
You can try adjusting your item definition to work with the older AAPT from:
<id name="view_tree_lifecycle_owner"/>
to
<item type="id" name="view_tree_lifecycle_owner"/>
Reference: https://developer.android.com/guide/topics/resources/more-resources#Id
I have installed the latest unity 3D version(5.5.1) and the latest Android SDK. I haven't built my project on Android before - I believe I get an error when it tries to generate an Android Manifest XML:
Some suggestions for this error for old versions of Android wanted the build-tools folder of a particular version deleted but this still doesn't work. Could somebody help me out here?
CommandInvokationFailure: Failed to re-package resources.
C:\Users\price\AppData\Local\Android\sdk\build-tools\25.0.2\aapt.exe package --auto-add-overlay -v -f -m -J "gen" -M "AndroidManifest.xml" -S "res" -I "C:/Users/price/AppData/Local/Android/sdk\platforms\android-25\android.jar" -F bin/resources.ap_ --extra-packages com.onesignal:com.onesignal.onesignalsdk:com.google.android.gms.base:com.google.android.gms:com.google.android.gms.gcm:com.google.android.gms.location:android.support.v4 -S "C:\Users\price\OneDrive\Documents\FantasyMatchday_iOS\Temp\StagingArea\android-libraries\onesignal-unity\res" -S "C:\Users\price\OneDrive\Documents\FantasyMatchday_iOS\Temp\StagingArea\android-libraries\OneSignalConfig\res" -S "C:\Users\price\OneDrive\Documents\FantasyMatchday_iOS\Temp\StagingArea\android-libraries\play-services-base-8.3.0\res" -S "C:\Users\price\OneDrive\Documents\FantasyMatchday_iOS\Temp\StagingArea\android-libraries\play-services-basement-8.3.0\res" -S "C:\Users\price\OneDrive\Documents\FantasyMatchday_iOS\Temp\StagingArea\android-libraries\play-services-gcm-8.3.0\res" -S "C:\Users\price\OneDrive\Documents\FantasyMatchday_iOS\Temp\StagingArea\android-libraries\play-services-location-8.3.0\res" -S "C:\Users\price\OneDrive\Documents\FantasyMatchday_iOS\Temp\StagingArea\android-libraries\support-v4-23.1.0\res"
stderr[
AndroidManifest.xml:20: Tag <category> attribute name has invalid character '$'.
AndroidManifest.xml:51: Tag <permission> attribute name has invalid character '$'.
AndroidManifest.xml:52: Tag <uses-permission> attribute name has invalid character '$'.
]
stdout[
Configurations:
(default)
Files:
AndroidManifest.xml
Src: () AndroidManifest.xml
Resource Dirs:
Including resources from package: C:\Users\price\AppData\Local\Android\sdk\platforms\android-25\android.jar
applyFileOverlay for drawable
trying overlaySet Key=powered_by_google_dark.png
...
...
My Maven based project is executing the following command resulting in the error that follows:
Command
/bin/sh -c cd /Users/conor/Repositories/Dev/MyPosLogger/samples/HelloMyPosLogger && /Users/conor/Library/Android/sdk/build-tools/22.0.1/aapt package -f --no-crunch -I /Users/conor/Library/Android/sdk/platforms/android-19/android.jar -M /Users/conor/Repositories/Dev/MyPosLogger/samples/HelloMyPosLogger/target/filtered-manifest/AndroidManifest.xml -S /Users/conor/Repositories/Dev/MyPosLogger/samples/HelloMyPosLogger/src/main/res -S /Users/conor/Repositories/Dev/MyPosLogger/samples/HelloMyPosLogger/target/unpacked-libs/android.support_compatibility-v7-appcompat_apklib_22.0.0/res -m -J /Users/conor/Repositories/Dev/MyPosLogger/samples/HelloMyPosLogger/target/generated-sources/r --output-text-symbols /Users/conor/Repositories/Dev/MyPosLogger/samples/HelloMyPosLogger/target --auto-add-overlay
Error
/Users/conor/Repositories/Dev/MyPosLogger/samples/HelloMyPosLogger/target/unpacked-libs/android.support_compatibility-v7-appcompat_apklib_22.0.0/res/values-v21/styles_base.xml:75: error: Error retrieving parent for item: No resource found that matches the given name 'android:Widget.Material.ActionButton'.
Why is this and how do I fix it please?
I am using Android Maven Plugin v3.8.2
I have faced this error before and i solved it by the followin
Open Android sdk and make sure latest version of support library is installed or not. If not then install it also check compile pi version for your project is latest or not i.e. 21.
2.After installing just mvn clean install.
This will solve the issue.
I have gone through the below link for integrating AdMob
http://fastegggames.com/blog/2013/3/30/tutorial-admob
and Follwing is the error when i tried to build my .apk to test AdMob :
Error building Player: CommandInvokationFailure: Failed to re-package resources. See the Console for details.
C:\android-sdk-windows1\build-tools\19.0.1\aapt.exe package --auto-add-overlay -v -f -m -J gen -M AndroidManifest.xml -S "res" -I "C:/android-sdk-windows1/platforms/android-19\android.jar" -F bin/resources.ap_ --extra-packages -S "C:\Users\avisingh.TAGS\Desktop\ONE_07\ONE_07\Temp\StagingArea\android-libraries\facebook\res"
stderr[
C:\Users\avisingh.TAGS\Desktop\ONE_07\ONE_07\Temp\StagingArea\android-libraries\facebook\res\values\strings.xml: error: Duplicate file.
res\values\strings.xml: Original is here.
]
stdout[
Processing raw dir 'C:\Users\avisingh.TAGS\Desktop\ONE_07\ONE_07\Temp\StagingArea\android-libraries\facebook\res'
]
I tried to build in API18 and API19 but still the same error. Can any one please help me through
I am trying to build R.java by using aapt from the command line. I am specifying multiple -S directories because I have multiple res directories. I am building by using:
aapt package \
-M AndroidManifest.xml \
-m -J gen \
-S src/com/example/res \
-S src/com/example/ui/res
Unfortunately, I am getting the following error:
src/com/example/ui/res/values/strings.xml:2: error: Resource at app1_name appears in overlay but not in the base package; use <add-resource> to add.
Currently, src/com/example/ui/res/values/strings.xml contains the following:
<resources>
<string name="app1_name">MyAppName</string>
</resources>
I would prefer not to have to change this to:
<resources>
<add-resource type="string" name="app1_name">MyAppName</add-resource>
</resources>
(This was suggested on https://groups.google.com/forum/?fromgroups#!topic/android-porting/bYfeLEjERjg, though it does not even seem to solve my problem.)
Am I misguided in my expectation of how the -S argument should work?
The only workaround I can think of is to symlink all of my -S directories as subdirectories of the root res directory and to specify res as the only -S directory.
I believe the solution is to use the --auto-add-overlay flag. I discovered this by running the default Ant build script with -v for verbose mode.