finished with non zero exit value - android

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

Related

Deprecated Gradle features were used in this build after setting target api to 31 [duplicate]

I've got a gradle FAILURE:
..."Deprecated Gradle features were used in this build, making it incompatible with Gradle 5.0."
Case description:
Attached to the project codebase the next libs:
APP/build.gradle
//(Required) Writing and executing Unit Tests on the JUnit Platform
testImplementation "org.junit.jupiter:junit-jupiter-api:5.2.0"
testRuntimeOnly "org.junit.jupiter:junit-jupiter-engine:5.2.0"
// (Optional) If you need "Parameterized Tests"
testImplementation "org.junit.jupiter:junit-jupiter-params:5.2.0"
// (Optional) If you also have JUnit 4-based tests
testImplementation "junit:junit:4.12"
testRuntimeOnly "org.junit.vintage:junit-vintage-engine:5.2.0"
testImplementation "io.mockk:mockk:1.8.5"
Updated the gradle-wrapper.properties
distributionUrl=https....gradle-4.4-all.zip to 4.7-all
after all of that gradle was built success
created the test calss
#TestInstance(TestInstance.Lifecycle.PER_CLASS)
class TestClass {
#Test
internal fun testName() {
Assert.assertEquals(2, 1 + 1)
}
}
ran the test and got the FAILURE message.
ran the Gradle build with a command line argument ./gradlew --warning-mode=all to see what exactly the deprecated features are.
As a result I couldn't build the app and I've got that FAILURE: message.
Run the Gradle build with a command line argument --warning-mode=all to see what exactly the deprecated features are.
It will give you a detailed description of found issues with links to the Gradle docs for instructions how to fix your build.
Adding --stacktrace to that, you will also be able to pinpoint where the warning comes from, if it's triggered by outdated code in one of the plugins and not your build script.
Try this one
cd android && ./gradlew clean && ./gradlew :app:bundleRelease
The process below worked in my case-
First check Gradle Version:
cd android
./gradlew -v
In my case it was 6.5
Go to https://developer.android.com/studio/releases/gradle-plugin and you'll get the plugin version for your gradle version. For gradle version 6.5, the plugin version is 4.1.0
Then go to app/build.gradle and change classpath 'com.android.tools.build:gradle:<plugin_version>
My project was incompatible with Gradle 8.0 .Here's what worked for me:
First I wrote this line of code in the Android Studio terminal:
./gradlew build --warning-mode all
When you do that, you will be shown in the logcat what is found to be deprecated or an issue in your project, for me it was the jcenter() repository that needed to be removed in my settings.gradle file and also I needed to update classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:1.5.21" to classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:1.5.30" in my build.gradle project file.
Once I did these things, my project built perfectly and installed on my emulator
I was getting this error. Turns out it only happened when I completely cleaned the RN caches (quite elaborate process) and then created a release build.
If I cleaned the caches, created a debug build and then a release build, everything worked. Bit worrying but works.
Note: My clean command is...
rm -r android/build ; rm -r android/app/src/release/res ; rm -r android/app/build/intermediates ; watchman watch-del-all ; rm -rf $TMPDIR/react-* ; npm start -- --reset-cache
Important - Answer work only for REACT-NATIVE VS CODE Terminal
In VisualStudio code, you have to run like below then that warning will be omitted.
react-native run-android warning-mode=all
If you run below then you will get the error in terminal
When running react-native run-android --warning-mode all I get error: unknown option --warning-mode'
in my case i updated the build.gradle file and make the classpath to latest version from 3.5.2 to 3.6.3
dependencies {
classpath("com.android.tools.build:gradle:3.6.3")
}
In my case adding multiDexEnabled true in Android/app/build.gradle file compiled the files.
I will look into removing this in the future, as in the documentation it says 'Before configuring your app to enable use of 64K or more method references, you should take steps to reduce the total number of references called by your app code, including methods defined by your app code or included libraries.'
defaultConfig {
applicationId "com.peoplesenergyapp"
minSdkVersion rootProject.ext.minSdkVersion
targetSdkVersion rootProject.ext.targetSdkVersion
versionCode 1
versionName "1.0"
multiDexEnabled true // <-add this
}
The following solution helped me as I was also getting the same warning.
In your project level gradle file, try to change the gradle version in classpath
classpath "com.android.tools.build:gradle:3.6.0" to
classpath "com.android.tools.build:gradle:4.0.1"
Update your third party dependencies. for example I updated dependency from
implementation 'com.github.ybq:Android-SpinKit:1.1.0' to implementation 'com.github.ybq:Android-SpinKit:1.2.0'. and in my case issue has been solved.
It work for me in this issue in a project of react-native:
Deprecated Gradle features were used in this build, making it incompatible with Gradle 7.0.
244 actionable tasks: 2 executed, 242 up-to-date
D8: Cannot fit requested classes in a single dex file (# fields: 67296 > 65536)
com.android.builder.dexing.DexArchiveMergerException: Error while merging dex archives:
The number of method references in a .dex file cannot exceed 64K.
Learn how to resolve this issue at https://developer.android.com/tools/building/multidex.html
....
I Did this:
Uninstall the app from my device:
The number of method references in a .dex file cannot exceed 64k API 17
Set distributionUrl path in gradle-wrapper-properties files as :
distributionUrl=https://services.gradle.org/distributions/gradle-4.10.2-all.zip
Solution for the issue:
deprecated gradle features were used in this build making it incompatible with gradle 6.0. android studio
This provided solution worked for me.
First change the classpath in dependencies of build.gradle of your project
From: classpath 'com.android.tools.build:gradle:3.3.1'
To: classpath 'com.android.tools.build:gradle:3.6.1'
Then make changes in the gradle-wrapper.properties file this file exists in the Project's gradle>wrapper folder
From: distributionUrl=https\://services.gradle.org/distributions/gradle-5.4.1-all.zip
To: distributionUrl=https\://services.gradle.org/distributions/gradle-5.6.4-all.zip
Then Sync your gradle.
Uninstall the old app from the device/emulator. It worked for me
i'am using react-native and this works for me :
in root of project cd android and gradlew clean
open task manager in windows
on tab 'Details' hit endtask on both java.exe proccess
long story short
> Task :app:installDebug FAILED Fixed by kiling java.exe prossess
Solved this issue by deleting the .gradle folder from /android and again run npm run android, and it solved this error.
Here's a link to the issue: https://github.com/facebook/react-native/issues/28954
I am using react-native if all above didn't work delete Build and .gridle folder inside the Android folder and run again, That solved my problem
Go to gradle/wrapper/gradle-wrapper.properties change the distributionUrl=https\://services.gradle.org/distributions/gradle-7.4.2-bin.zip to the release that is needed (or higher).
Then run again cd android && ./gradlew bundleRelease
Finally decided to downgrade the junit 5 to junit 4 and rebuild the testing environment.
On a SpringBoot project using IntelliJ and Gradle, I got the warning "Deprecated Gradle features were used in this build, making it incompatible with Gradle 5.0" when running my integration test.
What solved the problem was:
- Going to: File > Settings > Build, Execution, Deployment
- Selecting for "Build and run using": Intellij IDEA (instead of "Gradle")
- Same for "Run tests using"
That did not explain why Gradle is displaying the warning, but that let me perform the test and progress in my work.
I found my disk space is less than 4 GB and can not get the Gradle lib repo
then show
Deprecated Gradle features were used in this build, making it incompatible with Gradle 7.0.
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.
just remove tmp and junk files, free up space then try build and resolve problem
In my case deleting the whole android folder from the base directory and allowing it to rebuild all of it on eas build fixed this error for me :)
1)cd android
2) ./gradlew clean
3)./gradlew :app:bundleRelease
then last install npm install command
it is due to incompatibility.
please upgrade classpath("com.android.tools.build:gradle:4.0.1") in build.gradle file under android folder.
Check settings.gradle script and remove jcenter() from that it may be causing the issue as it is deprecated.
You're new settings.gradle file should be
pluginManagement {
repositories {
gradlePluginPortal()
google()
mavenCentral()
}
plugins {
id 'com.android.application' version '7.1.0-alpha12'
id 'com.android.library' version '7.1.0-alpha12'
id 'org.jetbrains.kotlin.android' version '1.5.21'
}
}
dependencyResolutionManagement {
repositoriesMode.set(RepositoriesMode.FAIL_ON_PROJECT_REPOS)
repositories {
google()
mavenCentral()
}
}
rootProject.name = "ComposePlayground"
include ':app'
Take note that ComposePlayground is app name.
I Sloved this problem by updating my gradle-wrapper.properties file. You have to change this line distributionUrl=https://services.gradle.org/distributions/gradle-7.3.3-bin.zip to the lates gradle build which can be found at The Gradle Wrapper.
Hope that helps someone out there :)
After none of the above answers worked for me, I managed to solve this issue by upgrading the Gradle plugin to the latest version and using the JDK 11.
Hope this helps someone!
Try this solution worked for me.
If you have another app with the same name (or package name) on the device: Rename the app or delete it from your device.
For me, the problem was that I ran out of space in my device's internal storage. After deleting a few unnecessary apps, it worked fine.
After hours of searching on the web I used this command:
react-native run-android warning-mode=all
on vs code.
And it turns out that the error have nothing to do with deprecated modules or any gradle error, it was just that my device was full of storage.
I hope it will help someone one day.

