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
Related
I am trying to build android with Jenkin. But I am getting this compilation error:
Execution failed for task ':app:mergeDebugResources'.
> Multiple task action failures occurred:
> A failure occurred while executing com.android.build.gradle.internal.tasks.Workers$ActionFacade
> Android resource compilation failed
AAPT: C:\Windows\System32\config\systemprofile\AppData\Local\Jenkins\.jenkins\workspace\android_build\app\build\intermediates\res\merged\debug: error: The system cannot find the file specified. (2).
Can anyone else facing this issue. I tried running the build on Android Studio and it works fine. I have defined the sdk path in jenkins and setup gradle also.
Please help.
So I found a solution that worked for me. I was using jenkins:2.277.4, I downgraded the jenkin version to 2.204.6 and suddenly it worked. Also I used war file this time so the path to workspace was smaller as compared to previous install and yeah also use app:build as task for build so you dont get lint error for other libraries.
Everything was working smoothly but after update of Android Stdio 3.6 & Gradle to 3.5.0, Project is not building,
Getting bellow errors
FAILURE: Build failed with an exception.
* What went wrong:
Execution failed for task ':app:mergeDebugResources'.
> A failure occurred while executing com.android.build.gradle.internal.tasks.Workers$ActionFacade
> Android resource compilation failed
C:\Users\Amin\.gradle\caches\transforms-2\files-2.1\c1ea7b9f1e5ec36cfafa4328570d20ad\constraintlayout-2.0.0-beta2\res\values\values.xml:321:5-600: AAPT: error: duplicate value for resource 'attr/pivotX' with config ''.
C:\Users\Amin\.gradle\caches\transforms-2\files-2.1\c1ea7b9f1e5ec36cfafa4328570d20ad\constraintlayout-2.0.0-beta2\res\values\values.xml:321:5-600: AAPT: error: resource previously defined here.
C:\Users\Amin\.gradle\caches\transforms-2\files-2.1\c1ea7b9f1e5ec36cfafa4328570d20ad\constraintlayout-2.0.0-beta2\res\values\values.xml:321:5-600: AAPT: error: duplicate value for resource 'attr/pivotY' with config ''.
Here is gradle.properties
org.gradle.jvmargs=-Xmx4608m
android.enableJetifier=true
android.useAndroidX=true
Finally..
I have solved the problem..
I observed error was in constraintlayout as per logcat and observed the constraintlayout version which was alpha
I downgrade the version to implementation 'androidx.constraintlayout:constraintlayout:1.1.3'
and the issue got fixed.
Try changing in gradle.properties
org.gradle.jvmargs=-Xmx4096m
Anyone that tried to do so with com.android.tools.build:gradle:3.5.2 and Gradle Version 5.4.1 the fix is the same - make sure you are working with
androidx.constraintlayout:constraintlayout:1.1.3
when using 3.5.0 and up without androidx.constraintlayout:constraintlayout:1.1.3 - the UI will be blank (inflate exception) for any view that is extending ConstraintLayout.
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 use Android Studio 3.0 Beta 7 and update my project with the Android Gradle 3.0.0-beta7 plugin my project builds fine in both the debug and rc (proguard enabled) variants.
When I attempt to build on my Jenkins box, I get a bunch of:
C:\Windows\System32\config\systemprofile\.gradle\caches\transforms-1\files-1.1\androidsdk-2.4.12-fullRelease.aar\222313e24d6c4b00972b4191a95e6e2e\res\drawable-xxhdpi-v4\ic_teads_sdk_contact_us.png: error: file not found.
C:\Windows\System32\config\systemprofile\.gradle\caches\transforms-1\files-1.1\appcompat-v7-25.3.1.aar\c8fedf0a28e83c9ac57e1ac18693c6a0\res\drawable-hdpi-v4\abc_tab_indicator_mtrl_alpha.9.png: error: file not found.
C:\Windows\System32\config\systemprofile\.gradle\caches\transforms-1\files-1.1\android-sdk-ui-2.0.4.aar\0b51ce1d665e491601444168a26000ca\res\drawable-xhdpi-v4\com_appboy_inappmessage_chevron.png: error: file not found.
What went wrong:
Execution failed for task ':mergeDevOnlySlDebugResources'.
Error: java.util.concurrent.ExecutionException: com.android.tools.aapt2.Aapt2Exception: AAPT2 error: check logs for details
I tried to use AAPT instead of AAPT2 and that still gives me the same problem. My other jenkins projects that are not running this gradle 3 change still run fine. Also the files that can't be found from above are indeed on my machine in the location that AAPT can't find.
Has anyone run into this before?
I've seen error's online about invalid PNG or actual errors from using the new AAPT2, but this is different.
I solved this problem by adding the below line to the gradle.properties file:
android.enableAapt2=false
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.