In Android Studio I have this error when I update Android SDK Tools to version 25:
I tried to modify SDK version in gradle build to 21 to execute my app but I have this error. Really I don't why this happens.
This is my build.gradle file:
Thanks a lot for your help!
Update your build tools, and the error will be fixed automatically.
I have same issue before seeing this post i solved it by exiting android studio and running it with administrative privilege
I was getting this after adding google maps. It turned out being a missing key reference
Error:(45) resource string/google_maps_key (aka com.your.package:string/google_maps_key) not found.
Error:(45) error: resource string/google_maps_key (aka com.your.package:string/google_maps_key) not found.
android/app/build/intermediates/manifests/full/debug/AndroidManifest.xml
In the manifest. Which needed to be added in the build.gradle script as showin in https://developers.google.com/maps/documentation/android-api/map-with-marker. After adding the following to build.gradle
resValue "string", "google_maps_key",
(project.findProperty("GOOGLE_MAPS_API_KEY") ?: "")
The aapt error went away.
Related
Ok so I have been building my flutter application , however, i can't figure you what to do in case of this error. I have been following this blog https://flutter.dev/docs/deployment/android , for the release build of my app .Everything worked fine , until i added
flutter build apk --split-per-abi
It gave me the following error,
FAILURE:
Build failed with an exception. '
Execution failed for task ':google_sign_in:verifyReleaseResources'.
> java.util.concurrent.ExecutionException: com.android.builder.internal.aapt.v2.Aapt2Exception: Android resource linking failed
/Users/shuvayan/Desktop/test/srijan2020-app/build/google_sign_in/intermediates/res/merged/release/values/values.xml:276:
error: resource android:attr/fontVariationSettings not found.
/Users/shuvayan/Desktop/test/srijan2020-app/build/google_sign_in/intermediates/res/merged/release/values/values.xml:277: error: resource android:attr/ttcIndex not found.
error: failed linking references.
I had the facebook_flutter_plugin and google_sign_in plugins installed for my application.
After some google search a github issue pointed me to add in the android/app/build.gradle to force use compileSDKVersion 27 even it was given 28.
configurations.all {
resolutionStrategy {
force 'com.android.support:support-v4:27.1.0'
}
}
However, this didn't solve my issue and my the error's still showing up. I would appreciate a little help on this matter.
The problem lies with the plugin with it's specified dependency of compileSdkVersion which have been set to Android 27
update to the most recent version of the plugin, as of now 4.2.0
References:
https://pub.dev/packages/google_sign_in#-changelog-tab-
https://github.com/flutter/plugins/blob/master/packages/google_sign_in/google_sign_in/android/build.gradle
https://github.com/flutter/flutter/issues/32595
I use Android Studio 3.1.4 and android gradle plugin version 3.1.4.
Previously I set buildToolsVersion "27.0.3" in build.gradle of module and there was no problem in building/running. Today I installed newer version of build tools and change build.gradle to use that: buildToolsVersion "28.0.2"
But when I try to sync project with gradle files or rebuild project it ends with AAPT2 error:
AGPBI: {"kind":"error","text":"error: \u003citem\u003e inner element must either be a resource reference or empty.","sources":[{"file":"<path to module>/src/main/res/values/ids.xml","position":{"startLine":16,"startColumn":4,"startOffset":752,"endColumn":55,"endOffset":803}}],"original":"","tool":"AAPT"}
....
FAILURE: Build failed with an exception.
* What went wrong:
Execution failed for task ':<modulee-name>:mergeDebugResources'.
> Error: java.util.concurrent.ExecutionException: com.android.builder.internal.aapt.v2.Aapt2Exception: AAPT2 error: check logs for details
But I do not understand what causes the error. For example addressed line in error is:
<item type="id" name="bookmark">false</item>
What causes this error and how I can solve this problem?
Edit
I added android.enableAapt2=false to the gradle.properties and it seems ignores error, but causes this warning:
The option 'android.enableAapt2' is deprecated and should not be used
anymore. Use 'android.enableAapt2=true' to remove this warning. It
will be removed at the end of 2018..
you cannot assign false (nor any other value but it's name) to an ID resource.
An ID is a simple resource that is referenced using the value provided in the name attribute (not the name of the XML file). As such, you can combine ID resources with other simple resources in the one XML file, under one element. Also, remember that an ID resources does not reference an actual resource item; it is simply a unique ID that you can attach to other resources or use as a unique integer in your application.
with android.enableAapt2=false it might ignore the logical error, but not "fix it".
I've got a rather complicated project some of which is older code from the past year or so which in React Native time is forever.
The regular debug build is working fine but the release build has errors. I've cobbled together answers from other places to make it as far as I have but I don't know how to get past this last bit.
I keep getting a bundling error where aapt will fail because it doesn't bundle the resources properly.
Example of error code:
> Task :app:bundleReleaseJsAndAssets
Scanning folders for symlinks in /media/user/1546c7ef-f386-4baa-90d5-cbd87092d3e31/home/user/Code/React-Native/timesavr/node_modules (9ms)
Scanning folders for symlinks in /media/user/1546c7ef-f386-4baa-90d5-cbd87092d3e31/home/user/Code/React-Native/timesavr/node_modules (6ms)
warning: the transform cache was reset.
Loading dependency graph, done.
bundle: Writing bundle output to: /media/user/1546c7ef-f386-4baa-90d5-cbd87092d3e31/home/user/Code/React-Native/timesavr/android/app/build/intermediates/assets/release/index.android.bundle
bundle: Done writing bundle output
error: resource android:style/TextAppearance.Material.Widget.Button.Borderless.Colored not found.
error: resource android:style/TextAppearance.Material.Widget.Button.Colored not found.
/home/user/.gradle/caches/transforms-1/files-1.1/appcompat-v7-26.0.2.aar/28fa7b5f2db0b5e014559f7cf36ab4c7/res/values-v26/values-v26.xml:9:5-12:13: AAPT: error: resource android:attr/colorError not found.
/home/user/.gradle/caches/transforms-1/files-1.1/appcompat-v7-26.0.2.aar/28fa7b5f2db0b5e014559f7cf36ab4c7/res/values-v26/values-v26.xml:13:5-16:13: AAPT: error: resource android:attr/colorError not found.
/home/user/.gradle/caches/transforms-1/files-1.1/appcompat-v7-26.0.2.aar/28fa7b5f2db0b5e014559f7cf36ab4c7/res/values-v26/values-v26.xml:17:5-93: AAPT: error: style attribute 'android:attr/keyboardNavigationCluster' not found.
error: failed linking references.
FAILURE: Build failed with an exception.
* What went wrong:
Execution failed for task ':react-native-image-resizer:verifyReleaseResources'.
> com.android.ide.common.process.ProcessException: Failed to execute aapt
Building upon GenericJam's answer, you can do this programatically to all sub libraries by doing something like this in your project build.gradle file:
subprojects { subproject ->
afterEvaluate{
if((subproject.plugins.hasPlugin('android') || subproject.plugins.hasPlugin('android-library'))) {
android {
compileSdkVersion rootProject.ext.compileSdkVersion
buildToolsVersion rootProject.ext.buildToolsVersion
}
}
}
}
The way to solve this that worked for me is to dive into the node_modules code for the supporting libraries that are triggering the error.
You will need to go into node_modules/project-name/android/build.gradle and change this
android {
compileSdkVersion 23
buildToolsVersion "23.0.1"
...
}
to whatever the sdk version is in your /android/app/build.gradle is.
For example:
android {
compileSdkVersion 27
buildToolsVersion "27.0.1"
...
}
Hopefully this will be fixed in React Native so this workaround isn't necessary.
Edit: I suspect Petter's solution is the better one although I haven't tried it myself. Probably try that one first and if it doesn't work, try this next.
When I add the core-ktx dependency to my app's build.gradle file, my gradle builds fail with the error message AAPT2 error: check logs for details
It furthermore tells that there are two attributes missing in values.xml. This file is located under the .gradle folder inside my user directory.
when I add android.enableAAPT2=false to my project properties, the build fails due to that option being deprecated so I want to avoid that.
The error descriptions of the two resource not found errors are the following:
error: resource android:attr/fontVariationSettings not found.
Message{kind=ERROR, text=error: resource android:attr/fontVariationSettings not found., sources=[C:\Users\Marc.gradle\caches\transforms-1\files-1.1\appcompat-v7-26.1.0.aar\b6d4f8d4d33639ae469eaec181e24176\res\values\values.xml], original message=, tool name=Optional.of(AAPT)}
When I add different ktx libraries everything is just fine. It builds properly and I can even import androidx.collections! How can I add the core-ktx library without any errors?
You are using 'AndroidX' which is only available if you set your compileSdkVersion 'android-P' and targetSdkVersion 28. Then in AndroidStudio go to Refactor -> Refactor to AndroidX and everything should work fine now :).
I've update Android Studio to 0.9, build tools to 21.1.0 and gradle to 0.14 because I want to use the new multiDexEnabled true feature. Currently I'm managing the multidex using this approach https://github.com/casidiablo/multidex and everything is working, but the multiDexEnabled feature seems better.
But using gradle 0.14 I've got this error : uses-sdk element cannot have a "tools:node" attribute which I "solved" using the solution posted by #Medo.
But if I use this approach the multiDexEnabled won't work , and I'll get this error:
Error:A problem was found with the configuration of task ':participactclient:collectDebugMultiDexComponents'.
File '/Users/danielecampogiani/Developing/Android/Android Studio/Participact Client/participactclient/build/intermediates/manifests/full/debug/AndroidManifest.xml' specified for property 'manifest' does not exist.
How to solve this?