Execution failed for task ':flutter_twitter:verifyReleaseResources' - android

I'm working on Flutter app. I can run app in the android device successfully but try to make build (.apk) file and got below issues.
FAILURE: Build failed with an exception.
* What went wrong:
Execution failed for task ':flutter_twitter:verifyReleaseResources'.
> A failure occurred while executing com.android.build.gradle.internal.tasks.Workers$ActionFacade
> Android resource linking failed
/Users/ipatel/.gradle/caches/transforms-2/files-2.1/8f09fa5c6115de167b21b323f769edd9/core-1.0.0/res/values/values.xml:57:5-88:25: AAPT: error: resource android:attr/fontVariationSettings not found.
/Users/ipatel/.gradle/caches/transforms-2/files-2.1/8f09fa5c6115de167b21b323f769edd9/core-1.0.0/res/values/values.xml:57:5-88:25: AAPT: error: resource android:attr/ttcIndex not found.
* Try:
Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output. Run with --scan to get full insights.
* Get more help at https://help.gradle.org
BUILD FAILED in 5m 2s
Running Gradle task 'assembleRelease'...
Running Gradle task 'assembleRelease'... Done 303.8s (!)
The built failed likely due to AndroidX incompatibilities in a plugin. The tool is about to try using Jetfier to solve the incompatibility.
Building plugin firebase_messaging...
The plugin firebase_messaging could not be built due to the issue above.
Below are project's stuffs
defaultConfig {
// TODO: Specify your own unique Application ID (https://developer.android.com/studio/build/application-id.html).
applicationId "com.xxxx.eeee"
minSdkVersion 21
targetSdkVersion 28
versionCode flutterVersionCode.toInteger()
versionName flutterVersionName
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
}
dependencies {
implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlin_version"
testImplementation 'junit:junit:4.12'
androidTestImplementation 'androidx.test:runner:1.1.1'
androidTestImplementation 'androidx.test.espresso:espresso-core:3.1.1'
}
> local.properties
sdk.dir=/Users/ipatel/Library/Android/sdk
flutter.sdk=/Users/ipatel/Documents/Amit/FlutterSetup/flutter
flutter.buildMode=release
flutter.versionName=1.0.0
flutter.ver
My app is compatible with AndroidX and also tried with many solution but can't able to fix my issue.
I checked
- https://github.com/roughike/flutter_twitter_login/issues/29
- A failure occurred while executing com.android.build.gradle.internal.tasks
- flutter Error "Android dependency 'androidx.core:core' has different version" using flutter_local_notifications and location packages
and others.
Flutter Doctor Result:
Doctor summary (to see all details, run flutter doctor -v):
[✓] Flutter (Channel beta, v1.12.13+hotfix.6, on Mac OS X 10.14.3 18D109, locale en-IN)
[✓] Android toolchain - develop for Android devices (Android SDK version 29.0.2)
[✓] Xcode - develop for iOS and macOS (Xcode 10.3)
[✓] Chrome - develop for the web
[✓] Android Studio (version 3.5)
[✓] VS Code (version 1.41.1)
[✓] Connected device (4 available)
build.gradle
android {
compileSdkVersion 28
sourceSets {
main.java.srcDirs += 'src/main/kotlin'
}
lintOptions {
disable 'InvalidPackage'
}
defaultConfig {
applicationId "com.xxxx.aaaa"
minSdkVersion 21
targetSdkVersion 28
multiDexEnabled true
versionCode flutterVersionCode.toInteger()
versionName flutterVersionName
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
}
buildTypes {
release {
// TODO: Add your own signing config for the release build.
// Signing with the debug keys for now, so `flutter run --release` works.
signingConfig signingConfigs.debug
}
}
}
gradle.properties
org.gradle.jvmargs=-Xmx1536M
android.enableR8=true
android.useAndroidX=true
android.enableJetifier=true
~PS : Let me know if you want more details from my end.