Deprecated Gradle features were used in this build, making it incompatible with Gradle 6.0. I get error in image fragement [duplicate]

I've got a gradle FAILURE:
..."Deprecated Gradle features were used in this build, making it incompatible with Gradle 5.0."
Case description:
Attached to the project codebase the next libs:
APP/build.gradle
//(Required) Writing and executing Unit Tests on the JUnit Platform
testImplementation "org.junit.jupiter:junit-jupiter-api:5.2.0"
testRuntimeOnly "org.junit.jupiter:junit-jupiter-engine:5.2.0"
// (Optional) If you need "Parameterized Tests"
testImplementation "org.junit.jupiter:junit-jupiter-params:5.2.0"
// (Optional) If you also have JUnit 4-based tests
testImplementation "junit:junit:4.12"
testRuntimeOnly "org.junit.vintage:junit-vintage-engine:5.2.0"
testImplementation "io.mockk:mockk:1.8.5"
Updated the gradle-wrapper.properties
distributionUrl=https....gradle-4.4-all.zip to 4.7-all
after all of that gradle was built success
created the test calss
#TestInstance(TestInstance.Lifecycle.PER_CLASS)
class TestClass {
#Test
internal fun testName() {
Assert.assertEquals(2, 1 + 1)
}
}
ran the test and got the FAILURE message.
ran the Gradle build with a command line argument ./gradlew --warning-mode=all to see what exactly the deprecated features are.
As a result I couldn't build the app and I've got that FAILURE: message.
Run the Gradle build with a command line argument --warning-mode=all to see what exactly the deprecated features are.
It will give you a detailed description of found issues with links to the Gradle docs for instructions how to fix your build.
Adding --stacktrace to that, you will also be able to pinpoint where the warning comes from, if it's triggered by outdated code in one of the plugins and not your build script.
Try this one
cd android && ./gradlew clean && ./gradlew :app:bundleRelease
The process below worked in my case-
First check Gradle Version:
cd android
./gradlew -v
In my case it was 6.5
Go to https://developer.android.com/studio/releases/gradle-plugin and you'll get the plugin version for your gradle version. For gradle version 6.5, the plugin version is 4.1.0
Then go to app/build.gradle and change classpath 'com.android.tools.build:gradle:<plugin_version>
My project was incompatible with Gradle 8.0 .Here's what worked for me:
First I wrote this line of code in the Android Studio terminal:
./gradlew build --warning-mode all
When you do that, you will be shown in the logcat what is found to be deprecated or an issue in your project, for me it was the jcenter() repository that needed to be removed in my settings.gradle file and also I needed to update classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:1.5.21" to classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:1.5.30" in my build.gradle project file.
Once I did these things, my project built perfectly and installed on my emulator
I was getting this error. Turns out it only happened when I completely cleaned the RN caches (quite elaborate process) and then created a release build.
If I cleaned the caches, created a debug build and then a release build, everything worked. Bit worrying but works.
Note: My clean command is...
rm -r android/build ; rm -r android/app/src/release/res ; rm -r android/app/build/intermediates ; watchman watch-del-all ; rm -rf $TMPDIR/react-* ; npm start -- --reset-cache
Important - Answer work only for REACT-NATIVE VS CODE Terminal
In VisualStudio code, you have to run like below then that warning will be omitted.
react-native run-android warning-mode=all
If you run below then you will get the error in terminal
When running react-native run-android --warning-mode all I get error: unknown option --warning-mode'
in my case i updated the build.gradle file and make the classpath to latest version from 3.5.2 to 3.6.3
dependencies {
classpath("com.android.tools.build:gradle:3.6.3")
}
In my case adding multiDexEnabled true in Android/app/build.gradle file compiled the files.
I will look into removing this in the future, as in the documentation it says 'Before configuring your app to enable use of 64K or more method references, you should take steps to reduce the total number of references called by your app code, including methods defined by your app code or included libraries.'
defaultConfig {
applicationId "com.peoplesenergyapp"
minSdkVersion rootProject.ext.minSdkVersion
targetSdkVersion rootProject.ext.targetSdkVersion
versionCode 1
versionName "1.0"
multiDexEnabled true // <-add this
}
The following solution helped me as I was also getting the same warning.
In your project level gradle file, try to change the gradle version in classpath
classpath "com.android.tools.build:gradle:3.6.0" to
classpath "com.android.tools.build:gradle:4.0.1"
Update your third party dependencies. for example I updated dependency from
implementation 'com.github.ybq:Android-SpinKit:1.1.0' to implementation 'com.github.ybq:Android-SpinKit:1.2.0'. and in my case issue has been solved.
It work for me in this issue in a project of react-native:
Deprecated Gradle features were used in this build, making it incompatible with Gradle 7.0.
244 actionable tasks: 2 executed, 242 up-to-date
D8: Cannot fit requested classes in a single dex file (# fields: 67296 > 65536)
com.android.builder.dexing.DexArchiveMergerException: Error while merging dex archives:
The number of method references in a .dex file cannot exceed 64K.
Learn how to resolve this issue at https://developer.android.com/tools/building/multidex.html
....
I Did this:
Uninstall the app from my device:
The number of method references in a .dex file cannot exceed 64k API 17
Set distributionUrl path in gradle-wrapper-properties files as :
distributionUrl=https://services.gradle.org/distributions/gradle-4.10.2-all.zip
Solution for the issue:
deprecated gradle features were used in this build making it incompatible with gradle 6.0. android studio
This provided solution worked for me.
First change the classpath in dependencies of build.gradle of your project
From: classpath 'com.android.tools.build:gradle:3.3.1'
To: classpath 'com.android.tools.build:gradle:3.6.1'
Then make changes in the gradle-wrapper.properties file this file exists in the Project's gradle>wrapper folder
From: distributionUrl=https\://services.gradle.org/distributions/gradle-5.4.1-all.zip
To: distributionUrl=https\://services.gradle.org/distributions/gradle-5.6.4-all.zip
Then Sync your gradle.
Uninstall the old app from the device/emulator. It worked for me
i'am using react-native and this works for me :
in root of project cd android and gradlew clean
open task manager in windows
on tab 'Details' hit endtask on both java.exe proccess
long story short
> Task :app:installDebug FAILED Fixed by kiling java.exe prossess
Solved this issue by deleting the .gradle folder from /android and again run npm run android, and it solved this error.
Here's a link to the issue: https://github.com/facebook/react-native/issues/28954
I am using react-native if all above didn't work delete Build and .gridle folder inside the Android folder and run again, That solved my problem
Go to gradle/wrapper/gradle-wrapper.properties change the distributionUrl=https\://services.gradle.org/distributions/gradle-7.4.2-bin.zip to the release that is needed (or higher).
Then run again cd android && ./gradlew bundleRelease
Finally decided to downgrade the junit 5 to junit 4 and rebuild the testing environment.
On a SpringBoot project using IntelliJ and Gradle, I got the warning "Deprecated Gradle features were used in this build, making it incompatible with Gradle 5.0" when running my integration test.
What solved the problem was:
- Going to: File > Settings > Build, Execution, Deployment
- Selecting for "Build and run using": Intellij IDEA (instead of "Gradle")
- Same for "Run tests using"
That did not explain why Gradle is displaying the warning, but that let me perform the test and progress in my work.
I found my disk space is less than 4 GB and can not get the Gradle lib repo
then show
Deprecated Gradle features were used in this build, making it incompatible with Gradle 7.0.
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.
just remove tmp and junk files, free up space then try build and resolve problem
In my case deleting the whole android folder from the base directory and allowing it to rebuild all of it on eas build fixed this error for me :)
1)cd android
2) ./gradlew clean
3)./gradlew :app:bundleRelease
then last install npm install command
it is due to incompatibility.
please upgrade classpath("com.android.tools.build:gradle:4.0.1") in build.gradle file under android folder.
Check settings.gradle script and remove jcenter() from that it may be causing the issue as it is deprecated.
You're new settings.gradle file should be
pluginManagement {
repositories {
gradlePluginPortal()
google()
mavenCentral()
}
plugins {
id 'com.android.application' version '7.1.0-alpha12'
id 'com.android.library' version '7.1.0-alpha12'
id 'org.jetbrains.kotlin.android' version '1.5.21'
}
}
dependencyResolutionManagement {
repositoriesMode.set(RepositoriesMode.FAIL_ON_PROJECT_REPOS)
repositories {
google()
mavenCentral()
}
}
rootProject.name = "ComposePlayground"
include ':app'
Take note that ComposePlayground is app name.
I Sloved this problem by updating my gradle-wrapper.properties file. You have to change this line distributionUrl=https://services.gradle.org/distributions/gradle-7.3.3-bin.zip to the lates gradle build which can be found at The Gradle Wrapper.
Hope that helps someone out there :)
After none of the above answers worked for me, I managed to solve this issue by upgrading the Gradle plugin to the latest version and using the JDK 11.
Hope this helps someone!
Try this solution worked for me.
If you have another app with the same name (or package name) on the device: Rename the app or delete it from your device.
For me, the problem was that I ran out of space in my device's internal storage. After deleting a few unnecessary apps, it worked fine.
After hours of searching on the web I used this command:
react-native run-android warning-mode=all
on vs code.
And it turns out that the error have nothing to do with deprecated modules or any gradle error, it was just that my device was full of storage.
I hope it will help someone one day.

