Related
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.
I am getting this error while I am building APK.
Cause 1: org.gradle.workers.internal.DefaultWorkerExecutor$WorkExecutionException: A failure occurred while executing com.android.build.gradle.internal.tasks.Workers$ActionFacade
at org.gradle.workers.internal.DefaultWorkerExecutor$WorkerExecution.waitForCompletion(DefaultWorkerExecutor.java:285)
at org.gradle.internal.work.DefaultAsyncWorkTracker.waitForItemsAndGatherFailures(DefaultAsyncWorkTracker.java:115)
at org.gradle.internal.work.DefaultAsyncWorkTracker.waitForCompletion(DefaultAsyncWorkTracker.java:87)
at org.gradle.workers.internal.DefaultWorkerExecutor.await(DefaultWorkerExecutor.java:150)
at com.android.build.gradle.internal.tasks.Workers$WorkerExecutorAdapter.await(Workers.kt:282)
at com.android.ide.common.resources.MergeWriter.end(MergeWriter.java:48)
at com.android.ide.common.resources.MergedResourceWriter.end(MergedResourceWriter.java:242)
at com.android.ide.common.resources.DataMerger.mergeData(DataMerger.java:292)
at com.android.ide.common.resources.ResourceMerger.mergeData(ResourceMerger.java:384)
at com.android.build.gradle.tasks.MergeResources.lambda$doFullTaskAction$1(MergeResources.java:261)
at com.android.build.gradle.internal.tasks.Blocks.recordSpan(Blocks.java:58)
Tried to invalidate cache and restart android studio.Rebuild project but none of them works for me.
Finally found a solution for this by adding this line to gradle.properties.
org.gradle.jvmargs=-Xmx4608m
Try this, in Android Studio
File > Invalidate Caches/Restart...
I already had multidex enabled but the version was too old so upgraded and it fixed the issue:
// Old version
implementation "com.android.support:multidex:1.0.3"
// New version
def multidex_version = "2.0.1"
implementation "androidx.multidex:multidex:$multidex_version"
In my case, I enabled multidex
Open [project_folder]/app/build.gradle and add following lines.
defaultConfig {
...
multiDexEnabled true
}
and
dependencies {
...
implementation 'com.android.support:multidex:2.0.1'
}
I removed this issue by adding the following lines
add multiDexEnabled true in android>app>build.gradle inside defaultConfig
add implementation 'com.android.support:multidex:1.0.3' in android>app>build.gradle inside dependencies
Encountered Similar issue... the fix for me was changing/updating the gradle version
classpath "com.android.tools.build:gradle:4.1.2"
to
classpath "com.android.tools.build:gradle:4.1.3"
worked for me
gradle.proprites
org.gradle.jvmargs=-Xmx1536M
build.gradle
defaultConfig {
multiDexEnabled true
}
dependencies {
implementation 'com.android.support:multidex:1.0.3'
}
and yet theses stuff did not fix my problem, until I increase the compileSdkVersion from 27 to 28, it worked for me.
android {
compileSdkVersion 28
sourceSets {
main.java.srcDirs += 'src/main/kotlin'
}
lintOptions {
disable 'InvalidPackage'
}
defaultConfig {
minSdkVersion 21
targetSdkVersion 28
versionCode flutterVersionCode.toInteger()
versionName flutterVersionName
multiDexEnabled true
}
buildTypes {
release {
crunchPngs false
}
}
}
I got an stacktrace similar to yours only when building to Lollipop or Marshmallow, and the solution was to disable Advanved profiling.
Find it here:
Run -> Edit Configurations -> Profiling -> Enable advanced profiling
https://stackoverflow.com/a/58029739/860488
search your code you must be referring to color in color.xml in an xml drawable.
go and give hex code instead of referencing....
Example:
in drawable.xml you must have called
android:fillColor="#color/blue"
change it to android:fillColor="#ffaacc"
hope it solve your problem...
please check if current icons are not on debug folder if so move them to main folder or recreate them
I also have the same issue , and you can add this
org.gradle.jvmargs=-Xmx4608m on your Gradle.properties
but in my case I change like this :
from :
org.gradle.jvmargs=-Xmx2048m -Dfile.encoding=UTF-8
to:
org.gradle.jvmargs=-Xmx4608m -Dfile.encoding=UTF-8
classpath 'com.android.tools.build:gradle:3.3.2'
Change the class path and it will work.
Solution for:
Caused by 4: com.android.builder.internal.aapt.AaptException: Dependent features configured but no package ID was set.
All feature modules have to apply the library plugin and NOT the application plugin.
build.gradle (:androidApp:feature_A)
apply plugin: 'com.android.library'
It all depends on the stacktrace of each one. Cause 1 WorkExecutionException may be the consequence of other causes. So I suggest reading the full stacktrace from the last cause printed towards the first cause. So if we solve the last cause, it is very likely that we will have fixed the chain of causes from the last to the first.
I attach an example of my stacktrace where the original or concrete problem was in the last cause:
Caused by: org.gradle.workers.internal.DefaultWorkerExecutor$WorkExecutionException: A failure occurred while executing com.android.build.gradle.internal.res.LinkApplicationAndroidResourcesTask$TaskAction
Caused by: com.android.builder.internal.aapt.v2.Aapt2InternalException: AAPT2 aapt2-4.2.0-alpha16-6840111-linux Daemon #0: Unexpected error during link, attempting to stop daemon.
Caused by: java.io.IOException: Unable to make AAPT link command.
Caused by 4: com.android.builder.internal.aapt.AaptException: Dependent features configured but no package ID was set.
GL
Feature Package ID was not set
in my code i am using latest version of flutter and packages
and remove this error by adding the line in
multiDexEnabled true
in app level build.gradle
In right side of android studio
click gradle -> app -> build -> assemble.
then android studio will start building, and print you a proper message of the issue.
Working on android studio: 3.6.3 and gradle version:
classpath 'com.android.tools.build:gradle:3.6.3'
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:1.3.72"
Adding this line in
gradle.properties file
org.gradle.jvmargs=-Xmx512m
just add
android.enableJetifier=true
to the gradle.properties .
actually this happens mostly when you mess up with androidx and support libraries, some dependencies are currently not fully supporting androidX. so you have to enable jetfier.
I update this and worked for me in gradle wrapper properties
distributionUrl=https\://services.gradle.org/distributions/gradle-6.7-all.zip
This fixed my issue.
cd android && ./gradlew clean
found the solution.
add this code to your build.gradle,
dependencies {
def multidex_version = "2.0.1"
implementation 'androidx.multidex:multidex:$multidex_version'
}
then enable the multidex to true
defaultConfig {
...
minSdkVersion 15
targetSdkVersion 28
multiDexEnabled true
}
If you've tried all the solutions above and still doesn't resolve your issue.
This might not seemed related, but here's my take on it.
Try removing this from your Gradle dependency, I've spend 2 hours of my time because of this roadblock.
implementation "com.squareup.retrofit2:adapter-rxjava2:2.3.0"
I got this problem when I directly downloaded code files from GitHub but it was showing this error, but my colleague told me to use "Git bash here" and use the command to Gitclone it. After doing so it works fine.
In my case the issue was related to View Binding. It couldn't generate binding classes due to an invalid xml layout file. In the file I had a Switch with an id switch, which is a Java keyword. Renaming the Switch id resolved the issue.
How To Solve A failure occurred while executing com.android.build.gradle.internal.tasks.Workers$ActionFacade Error?
To Solve A failure occurred while executing com.android.build.gradle.internal.tasks.Workers$ActionFacade Error 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. 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 use a specific version, use androidx.core:core-ktx:${version} instead of androidx.core:core-ktx:+ upgrade the compile SDK to Android 31
full article is Here
If any one having this issue in flutter after adding firebase storage. Do flutter clean and re run it, it will work
if you are stuck in this error below
Execution failed for task ':app:signReleaseBundle'. > A failure occurred while
executing com.android.build.gradle.internal.tasks.Workers$ActionFacade > 'other'
has different root
**then do it change the location your the .abb in time of generating to your
project(own project of this .aab) then go to app and then select the realese
folder to save your .aab **
try to add this to your gradle.properties
org.gradle.jvmargs=-Xmx1536M
android.useAndroidX=true
android.enableJetifier=true
You may get an error like this when trying to build an app that uses a VectorDrawable for an Adaptive Icon. And your XML file contains "android:fillColor" with a <gradient> block:
res/drawable/icon_with_gradient.xml
<?xml version="1.0" encoding="utf-8"?>
<vector xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:aapt="http://schemas.android.com/aapt"
android:width="96dp"
android:height="96dp"
android:viewportHeight="100"
android:viewportWidth="100">
<path
android:pathData="M1,1 H99 V99 H1Z"
android:strokeColor="?android:attr/colorAccent"
android:strokeWidth="2">
<aapt:attr name="android:fillColor">
<gradient
android:endColor="#156a12"
android:endX="50"
android:endY="99"
android:startColor="#1e9618"
android:startX="50"
android:startY="1"
android:type="linear" />
</aapt:attr>
</path>
</vector>
Gradient fill colors are commonly used in Adaptive Icons, such as in the tutorials here, here and here.
Even though the layout preview works fine, when you build the app, you will see an error like this:
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
> Error while processing Project/app/src/main/res/drawable/icon_with_gradient.xml : null
(More info shown when the gradle build is run with --stack-trace flag):
Caused by: java.lang.NullPointerException
at com.android.ide.common.vectordrawable.VdPath.addGradientIfExists(VdPath.java:614)
at com.android.ide.common.vectordrawable.VdTree.parseTree(VdTree.java:149)
at com.android.ide.common.vectordrawable.VdTree.parse(VdTree.java:129)
at com.android.ide.common.vectordrawable.VdParser.parse(VdParser.java:39)
at com.android.ide.common.vectordrawable.VdPreview.getPreviewFromVectorXml(VdPreview.java:197)
at com.android.builder.png.VectorDrawableRenderer.generateFile(VectorDrawableRenderer.java:224)
at com.android.build.gradle.tasks.MergeResources$MergeResourcesVectorDrawableRenderer.generateFile(MergeResources.java:413)
at com.android.ide.common.resources.MergedResourceWriter$FileGenerationWorkAction.run(MergedResourceWriter.java:409)
The solution is to move the file icon_with_gradient.xml to drawable-v24/icon_with_gradient.xml or drawable-v26/icon_with_gradient.xml. It's because gradient fills are only supported in API 24 (Android 7) and above. More info here: VectorDrawable: Invalid drawable tag gradient
I know this might not be a complete or exact solution, but for those who are still facing issues even after doing what is given on this thread, check for your files in value folder. For me there was a typo and some missing values. Once i fixed them this error stopped.
If you getting this error saying signing-config.json (Access denied) means just exit the android studio and just go to the desktop home and click on the android studio icon and give Run as Administrator, this will sort out the problem (or) you can delete the signing-config.json and re-run the program :)
I am trying to import my project.
but when I run the application I am getting the following error:
Error: Execution failed for task ':app:processDebugResources'.
> com.android.ide.common.process.ProcessException:
org.gradle.process.internal.ExecException: Process 'command 'C:\Users\Vishnu Ruhela\AppData\Local\Android\sdk\build-tools\21.1.2\aapt.exe'' finished with non- zero exit value 1
here is my gradle file
apply plugin: 'com.android.application'
android {
compileSdkVersion 21
buildToolsVersion "21.1.2"
defaultConfig {
applicationId "com.example.vishnuruhela.signup"
minSdkVersion 15
targetSdkVersion 21
versionCode 1
versionName "1.0"
}
buildTypes {
release {
minifyEnabled true
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
productFlavors { }
}
dependencies {
compile fileTree(dir: 'libs', include: ['*.jar'])
compile 'com.android.support:appcompat-v7:21.0.3'
compile project(':listView1')
}
I was getting this exact same error. I ran the command
./gradlew assembleDebug --info
Where "assembleDebug" was replaced with the assemble task for a debug version of the flavor I wanted.
Look for output
Successfully started process 'command '/usr/local/opt/android-sdk/build-tools/21.1.2/aapt''
Right below that was an error describing a resource which I used in a layout file but which was missing from the dimensions files. Fixing this fixed the build issue.
At first you go to
Build -> Clean Project
and then go to
Build -> Rebuild Project
and finish the error is a way
Install the latest version of the build tools. Adjust your build.gradle to use
android {
compileSdkVersion {X}
buildToolsVersion "{X.Y.Z}"
...
}
Proper values should match your installed SDK. Could be 23.0.3 at the time of this post.
or check and remove duplicate dependencies from list.
Enjoy :)
Follow this simple steps to recover this error:
Method 1:
-Go to File->project structure->Project
-Check Android plugin Version and change it to 1.3.0(Latest one)
-Go to File->project structure->app->Properties->Build Tools Version
-Change it to latest one(22.0.1). Also do this for any other module you have for your project.
-Clean and build project.
Note: If your build tool version is less than 22.0.1 then you may still face same error while gradle build so please update your SDK from SDK Manager to latest one then restart android studio and follow above steps.
Method 2:
-If you don't want to update build tools version or you don't have latest SDK version just Go to File->project structure->Project.
-Check Android plugin Version and change it to 1.0.0(Older one)
-Clean and build project.
I recommended Method 1.
I had the same problem after replacing some .png image resources with .jpg pictures.
I deleted appname/app/build, than I selected Build -> Rebuild project and finally it worked without any errors.
In my case, answers of taciosd and Netero pointed in the correct direction. By analyzing:
gradle assembleDebug --stacktrace --debug
Linux:
./gradlew assembleDebug --stacktrace --debug
i found out that one filepath in the assets folder was too long and aapt.exe stopped by returning 1 (and no specific error message) when processing that file. It seems that files with non ASCII characters in names are not accepted as well.
I had this same exact error all of a sudden the other day. I did a "Clean Project" and a "Rebuild Project" and never saw the error again.
I've only got a few months of Android development under my belt. But whenever I get an unexplained error like this, "Clean Project" and/or "Rebuild Project" are the first things I try.
i had the same problem i resolve it by removing files that i added in the assets folder and those files name contains insupported characteres like "é" , " ", "ï" "è"...
by renaming those name files or removing them you will have no problem.
BuildToolsVersion & Dependencies must be same with Base API version.
buildToolsVersion '23.0.2' & compile
&
com.android.support:appcompat-v7:24.0.0-alpha1
can not match with base API level.
It should be
compile 'com.android.support:appcompat-v7:21.0.3'
Done
Errors in the execution of aapt in task processDebugResources or processReleaseResources generally happen when one or more resources of your project are unsupported.
To find out go to the root dir of your project and run:
gradle processDebugResources --debug
This will print aapt specific error. In my case it was a file in the assets folder whose name had invalid character (LEÃO.jpg). aapt doesn't support some characters in the Latin alphabet.
But, as I explained your problem can be other than that. To know for sure you have to run processDebugResources with the option --debug.
I have faced the same error while compiling. I tried all the methods here but failed only one thing worked but it takes a lot of time. by running this code on CMD to debug my app and shows me the missing tag in my XML layout.
gradle processDebugResources --debug
The best approach is to analyze the error not just ignoring it.
To run this code I installed Java JDK and then set Environment Variable: for JAVA_HOME and Gradle.
for gradle
C:\Program Files\Android\Android Studio\gradle\gradle-4.6\bin
for java
JAVA_HOME=C:\Program Files\Java\jre1.8.0_191
You have to do the following instructions :
Click on Build located in the toolbar, then
Clean project -> Rebuild Project
Please make sure that compileSdkVersion, buildToolsVersion and targetSdkVersion have the same version number. I also have this error because it has different version. This solution worked for me.
I hope it can help you all.
when our code has layout.xml file error ,we get this error message. Check your xml files again.
look through your styles.xml files for a #+id/
I had one in styles.xml in values-v17 which I don't recall creating. This is what I had to change in the end and not build tools 21.1.2 to 22.0.1 as suggested.
I also had the same error with my images .. Just rename the extension from ".png" or whatever you have to ".jpg"
I had the same problem.
Try renaming the files in assets folder with characters other than alphabets, numbers and underlines.
Specially, look for apostrophes and European alphabets not common in English.
I build with command:
./gradlew build --info
It show more error message, my problem is there is special characters in the file name.
I too was facing this issue just because i had renamed my project folder while project was opened in Android Sudio.So,Android Studio created another folder in that directory of my window.
I found in my build.gradle(Module:app), all the support libraries were updated and was throwing error on compile time of project.
All you require to do is,simply change updated support libraries to your current build tool version like this and rebuild the project.
compile 'com.android.support:appcompat-v7:22.2.1'
compile 'com.android.support:design:22.2.1'
compile 'com.android.support:cardview-v7:22.2.1'
my current build tool version is 22.2.1
When i replace the images in project then i get this issue.
Then i found that one of the image was having extension .PNG then i rename it to .png then my issue was resolved.
Hope it helps you
I had this same problem, and it only went away after a removed the .gradle folder from my project's root.
So make sure you:
Close the project in Android Studio
Open your file explorer, find the project's root directory
Completely remove the folder .gradle
I hope this helps. Good luck!
I was also getting this issue.
I generally face this issue when I import some sample or already
existing module into my project.
I just added latest v7 and v4 to my project from maven in
android studio and got it fixed
Removed duplicate dependencies from project like wise if your library project and application project are using v7 or v4 or any other library , they should be of same version. or try to have it only in your library project
I had the same problem. Even JPG files did not work. Put all your image files into mipmap and work. They work perfectly.
I ran to same problem today and try to clean and rebuild project.
I did not solve my problem. I got it solved with change the compileSdkVersion, buildToolsVersion, targetSdkVersion and com.android.support:appcompat-v7:23.0.1 values instead on my Gradle app file. Then I ran clean and rebuild the project afterwards.
For return value 3 "OutOfMemory exception" i added following in gradle android section
android {
............
dexOptions {
incremental = true;
preDexLibraries = false
javaMaxHeapSize "4g" // 2g should be also OK
}
............
}
And for 2nd issue with return value 2, earlier i had following in gradle dependencies for JDK 7
compile 'com.android.support:appcompat-v7:+'
compile 'com.google.android.gms:play-services:7+'
compile 'com.facebook.android:facebook-android-sdk:+'
compile 'com.android.support:recyclerview-v7:+'
compile 'com.android.support:support-v4:+'
Then i updated my JDK to 8 and it started to give me error (probably for jdk 8 there were more than one libs available with 7+ ) while running the application. What fixed my issue is giving specific version instead of 7+. i.e.
compile 'com.android.support:appcompat-v7:23.1.0'
compile 'com.google.android.gms:play-services:8.1.0'
compile 'com.facebook.android:facebook-android-sdk:4.7.0'
compile 'com.android.support:recyclerview-v7:23.1.0'
compile 'com.android.support:support-v4:23.1.0'
In my case, I had to install "libz.so.1" library to make it work, on Ubuntu 15.04
sudo apt-get install lib32z1
Error:Execution failed for task com.android.ide.common.process.ProcessException: org.gradle.process.internal.ExecException:
finished with non-zero exit value 1
One reason for this error to occure is that the file path to a resource file is to long:
Error: File path too long on Windows, keep below 240 characters
Fix: Move your project folder closer to the root of your disk
Don't:// folder/folder/folder/folder/very_long_folder_name/MyProject...
Do://folder/short_name/MyProject
Another reason could be duplicated resources or name spaces
Example:
<style name="MyButton" parent="android:Widget.Button">
<item name="android:textColor">#color/accent_color</item>
<item name="android:textColor">#000000</item>
</style>
In my case this error was caused by empty layout xml file.
I created the empty file but forgot to add any content to it. AndroidStudio gave this misleading error message, but when I executed the gradle build from command line I could see the real error like "Error parsing XML: no element found" and the file name.
Adding basic layout xml content fixed the error.
look the compileSdkVersion at android/biuld.gradle ,and compileSdkVersion in all other packages
should be the same.
just for the record. I followed all clean/rebuild and update SDK-Tools here, but in the end it turned out disable Instant Run, to solve my issue.
Go to: Android Studio -> Preferences -> Build,ExecutionDeployment -> Instant Run
I am trying to import my project.
but when I run the application I am getting the following error:
Error: Execution failed for task ':app:processDebugResources'.
> com.android.ide.common.process.ProcessException:
org.gradle.process.internal.ExecException: Process 'command 'C:\Users\Vishnu Ruhela\AppData\Local\Android\sdk\build-tools\21.1.2\aapt.exe'' finished with non- zero exit value 1
here is my gradle file
apply plugin: 'com.android.application'
android {
compileSdkVersion 21
buildToolsVersion "21.1.2"
defaultConfig {
applicationId "com.example.vishnuruhela.signup"
minSdkVersion 15
targetSdkVersion 21
versionCode 1
versionName "1.0"
}
buildTypes {
release {
minifyEnabled true
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
productFlavors { }
}
dependencies {
compile fileTree(dir: 'libs', include: ['*.jar'])
compile 'com.android.support:appcompat-v7:21.0.3'
compile project(':listView1')
}
I was getting this exact same error. I ran the command
./gradlew assembleDebug --info
Where "assembleDebug" was replaced with the assemble task for a debug version of the flavor I wanted.
Look for output
Successfully started process 'command '/usr/local/opt/android-sdk/build-tools/21.1.2/aapt''
Right below that was an error describing a resource which I used in a layout file but which was missing from the dimensions files. Fixing this fixed the build issue.
At first you go to
Build -> Clean Project
and then go to
Build -> Rebuild Project
and finish the error is a way
Install the latest version of the build tools. Adjust your build.gradle to use
android {
compileSdkVersion {X}
buildToolsVersion "{X.Y.Z}"
...
}
Proper values should match your installed SDK. Could be 23.0.3 at the time of this post.
or check and remove duplicate dependencies from list.
Enjoy :)
Follow this simple steps to recover this error:
Method 1:
-Go to File->project structure->Project
-Check Android plugin Version and change it to 1.3.0(Latest one)
-Go to File->project structure->app->Properties->Build Tools Version
-Change it to latest one(22.0.1). Also do this for any other module you have for your project.
-Clean and build project.
Note: If your build tool version is less than 22.0.1 then you may still face same error while gradle build so please update your SDK from SDK Manager to latest one then restart android studio and follow above steps.
Method 2:
-If you don't want to update build tools version or you don't have latest SDK version just Go to File->project structure->Project.
-Check Android plugin Version and change it to 1.0.0(Older one)
-Clean and build project.
I recommended Method 1.
I had the same problem after replacing some .png image resources with .jpg pictures.
I deleted appname/app/build, than I selected Build -> Rebuild project and finally it worked without any errors.
In my case, answers of taciosd and Netero pointed in the correct direction. By analyzing:
gradle assembleDebug --stacktrace --debug
Linux:
./gradlew assembleDebug --stacktrace --debug
i found out that one filepath in the assets folder was too long and aapt.exe stopped by returning 1 (and no specific error message) when processing that file. It seems that files with non ASCII characters in names are not accepted as well.
I had this same exact error all of a sudden the other day. I did a "Clean Project" and a "Rebuild Project" and never saw the error again.
I've only got a few months of Android development under my belt. But whenever I get an unexplained error like this, "Clean Project" and/or "Rebuild Project" are the first things I try.
i had the same problem i resolve it by removing files that i added in the assets folder and those files name contains insupported characteres like "é" , " ", "ï" "è"...
by renaming those name files or removing them you will have no problem.
BuildToolsVersion & Dependencies must be same with Base API version.
buildToolsVersion '23.0.2' & compile
&
com.android.support:appcompat-v7:24.0.0-alpha1
can not match with base API level.
It should be
compile 'com.android.support:appcompat-v7:21.0.3'
Done
Errors in the execution of aapt in task processDebugResources or processReleaseResources generally happen when one or more resources of your project are unsupported.
To find out go to the root dir of your project and run:
gradle processDebugResources --debug
This will print aapt specific error. In my case it was a file in the assets folder whose name had invalid character (LEÃO.jpg). aapt doesn't support some characters in the Latin alphabet.
But, as I explained your problem can be other than that. To know for sure you have to run processDebugResources with the option --debug.
I have faced the same error while compiling. I tried all the methods here but failed only one thing worked but it takes a lot of time. by running this code on CMD to debug my app and shows me the missing tag in my XML layout.
gradle processDebugResources --debug
The best approach is to analyze the error not just ignoring it.
To run this code I installed Java JDK and then set Environment Variable: for JAVA_HOME and Gradle.
for gradle
C:\Program Files\Android\Android Studio\gradle\gradle-4.6\bin
for java
JAVA_HOME=C:\Program Files\Java\jre1.8.0_191
You have to do the following instructions :
Click on Build located in the toolbar, then
Clean project -> Rebuild Project
Please make sure that compileSdkVersion, buildToolsVersion and targetSdkVersion have the same version number. I also have this error because it has different version. This solution worked for me.
I hope it can help you all.
when our code has layout.xml file error ,we get this error message. Check your xml files again.
look through your styles.xml files for a #+id/
I had one in styles.xml in values-v17 which I don't recall creating. This is what I had to change in the end and not build tools 21.1.2 to 22.0.1 as suggested.
I also had the same error with my images .. Just rename the extension from ".png" or whatever you have to ".jpg"
I had the same problem.
Try renaming the files in assets folder with characters other than alphabets, numbers and underlines.
Specially, look for apostrophes and European alphabets not common in English.
I build with command:
./gradlew build --info
It show more error message, my problem is there is special characters in the file name.
I too was facing this issue just because i had renamed my project folder while project was opened in Android Sudio.So,Android Studio created another folder in that directory of my window.
I found in my build.gradle(Module:app), all the support libraries were updated and was throwing error on compile time of project.
All you require to do is,simply change updated support libraries to your current build tool version like this and rebuild the project.
compile 'com.android.support:appcompat-v7:22.2.1'
compile 'com.android.support:design:22.2.1'
compile 'com.android.support:cardview-v7:22.2.1'
my current build tool version is 22.2.1
When i replace the images in project then i get this issue.
Then i found that one of the image was having extension .PNG then i rename it to .png then my issue was resolved.
Hope it helps you
I had this same problem, and it only went away after a removed the .gradle folder from my project's root.
So make sure you:
Close the project in Android Studio
Open your file explorer, find the project's root directory
Completely remove the folder .gradle
I hope this helps. Good luck!
I was also getting this issue.
I generally face this issue when I import some sample or already
existing module into my project.
I just added latest v7 and v4 to my project from maven in
android studio and got it fixed
Removed duplicate dependencies from project like wise if your library project and application project are using v7 or v4 or any other library , they should be of same version. or try to have it only in your library project
I had the same problem. Even JPG files did not work. Put all your image files into mipmap and work. They work perfectly.
I ran to same problem today and try to clean and rebuild project.
I did not solve my problem. I got it solved with change the compileSdkVersion, buildToolsVersion, targetSdkVersion and com.android.support:appcompat-v7:23.0.1 values instead on my Gradle app file. Then I ran clean and rebuild the project afterwards.
For return value 3 "OutOfMemory exception" i added following in gradle android section
android {
............
dexOptions {
incremental = true;
preDexLibraries = false
javaMaxHeapSize "4g" // 2g should be also OK
}
............
}
And for 2nd issue with return value 2, earlier i had following in gradle dependencies for JDK 7
compile 'com.android.support:appcompat-v7:+'
compile 'com.google.android.gms:play-services:7+'
compile 'com.facebook.android:facebook-android-sdk:+'
compile 'com.android.support:recyclerview-v7:+'
compile 'com.android.support:support-v4:+'
Then i updated my JDK to 8 and it started to give me error (probably for jdk 8 there were more than one libs available with 7+ ) while running the application. What fixed my issue is giving specific version instead of 7+. i.e.
compile 'com.android.support:appcompat-v7:23.1.0'
compile 'com.google.android.gms:play-services:8.1.0'
compile 'com.facebook.android:facebook-android-sdk:4.7.0'
compile 'com.android.support:recyclerview-v7:23.1.0'
compile 'com.android.support:support-v4:23.1.0'
In my case, I had to install "libz.so.1" library to make it work, on Ubuntu 15.04
sudo apt-get install lib32z1
Error:Execution failed for task com.android.ide.common.process.ProcessException: org.gradle.process.internal.ExecException:
finished with non-zero exit value 1
One reason for this error to occure is that the file path to a resource file is to long:
Error: File path too long on Windows, keep below 240 characters
Fix: Move your project folder closer to the root of your disk
Don't:// folder/folder/folder/folder/very_long_folder_name/MyProject...
Do://folder/short_name/MyProject
Another reason could be duplicated resources or name spaces
Example:
<style name="MyButton" parent="android:Widget.Button">
<item name="android:textColor">#color/accent_color</item>
<item name="android:textColor">#000000</item>
</style>
In my case this error was caused by empty layout xml file.
I created the empty file but forgot to add any content to it. AndroidStudio gave this misleading error message, but when I executed the gradle build from command line I could see the real error like "Error parsing XML: no element found" and the file name.
Adding basic layout xml content fixed the error.
look the compileSdkVersion at android/biuld.gradle ,and compileSdkVersion in all other packages
should be the same.
just for the record. I followed all clean/rebuild and update SDK-Tools here, but in the end it turned out disable Instant Run, to solve my issue.
Go to: Android Studio -> Preferences -> Build,ExecutionDeployment -> Instant Run
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.