I'm trying to use Theme from AppCompat as parent for mine but seems like I am unable to include resources.
eg:
<?xml version="1.0" encoding="utf-8"?>
<resources>
<style name="CustomActionBarTheme"
parent="#style/Theme.AppCompat.Light.DarkActionBar">
</style>
</resources>
gives me an error:
Error:Execution failed for task ':processDebugResources'.
com.android.ide.common.internal.LoggedErrorException: Failed to run command:
G:\Android\android-studio\sdk\build-tools\19.0.3\aapt.exe package -f --no-crunch -I G:\Android\android-studio\sdk\platforms\android-19\android.jar -M E:\Studio\Git\face_rec_android\build\manifests\debug\AndroidManifest.xml -S E:\Studio\Git\face_rec_android\build\res\all\debug -A E:\Studio\Git\face_rec_android\build\assets\debug -m -J E:\Studio\Git\face_rec_android\build\source\r\debug -F E:\Studio\Git\face_rec_android\build\libs\face_rec_android-debug.ap_ --debug-mode --custom-package in.amolgupta.helpingfaceless
Error Code:
1
Output:
E:\Studio\myapp\build\res\all\debug\values\values.xml:127: error: Error retrieving parent for item: No resource found that matches the given name '#style/Theme.AppCompat.Light.DarkActionBar'.
I have tried including the jar file which apparently doesn't have resources but mainly played around with build.gradle like
dependencies {
compile 'com.android.support:appcompat-v7:19.1.+'
}
Any way I can make this work?
Couldn't import as module from extra because of there was no build.gradle file there.
You need to download this lib from SDK Manager which placed in Android SDK folder then go to the sdk folder/extras/android/v7/ find .jar lib file and put this file into library folder of your project.
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'm manually compiling an apk. But there is an error in packaging when using aapt.
Create a simple project in Android Studio. Then use aapt to package his resources。
The command is shown below:
aapt package -f -m -J build -S res -M AndroidManifest.xml
-I /SDK/platforms/android-28/android.jar
The error output is as follows:
error: resource style/Theme.AppCompat.Light.NoActionBar (aka com.jz.myapplication:style/Theme.AppCompat.Light.NoActionBar) not found.
./res/values/styles.xml:6: error: style attribute 'attr/colorPrimary (aka com.jz.myapplication:attr/colorPrimary)' not found.
./res/values/styles.xml:7: error: style attribute 'attr/colorPrimaryDark (aka com.jz.myapplication:attr/colorPrimaryDark)' not found.
./res/values/styles.xml:8: error: style attribute 'attr/colorAccent (aka com.jz.myapplication:attr/colorAccent)' not found.
error: failed linking references.
You are missing resources from the app compat library.
If you're going to use resources from some libraries, you need to include all of the resources from these libraries and their transitive dependencies using the -S flag. You also need to be mindful of the order of these inputs as they will impact the resource overrides at run-time.
If you use the Android Gradle Plugin instead all of this will be done automatically for you.
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
from this link i had use multi language support in my Android Project, Yesterday i decided to switch to Intellij Idea gradle, when i remove value files in different language, app run normally with default language
but with multi string value file get this error
Error:Gradle: Execution failed for task ':...:processDebugResources'.
com.android.ide.common.internal.LoggedErrorException: Failed to run command:
/home/.../sdk/build-tools/android-4.4.2/aapt package -f --no-crunch -I
/home/.../sdk/platforms/android-19/android.jar -M
/home/.../.../build/manifests/debug/AndroidManifest.xml -S
/home/.../.../build/res/all/debug -A
/home/.../.../build/assets/debug -m -J /home/.../.../build/source/r/debug -F
/home/.../.../build/libs/...-debug.ap_ --debug-mode --custom-package ... --output-text-symbols /home/.../build/symbols/debug
Error Code:
1
Output:
/home/.../build/res/all/debug/values-Ar/values.xml: error: Duplicate file.
/home/.../build/res/all/debug/values/values.xml: Original is here.
Your problem seems to be with naming conventions.
The main problem with the structure you're using is that you used a capital letter.
In android file structure in res folder should always be in lowercase.
instead of
values-Ar
you should use
values-ar
for your values folder if you want an arabic locale to find your strings,values ...
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.