Deprecated Gradle features were used in this build, making it incompatible with Gradle 5.0

I've got a gradle FAILURE:
..."Deprecated Gradle features were used in this build, making it incompatible with Gradle 5.0."
Case description:
Attached to the project codebase the next libs:
APP/build.gradle
//(Required) Writing and executing Unit Tests on the JUnit Platform
testImplementation "org.junit.jupiter:junit-jupiter-api:5.2.0"
testRuntimeOnly "org.junit.jupiter:junit-jupiter-engine:5.2.0"
// (Optional) If you need "Parameterized Tests"
testImplementation "org.junit.jupiter:junit-jupiter-params:5.2.0"
// (Optional) If you also have JUnit 4-based tests
testImplementation "junit:junit:4.12"
testRuntimeOnly "org.junit.vintage:junit-vintage-engine:5.2.0"
testImplementation "io.mockk:mockk:1.8.5"
Updated the gradle-wrapper.properties
distributionUrl=https....gradle-4.4-all.zip to 4.7-all
after all of that gradle was built success
created the test calss
#TestInstance(TestInstance.Lifecycle.PER_CLASS)
class TestClass {
#Test
internal fun testName() {
Assert.assertEquals(2, 1 + 1)
}
}
ran the test and got the FAILURE message.
ran the Gradle build with a command line argument ./gradlew --warning-mode=all to see what exactly the deprecated features are.
As a result I couldn't build the app and I've got that FAILURE: message.
Run the Gradle build with a command line argument --warning-mode=all to see what exactly the deprecated features are.
It will give you a detailed description of found issues with links to the Gradle docs for instructions how to fix your build.
Adding --stacktrace to that, you will also be able to pinpoint where the warning comes from, if it's triggered by outdated code in one of the plugins and not your build script.
Try this one
cd android && ./gradlew clean && ./gradlew :app:bundleRelease
The process below worked in my case-
First check Gradle Version:
cd android
./gradlew -v
In my case it was 6.5
Go to https://developer.android.com/studio/releases/gradle-plugin and you'll get the plugin version for your gradle version. For gradle version 6.5, the plugin version is 4.1.0
Then go to app/build.gradle and change classpath 'com.android.tools.build:gradle:<plugin_version>
My project was incompatible with Gradle 8.0 .Here's what worked for me:
First I wrote this line of code in the Android Studio terminal:
./gradlew build --warning-mode all
When you do that, you will be shown in the logcat what is found to be deprecated or an issue in your project, for me it was the jcenter() repository that needed to be removed in my settings.gradle file and also I needed to update classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:1.5.21" to classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:1.5.30" in my build.gradle project file.
Once I did these things, my project built perfectly and installed on my emulator
I was getting this error. Turns out it only happened when I completely cleaned the RN caches (quite elaborate process) and then created a release build.
If I cleaned the caches, created a debug build and then a release build, everything worked. Bit worrying but works.
Note: My clean command is...
rm -r android/build ; rm -r android/app/src/release/res ; rm -r android/app/build/intermediates ; watchman watch-del-all ; rm -rf $TMPDIR/react-* ; npm start -- --reset-cache
Important - Answer work only for REACT-NATIVE VS CODE Terminal
In VisualStudio code, you have to run like below then that warning will be omitted.
react-native run-android warning-mode=all
If you run below then you will get the error in terminal
When running react-native run-android --warning-mode all I get error: unknown option --warning-mode'
in my case i updated the build.gradle file and make the classpath to latest version from 3.5.2 to 3.6.3
dependencies {
classpath("com.android.tools.build:gradle:3.6.3")
}
In my case adding multiDexEnabled true in Android/app/build.gradle file compiled the files.
I will look into removing this in the future, as in the documentation it says 'Before configuring your app to enable use of 64K or more method references, you should take steps to reduce the total number of references called by your app code, including methods defined by your app code or included libraries.'
defaultConfig {
applicationId "com.peoplesenergyapp"
minSdkVersion rootProject.ext.minSdkVersion
targetSdkVersion rootProject.ext.targetSdkVersion
versionCode 1
versionName "1.0"
multiDexEnabled true // <-add this
}
The following solution helped me as I was also getting the same warning.
In your project level gradle file, try to change the gradle version in classpath
classpath "com.android.tools.build:gradle:3.6.0" to
classpath "com.android.tools.build:gradle:4.0.1"
Update your third party dependencies. for example I updated dependency from
implementation 'com.github.ybq:Android-SpinKit:1.1.0' to implementation 'com.github.ybq:Android-SpinKit:1.2.0'. and in my case issue has been solved.
It work for me in this issue in a project of react-native:
Deprecated Gradle features were used in this build, making it incompatible with Gradle 7.0.
244 actionable tasks: 2 executed, 242 up-to-date
D8: Cannot fit requested classes in a single dex file (# fields: 67296 > 65536)
com.android.builder.dexing.DexArchiveMergerException: Error while merging dex archives:
The number of method references in a .dex file cannot exceed 64K.
Learn how to resolve this issue at https://developer.android.com/tools/building/multidex.html
....
I Did this:
Uninstall the app from my device:
The number of method references in a .dex file cannot exceed 64k API 17
Set distributionUrl path in gradle-wrapper-properties files as :
distributionUrl=https://services.gradle.org/distributions/gradle-4.10.2-all.zip
Solution for the issue:
deprecated gradle features were used in this build making it incompatible with gradle 6.0. android studio
This provided solution worked for me.
First change the classpath in dependencies of build.gradle of your project
From: classpath 'com.android.tools.build:gradle:3.3.1'
To: classpath 'com.android.tools.build:gradle:3.6.1'
Then make changes in the gradle-wrapper.properties file this file exists in the Project's gradle>wrapper folder
From: distributionUrl=https\://services.gradle.org/distributions/gradle-5.4.1-all.zip
To: distributionUrl=https\://services.gradle.org/distributions/gradle-5.6.4-all.zip
Then Sync your gradle.
Uninstall the old app from the device/emulator. It worked for me
i'am using react-native and this works for me :
in root of project cd android and gradlew clean
open task manager in windows
on tab 'Details' hit endtask on both java.exe proccess
long story short
> Task :app:installDebug FAILED Fixed by kiling java.exe prossess
Solved this issue by deleting the .gradle folder from /android and again run npm run android, and it solved this error.
Here's a link to the issue: https://github.com/facebook/react-native/issues/28954
I am using react-native if all above didn't work delete Build and .gridle folder inside the Android folder and run again, That solved my problem
Go to gradle/wrapper/gradle-wrapper.properties change the distributionUrl=https\://services.gradle.org/distributions/gradle-7.4.2-bin.zip to the release that is needed (or higher).
Then run again cd android && ./gradlew bundleRelease
Finally decided to downgrade the junit 5 to junit 4 and rebuild the testing environment.
On a SpringBoot project using IntelliJ and Gradle, I got the warning "Deprecated Gradle features were used in this build, making it incompatible with Gradle 5.0" when running my integration test.
What solved the problem was:
- Going to: File > Settings > Build, Execution, Deployment
- Selecting for "Build and run using": Intellij IDEA (instead of "Gradle")
- Same for "Run tests using"
That did not explain why Gradle is displaying the warning, but that let me perform the test and progress in my work.
I found my disk space is less than 4 GB and can not get the Gradle lib repo
then show
Deprecated Gradle features were used in this build, making it incompatible with Gradle 7.0.
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.
just remove tmp and junk files, free up space then try build and resolve problem
In my case deleting the whole android folder from the base directory and allowing it to rebuild all of it on eas build fixed this error for me :)
1)cd android
2) ./gradlew clean
3)./gradlew :app:bundleRelease
then last install npm install command
it is due to incompatibility.
please upgrade classpath("com.android.tools.build:gradle:4.0.1") in build.gradle file under android folder.
Check settings.gradle script and remove jcenter() from that it may be causing the issue as it is deprecated.
You're new settings.gradle file should be
pluginManagement {
repositories {
gradlePluginPortal()
google()
mavenCentral()
}
plugins {
id 'com.android.application' version '7.1.0-alpha12'
id 'com.android.library' version '7.1.0-alpha12'
id 'org.jetbrains.kotlin.android' version '1.5.21'
}
}
dependencyResolutionManagement {
repositoriesMode.set(RepositoriesMode.FAIL_ON_PROJECT_REPOS)
repositories {
google()
mavenCentral()
}
}
rootProject.name = "ComposePlayground"
include ':app'
Take note that ComposePlayground is app name.
I Sloved this problem by updating my gradle-wrapper.properties file. You have to change this line distributionUrl=https://services.gradle.org/distributions/gradle-7.3.3-bin.zip to the lates gradle build which can be found at The Gradle Wrapper.
Hope that helps someone out there :)
After none of the above answers worked for me, I managed to solve this issue by upgrading the Gradle plugin to the latest version and using the JDK 11.
Hope this helps someone!
Try this solution worked for me.
If you have another app with the same name (or package name) on the device: Rename the app or delete it from your device.
For me, the problem was that I ran out of space in my device's internal storage. After deleting a few unnecessary apps, it worked fine.
After hours of searching on the web I used this command:
react-native run-android warning-mode=all
on vs code.
And it turns out that the error have nothing to do with deprecated modules or any gradle error, it was just that my device was full of storage.
I hope it will help someone one day.