The issue is some library is not compatible or not using androidx while others are. Thanks to google for transferring all support lib to androidx now many libraries having conflicts like this and I mostly go to debug around which lib has an issue like commenting and uncommenting the lib from pubspec.
Assuming the flutter_twitter plugin was the issue.
As we can check that, that twitter plugin not using AndroidX link so we need to change it our self.
(all these changes needs to be changed in twitter plugin, not flutter project)
I think you can change the gradle.properties to use androidx and also compile version to 28
gradle.properties:
android.useAndroidX=true
android.enableJetifier=true
add this two lines, change gradle classpath
classpath 'com.android.tools.build:gradle:3.5.3'
and compileSdkVersion 28 in flutter_twitter.
I am able to generate release build using that plugin.
Ohh yah you can find your cached version of plugin at /Users/parth.dave/.pub-cache/hosted/pub.dartlang.org/flutter_twitter_login-1.1.0/ something like this where you can update it. or either open android folder in androidstudio and studio will show you two projects app and twitter where you can update this things.
also sometimes it's better to open android project in android studio and update all things from which you might get errors before running flutter projects.

Problem is with Execution failed for task ':flutter_twitter:verifyReleaseResources'.
i found link for this issue
flutter_twitter_login/issue #12
Add this dependency in your pubspec.yaml file and let me know this working or not?
flutter_twitter_login:
git: git://github.com/eudangeld/flutter_twitter_login.git

Goto the android studio external libraries in the left side
--> select the library that cause this issue
--> then goto the android -> build.gradle and update the compileSdkVersion to 28

You need to update the compileSdkVersion of the flutter_twitter module to 28 :
1/ In your flutter project, locate your "android" folder and open it as an android project in Android Studio.
2/ Expand "Gradle Scripts" and wait for it to load.
3/ Locate "build.gradle (Module: flutter_twitter)"
4/ Modify the compileSdkVersion from 27->28.
5/ Save the changes.
My build worked after that.
The answer was here : https://github.com/flutter/flutter/issues/32595

thank you, it worked for me for device_id: ^0.1.3
plugin conflit with cloud_firestore: ^0.13.4+2
In your flutter project, locate your android folder and open it as an android project in Android Studio.
Expand Gradle Scripts and wait for it to load.
Locate build.gradle (Module: device_id)
Modify the compileSdkVersion from 27 -> 28.
Save the changes.

I faced a similar issue and here is how I fixed it by following this link.
In Android Studio (with your project open) right-click the android folder, and click "Flutter"->"Open Android Module in Android Studio". Select "Open in New Window"
In the new window, Wait for Gradle to finish the sync
Expand "Gradle Scripts"
Locate "build.gradle (Module: flutter_twitter)" or which so ever package is throwing the error
Modify the compileSdkVersion from 28->29 (or whatever is defined in your android/app/build.gradle file).
Save the changes and run flutter clean
Build the signed apk.

seems like your firebase_messaging library version does not support AndroidX support. Make sure you have updated version of this library.
dependencies:
firebase_messaging: ^6.0.9

I had the same problem before and it took almost a half day to find a solution.
My project compileSdkVersion was already 28 but in my case app-usage package compileSdkVersion was under 28 and i had to change it manually in
/home/"user"/.pub-cache/hosted/pub.dartlang.org/"package with problem"/android/build.gradle.
and it solved the problem.

Related

Cordova android build :app:processDebugResources failed

I woke up this morning, no code has been committed or pushed and I attempted to run a build but suddenly my build failed to give me the following error:
I tried updating Android Studio but that didn't work.
I looked online to check this android:attr/lStar but I could only find something related to react which I'm not using (my project is an Ionic angular application)
I am really puzzled about this has anyone tried this before?
I am using Cordova and the android version is 9.0.0
Abit more info
This is built using the command cordova build android the command that files is:
/Users/admin/myagent/_work/3/s/platforms/android/gradlew cdvBuildDebug -b /Users/admin/myagent/_work/3/s/platforms/android/build.gradle
so cdvBuildDebug -b
Solution 1
Just open your app/build.gradle file and change this line.
androidx.core:core-ktx:+
replace with
androidx.core:core-ktx:1.6.0
Here is an Example:
ext {
buildToolsVersion = "29.0.2"
minSdkVersion = 21
compileSdkVersion = 29
targetSdkVersion = 29
googlePlayServicesAuthVersion = "16.0.1"
androidXCore = "1.6.0"
}
Solution 2
upgrade the compile SDK to Android 31
If you are using androidx.core:core-ktx:+ then this will find the latest version of androidx.core:core-ktx:+ and the latest one is 1.7.0 and the latest version needs the Android 31 compile SDK. So that You are facing this issue.
Here is Two Possible Solution:
1- use a specific version, use androidx.core:core-ktx:${version} instead of androidx.core:core-ktx:+
2- upgrade the compile SDK to Android 31
for more information you can see this article from here.

Android Studio build fail with minSDK=29

I have Android Studio build problem.
Build fails only when changing the minSdk=29 with follwing error.
( It's OK with minSdk=28 )
android {
compileSdkVersion 29
defaultConfig {
applicationId "com.example.aaa"
minSdkVersion 29 // build fails with 29, it's OK with 28
targetSdkVersion 29
versionCode 1
versionName "1.0"
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
}
Fail messages on Android Studio build console
- Build: build failed
- Run build :
...
Caused by: com.android.tools.r8.utils.AbortException
- Andriod issues: (1 error)
Dex file with version '38' cannot be used with min sdk level '29'.
If anyone resolved this problem, please share your know-hows.
Thank you.
I came across this recently when updating a project for Android studio 3.5.3 to 3.6.3, however I manually changed gradle-wrapper.properties and the project's build.gradle before even opening the project.
In my case I was able to clean the build, delete the .gradle and .idea folders and rebuild without issue.
Edit: As stated in the comments, it is worthwhile to try a clean-rebuild first, rather than the "Scorched Earth" approach of deleting .gradle and .idea folders. Deleting them will take longer to recover from and blow away all your nice IDE settings!
This is because of latest gradle version :
classpath 'com.android.tools.build:gradle:3.5.3'
in Android 6.0 and lower android versions. In order to fix it you can downgrade the gradle version as follows :
classpath 'com.android.tools.build:gradle:3.5.1'
It will run on all android versions perfectly.

compileSdkVersion is not specified error in React Native Android

I get the build error when I try to build an Android app in my React Native project.
When I run react-native run-android, it says:
> Configure project :react-native-os
WARNING: Configuration 'compile' is obsolete and has been replaced with 'implementation' and 'api'.
It will be removed at the end of 2018. For more information see: http://d.android.com/r/tools/update-dependency-configurations.html
FAILURE: Build failed with an exception.
* What went wrong:
A problem occurred configuring project ':react-native-os'.
> compileSdkVersion is not specified.
In Android Studio, I can see that it says the same thing:
Cause: compileSdkVersion is not specified.
So I edited build.gradle(Module: app) file in Android Studio, but the problem persists and the error message doesn't change.
android {
// compileSdkVersion rootProject.ext.compileSdkVersion
compileSdkVersion 28
buildToolsVersion "28.0.3"
compileOptions {
sourceCompatibility JavaVersion.VERSION_1_8
targetCompatibility JavaVersion.VERSION_1_8
}
I tried solutions in other threads like this one but nothing worked. Does anyone know what the problem is here?
I also faced the same issue solved by :
1- run npm i #react-native-firebase/app in terminal
2- follow these steps to add firebase to the android platform.
Make sure that you have in android/app/build.gradle:
task copyDownloadableDepsToLibs(type: Copy) {
from configurations.compile
into 'libs'
}
(This error happened to me after I accidentally changed configurations.compile to configurations.implementation)
Easiest and effective solution if this is happening with react native
Move to node_module/#react-native-firebase/
for all modules example- app, firestore etc.
Go to their android folder and open build.gradle
you will see,
project.ext {
set('react-native', [
versions: [
android : [
minSdk : 'same your project version root folder/android/app/build.gradle',
targetSdk : 'same your project version root folder/android/app/build.gradle',
compileSdk: 'same your project version root folder/android/app/build.gradle',
buildTools: 'same your project version root folder/android/app/build.gradle'
],
firebase: [
bom: firebaseBomVersion,
],
],
])
}
Hope this made it work. Happy Coding :)
Go to node_module>#react-native-firebase>messaging>android>build.gradle
Find code which defines min and target sdk and define the sdk and build version same as you have in your main project build.gradle file.
Then run command cd android && ./gradlew clean && cd ..
Also make sure you had defined default firebase config in your app level build.gradle
Make sure you have this import on top your build.gradle :
apply plugin: "com.google.gms.google-services"
and an default config as :
defaultConfig { applicationId "..." minSdkVersion rootProject.ext.minSdkVersion targetSdkVersion rootProject.ext.targetSdkVersion versionCode 00 versionName "... multiDexEnabled true }
I think you are using Android Supported Library.
If you are 27+ Supported Library you should use compileSdkVersion 27 and targetSdkVersion 27
My issue was caused by node command not found by gradle.
# fixed by linking the node path to the /usr/bin/node
# node is binary was located in $HOME/.nvm/versions/node/v14.13.0/bin/node
sudo ln -s $(which node) /usr/bin/node
When I run the above command the issue above disappeared.
Maybe I am too later to answer but the possible reason is if your build.gradle version is above 7 than you also may be getting the error of maven, Plugin with id ‘maven’ not found. If you try to follow the steps and solve that error that sdk compile error vanishes.
https://lifesaver.codes/answer/plugin-with-id-maven-not-found-12774
This worked in my case

Build error upon facebook sdk installation

I am trying to install Facebook SDK to my react-native app which is being installed successfully, but when I try to run the app, it crashes with the following error:
Execution failed for task ':app:preDebugBuild'.
> Android dependency 'com.android.support:support-v4' has different version for the compile (27.0.2) and runtime (27.1.1) classpath. You should manually set the same version via DependencyResolution
This error originates from another installed sdk (jumio) and more specifically from the file application/node_modules/react-native-jumio-mobilesdk/android/build.gradle
Can someone please enlighten me?
When you have configurations clashing, you can force all projects to use a single build config
Add this to bottom of your ./android/build.gradle
subprojects {
afterEvaluate {project ->
if (project.hasProperty("android")) {
android {
compileSdkVersion 26 //or your preferred
buildToolsVersion "26.0.3" // your preferred
}
}
}
}
Turns out I had to update all the dependencies of com.android.support and not only the com.android.support:v4:xx.x.x. In my case it was
implementation com.android.support:support-v4:27.0.2
api com.android.support:appcompat-v7:27.0.2
implementation com.android.support:design:27.0.2
implementation com.android.support:cardview-v7:27.0.2
Thank you all for your answers and your time!
cd android
gradlew clean
Delete node_modules folder then
npm install
Rebuild again an it should fix the error

Error:Execution failed for task ':app:proguardRelease' (invalid entry CRC)

There are many other questions for Error:Execution failed for task ':app:proguardRelease' but I couldn't find any that told what to do for an invalid entry CRC.
I'm migrating from Eclipse to Android studio and I am trying to figure out how this works, especially Gradle. I imported an existing Android project. After updating the sdk to api 21 and setting the java 7 path in File/Project Structure, things seemed to be working. I could run my app and get it to build. However, when I do the Gradle assembleRelease or Build/Generate Signed APK I got the following error:
Error:Execution failed for task ':app:proguardRelease'.
> java.io.IOException: Can't read [/home/me/adt-bundle/sdk/platforms/android-21/android.jar] (invalid entry CRC (expected 0x51d86068 but got 0xe44d416b))
Here is my gradle file:
apply plugin: 'com.android.application'
android {
compileSdkVersion 21
buildToolsVersion "21.1.2"
defaultConfig {
applicationId "com.example.myapp"
minSdkVersion 8
targetSdkVersion 21
}
buildTypes {
release {
minifyEnabled true
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-project.txt'
}
}
}
dependencies {
compile 'com.android.support:support-v4:21.0.3'
}
I can get it to work if I set minifyEnabled false but I want to use proguard, not disable it.
I'm guessing this has something to do with a mismatch between an old filename and a new one, but I can't figure out what it is. I'm about to give up and go back to Eclipse, but I thought I would ask here first. Thanks.
Clues but not solutions (for me):
getDefaultProguardFile is unrecognized by Gradle file symbol resolver
https://code.google.com/p/android/issues/detail?id=72400
Android Studio - ProGuard "java.io.IOException ...bin\classes (No such file or directory)"
What is CRC? And how does it help in error detection?
Update
It wasn't just imported files from Eclipse that didn't work. Even starting a new project in Android Studio didn't work.
Following #ScottBarta's advice I redownloaded the sdk from here. (Since I already had Android Studio installed, I just downloaded the "SDK Tools Only" at the bottom of the page.) I renamed the old sdk folder (instead of deleting it). When I opened Android Studio it asked where the sdk folder was so I pointed it to the new one I just downloaded. When gradle tried to do its thing at startup, it found other missing components (the platform, build-tools, appcompat) so I just installed them one by one according to the error messages that gradle gave me.
I am writing this as I download everything. Let's see if it works now...and YES! IT DOES!!! Thank you, #ScottBarta!
This looks like a corrupted Android SDK -- the bad CRC indicates that some bits in one of the files are wrong. Try reinstalling it.

Categories

Resources