Error are come \build-tools\23.0.3\aapt.exe'' finished with non-zero exit value 1 [duplicate]

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

Android Studio can't find library classes after Gradle build

I'm trying to add a .jar library to my project into the /libs folder. Here is my grade.build:
buildscript {
repositories {
mavenCentral()
}
dependencies {
classpath 'com.android.tools.build:gradle:0.4'
}
}
apply plugin: 'android'
dependencies {
compile files('libs/android-support-v4.jar', 'libs/java-api-wrapper-1.2.0-all.jar')
}
android {
compileSdkVersion 17
buildToolsVersion "17.0.0"
defaultConfig {
minSdkVersion 15
targetSdkVersion 16
}
}
After I add that, I build my project and there are no errors. But when I try to use the class in my code private ApiWrapper wrapper, I get an error:
Gradle: error: cannot find symbol class ApiWrapper
I can't quite find where the error is. Is my grade.build not ok, or am I supposed to build it some other way?
Using the command line, in the root of your project, run :
./gradlew clean && ./gradlew build
Then recompile your project in studio and you should see your new lib.
Set minifyEnabled to false for all your library projects in build.gradle.
See accepted answer by Scott Barta in this thread.
See accepted answer by Scott Barta in this thread
Goto File ⇒ Invalidate Caches & Restart
Solved my problem
As first option, i think will be enough Syncronizing the Project with Gradle Files.
Another option, from the command line, run the batch file gradlew.bat located inside your project folder:
./gradlew clean && ./gradlew build
I had a similar situation where Android Studio couldn't find a library that definitely existed. Even though I was able to compile my project in Android Studio, run it from Android Studio in the emulator or on a physical device, and build it from the command line using gradlew, the Android Studio IDE complained Cannot resolve symbol 'ConstraintLayout'. I believe I had imported the library correctly because I followed Google's instructions: https://developer.android.com/training/constraint-layout/#add-constraintlayout-to-your-project.
Anyway, I ended up solving the problem as follows:
Close Android Studio
Delete the .idea folder in the project's directory
Open Android Studio
Re-import the project so Android Studio can regenerate the .idea folder
This in-fact solved the problem. I believe Android Studio somehow corrupted the .idea folder when I had done "Android Studio" > "Check for Updates" earlier in the day.
Go to the Android studio File and press Invalidate Caches/Restart. This worked for me to find the library

Categories

Resources