gradle fails with Problems reading data from Binary store error - android

I have a Gradle file that runs the tests. It does not build anything. All it has is a unzip task that extracts all jars in a Gradle configuration into a particular directory and then runs the task of type Test. This test task points the testClasses directory to the location where the previous copy task has extracted the configuration into.
My build fails with the error message:
Problems reading data from Binary store
When I run 'gradle dependencies' it does not show any error/warning
When I run the copy task individually, it runs very well fine.
Only when I run everything it fails with error :
> Could not resolve all dependencies for configuration ':testConfig'.$
> Problems reading data from Binary store in /tmp/gradle8793563212642185736.bin (exist: false)$
I see the file /tmp/gradle8793563212642185736.bin does not exist. What could be the reason for this?

I solved upgrading following packages to last version (06/02/2021), so:
project app-level build.gradle file:
com.google.firebase:firebase-analytics:17.2.2
to
com.google.firebase:firebase-analytics:18.0.2
Project-level build.gradle file:
com.google.gms:google-services:4.3.3
to
com.google.gms:google-services:4.3.5

In my case setting org.gradle.parallel=false flag fixes the issue, but it's not a solution for my project, flag increase CI build time from ~15min to ~45min.

Turns out it was just a network problem for me. Gradle just needed to connect to the internet.

It happened with Flutter development in my case. Apparently, it is not an actual issue and there is no magic fix. Cleaning build file with "Flutter clean" and restarting the command line executer window solved the issue.

I was working with version 5.x earlier and then I upgraded to 6.0.1 and it resolved the issue.
this is how you can upgrade
cd android
./gradlew clean
./gradlew wrapper --gradle-version 6.0.1
./gradlew -v # to download the new version
cd ..
flutter clean
flutter run # might take 15 - 20mins for the first time

There are mainly a few steps to solve this problem.
Go to gradle.properties and set org.gradle.parallel=false and sync. Make sure your sync gradle offline option is off
Start the build with this option. If it's a big project setting org.gradle.parallel=false will take a long time.
Cancel the build repeat the steps setting org.gradle.parallel=true.
Also do not turn on offline build

This solution worked in my flutter project. I solved it by making these changes:
In android level build.gradle file, replace classpath 'com.android.tools.build:gradle:3.5.4' with classpath 'com.android.tools.build:gradle:4.0.1' (basically upgrade the version from 3.5.4 to 4.0.1)
In gradle-wrapper.properties file, replace distributionUrl=https\://services.gradle.org/distributions/gradle-5.6.2-all.zip with distributionUrl=https\://services.gradle.org/distributions/gradle-6.1.1-all.zip (upgrade from 5.6.2 to 6.1.1)
and if you have added classpath 'com.google.gms:google-services:4.3.3' to android level build.gradle file, replace that too with classpath 'com.google.gms:google-services:4.3.5' (upgrade from 4.3.3 to 4.3.5)

In my case the writing problem was there was no enough storage to build the app so I needed to restart my Mac and it finished building successfully.
I know am too late but it might help someone in the future so

Start by upgrading Gradle to the latest version.
Binary store issues reported to GitHub are often fixed right away, especially if they include a Minimal, Reproducible Example.
If upgrading didn't work, it can be useful to run the task again with Performance options disabled:
--no-parallel
--no-configure-on-demand
Next please find an existing issue or open a new one so it can be fixed in future versions. These things are all helpful:
Minimal, Reproducible Example
Build Scan
Smallest change that introduced the problem (e.g. worked on 5.5, but not 5.6)

I ended up here after publishing an artifact to mavenLocal().
I tried a lot but in the end what helped me was:
Upgrading gradle from 6.3 to 6.9
./gradlew wrapper --gradle-version 6.9
Hope this saves me half an hour next time this occurs.

Thanks to Cedric's hint, stopping gradle offline mode and make it online, fixed the issue for me

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.

Error "Minimum supported Gradle version is 5.1.1. Current version is 4.4.1" after update android studio

I updated android studio from 3.3 to 3.4 version and after install and do ./gradlew lint I am getting the next error:
Deprecated Gradle features were used in this build, making it
incompatible with Gradle 6.0.
Then I use the next command to get more details:
./gradlwe build --warning-mode=all
And I get the next message:
Failed to apply plugin [id 'com.android.application']
Minimum supported Gradle version is 5.1.1. Current version is 4.4.1. If using the gradle wrapper, try editing the distributionUrl in .gradle/daemon/4.4.1/gradle/wrapper/gradle-wrapper.properties
to gradle-5.1.1-all.zip
And when I edited my gradle-wrapper.properties, I see that the changes were already done, I.E. the version of the distributionUrl already was gradle-5.1.1.-all.zip
Any idea that how can resolve this?
You could just edit YOUR_APPLICATION_FOLDER/gradle/wrapper/gradle-wrapper.properties and change the last line to:
distributionUrl=https\://services.gradle.org/distributions/gradle-5.1.1-all.zip
Android Studio will download necessary library.
This was my solution.
My_project
/gradle
/wrapper
/gradle-wrapper.properties
Modify this line with the Gradle 5.1.1
distributionUrl=https\://services.gradle.org/distributions/gradle-5.1.1-all.zip
Finally, I was able to solve this dropping the folders of the oldest version in ~/.gradle/wrapper/dists and leave only the gradle-5.1.1-all
In my case, gradle failed to download the version I specified though I tried all previous solutions.
Apparently, I was opening my project by selecting "MyProject/App" directory. Gradle successfully updated when I opened the same project by selecting the "MyProject" folder.
Check your full project and find all "Gradle-wrapper.properties" files. If your project has multiple modules then there are chances of having multiple. and set -
distributionUrl=https://services.gradle.org/distributions/gradle-5.1.1-all.zip
Gradle sync
If not done then invalidate the cache and restart the project.
Still not working then go to your root directory on Linux and find .gradle folder. Delete it and restart the android studio.
If you use Ubuntu and all above answers didn't solve your problem try to upgrade gradle on your Ubuntu with this commands from this answer https://askubuntu.com/a/975018/714791
sudo add-apt-repository ppa:cwchien/gradle
sudo apt-get update
sudo apt upgrade gradle
It will help I hope
I resolved by two below steps.
delete gradle folder
check your classpath 'com.android.tools.build:gradle:{$gradleVersion}
My gradleVersion is 3.5.3.
I solved this by changing the distributionUrl in gradle-wrapper.properties in gradle/wrapper, not gradle.properties
Maybe it's your gradle environment variable.
execute 'gradle -v'
Check that the gradle version of the project matches the gradle environment variable version
those who are still facing issue with Cordova/Ionic, this is due to CORDOVA_ANDROID_GRADLE_DISTRIBUTION_URL which is being checked at platforms/android/cordova/lib/builders/GradleBuilder.js
set CORDOVA_ANDROID_GRADLE_DISTRIBUTION_URL to desired distributional
for MacOs
export CORDOVA_ANDROID_GRADLE_DISTRIBUTION_URL = https\://services.gradle.org/distributions/gradle-5.4.1-all.zip
I think it's very important to mention which IDE you're using and what are the configurations.
What made me upset was, I had a setting in gradle-wrapper.properties file which was "ignored" to my mind.
I've found the settings in the IDEA application settings, there:
and then selecting:
and everything works as expected.
Deleting 'all other' locally cached versions can never be the right solution ;)
Good luck!
My app is using Cordova v9.0.0
distributionUrl is set at platforms\android\cordova\lib\builders\ProjectBuilder.js
You can set distributionUrl from the command line with
set CORDOVA_ANDROID_GRADLE_DISTRIBUTION_URL="https://services.gradle.org/distributions/gradle-[version]-all.zip"
Replace [version] with your preference
it solved for me
get the flutter SDK directory
this is my flutter Sdk
C:\flutter\.pub-cache\hosted\pub.dartlang.org\connectivity_macos-0.1.0+2\android\gradle\wrapper
change gradle-wrapper.properties
Modify this line with the Gradle 5.1.1
distributionUrl=https\://services.gradle.org/distributions/gradle-5.1.1-all.zip
I had the same error: Error "Minimum supported Gradle version is 6.1.1. Current version is 5.1.1" but when I opened the gradle.properties and I found this "distributionUrl=https://services.gradle.org/distributions/gradle-6.1.1-all.zip" which was correct but wasn't working. To solve this, I deleted the ".gradle" file in the explorer, reopened the app and found out the distributionUrl had change to 5.2.2-all.zip in gradle.properties; I then edited to 6.1.1-all.zip and sync and everything worked like a charm. I hope this can help someone else.
Try to download manually Gradle-5.1.1 from https://gradle.org/releases then go to file/project structure/project and put the new version in gradle version. (You can also use this link - jenv.io/candidate/gradle)
I was having the same problem after migrating from android.support library to androidx where junit library start with androidTestImplementation and not
testImplementation.
So i changed
testImplementation "junit:junit:$rootProject.junitVersion"
to
androidTestImplementation androidx.test.ext:junit:1.0.0-beta01
or
androidTestImplementation "junit:junit:$rootProject.junitVersion"
Remember to append android before testImplementation
also, try removing all older/unwanted versions of gradle using:
cd usr/local/Cellar/gradle/
Don't forget to run the gradle wrapper in your project: https://docs.gradle.org/6.4.1/userguide/gradle_wrapper.html#sec:adding_wrapper
Delete gradle folder from your project directory as well as from the app directory.
restart Adroid studio and resync gradle.
it will solve your problem. If not you might be opened the project yourproject/app. close Android studio and import your project after selecting yourproject. Then resync gradle. This will solve your problem.
For Windows 10:
Go to C:\Users\<user-name>\.gradle\wrapper\dists and delete everything there. Android studio will download the appropriate version afterwards.
If anyone is still searching for a solution after trying literally everything, here's what worked for me.
In the .gitlab-ci.yml file, my image: key was outdated and was writing in the script that Gradle was set to 5.1.1 even though everything in my Android Studio was 7.0.2. After talking to the guy who wrote the image script, I just had to increment the version of that.
https://forum.gitlab.com/t/set-specific-version-of-gradle-for-ci-build/41716/4
This error was solved by restarting Android Studio.

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.

Android Studio build fails with "Task '' not found in root project 'MyProject'."

I get this error when trying to build my project after changing laptop and updating to Android Studio version 0.8.2.
FAILURE: Build failed with an exception.
What went wrong:
Task '' not found in root project 'MyProject'.
Try:
Run gradle tasks to get a list of available tasks. Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output.
BUILD FAILED
Here are my Gradle files:
Top Level settings.gradle
include ':MyProject'
build.gradle in MyProject:
apply plugin: 'com.android.application'
buildscript {
repositories {
mavenCentral()
}
dependencies {
classpath "com.android.tools.build:gradle:0.12.+"
}
}
repositories {
mavenCentral()
}
android {
compileSdkVersion 20
buildToolsVersion "20"
defaultConfig {
minSdkVersion 14
targetSdkVersion 20
}
}
dependencies {
compile 'de.timroes.android:EnhancedListView:0.3.0#aar'
compile 'com.nineoldandroids:library:2.4.0'
}
Top level build.gradle is empty
Though late in answering, this is a hard one to Google (the single quotes) and it’s not clear what’s happening. I don't have the reputation yet to comment or ask for scope (or post 3 links), so this answer may be a little tedious.
To answer fast, you may have multiple Gradle plugins in your project.
Synchronize Gradle Wrapper and Plugins
My issue seemed to start with a corrupted IML file. Android Studio (between closing and reopening a project) began complaining an IML was gone (it wasn’t) and a module should be deleted, which I declined. It persisted, I upgraded to AS 0.8.7 (canary channel) and got stuck on the OP issue (Task '' not found in root project). This completely blocked builds so I had to dig in to Gradle.
My repair steps on OSX (please adjust for Windows):
Upgrade Android Studio to 0.8.7
Preferences | Updates | Switch "Beta Channel" to "Canary Channel", then do a Check Now.
You might be able to skip this.
Checked the Gradle wrapper (currently 1.12.2; don’t try to use 2.0 at this time).
Assuming you don’t need a particular version, use the latest supported distribution
$ vi ~/project/gradle-wrapper.properties ... distributionUrl=http\://services.gradle.org/distributions/gradle-1.12-all.zip
This can be set in Android Studio at Preferences | Gradle (but 0.8.7 was giving me ‘invalid location’ errors).
The 'wrapper' is just a copy of Gradle for each Android Studio project. It allows you to have Gradle 2 in your OS, and different versions in your projects. The Android Developer docs explain that here.
Then adjust your build.gradle files for the plugin. The Gradle plugin version must be compatible with the distribution/wrapper version, for the whole project. As the Tools documentation (tools.android.com/tech-docs/new-build-system/user-guide#TOC-Requirements) is slightly out of date, you can set the plugin version too low (like 0.8.0) and Android Studio will throw an error with the acceptable range for the wrapper.
Example, in build.gradle, you have this plugin:
dependencies {
classpath "com.android.tools.build:gradle:0.12.+"
}
You can try switching it to the exact version, like this:
dependencies {
classpath "com.android.tools.build:gradle:0.12.2"
}
and (after recording what version you’re changing from in each case) verifying that every build.gradle file in your project pulls in the same plugin version. Keeping the “+” should work (for 0.12.0, 0.12.1, 0.12.2, etc), but my build succeeded when I updated Google’s Volley library (originally gradle:0.8.+) and my main project (originally 0.12.+) to the fixed version: gradle:0.12.2.
Other checks
Ensure you don’t have two Android Application modules in the same Project
This may interact with the final solution (different Gradle versions, above), and cause
UNEXPECTED TOP-LEVEL EXCEPTION: com.android.dex.DexException: Multiple dex files define (various classes)
To check, Build | Make Project should not pop up a window asking what application you want to make.
Invalidate your caches
File | Invalidate Caches / Restart (stackoverflow.com/a/19223269/513413)
If step 2 doesn't work, delete ~/.gradle/ (www.wuttech.com/index.php/tag/groovy-lang-closure/)
Quit Android Studio
$ rm -rf ~/.gradle/
Start Android Studio, then sync:
Tools | Android | Sync Project with Gradle Files
Repeat this entire sequence (quit...sync) a few times before giving up.
Clean the project
Build | Clean Project
Project structure mismatch; see https://stackoverflow.com/a/64962359/8740349 for details.
If You See This...
In my recent builds, I kept seeing horrible fails (pages of exceptions) but within seconds the messages would clear, build succeeded and the app deployed. Since I could never explain it and the app worked, I never noticed that I had two Gradle plugins in my project. So I think the Gradle plugins fought each other; one crashed, the other lost its state and reported the error.
If you have time, the 1-hour video "A Gentle Introduction to Gradle" (www.youtube.com/watch?v=OFUEb7pLLXw) really helped me approach the Gradle build files, tasks, build decisions, etc.
Disclaimer
I'm learning this entire stack, on a foreign OS, after working a different career...all at the same time and under pressure. In the last few months I have hit every wall I think Android has; I've been here quite often and this is my first post. I thought this was a hard fix, so I sincerely apologize if the quality of my answer reflects the difficulty I had in getting to it.
Download system image(of targeted android level of your project) from sdk manager for the project you have imported.
This error comes when you do not have target sdk of your android project installed in sdk folder
for eg. Your imported project's target sdk level may be android-19 and on sdk folder->system-images you may have android-21 installed. so you have to download android-19 system image and other files from sdk manager or you can copy paste it if you have the system image.
Remove:
<facet type="android" name="Android">
<configuration />
</facet>
in your iml file. That works for me.
https://plus.google.com/+AlexRuiz/posts/49hP3V9GSGe
This happened to me recently when I close one Android Studio project and imported another Eclipse project. It seemed to be some bug in Android Studio where it preserves some gradle settings from previously open project and then get confused in the new project.
The solution was extremely simple: Close the project and shut down Android Studio completely, before re-opening it and then import/open the new project. Everything goes smoothly from then on.
Apparently this error has multiple causes. Here's what fixed it for me.
I was running the build command like this:
./gradlew :testapp: build
Running it without the space fixed the issue:
./gradlew :testapp:build
I got this error when switching from one Git branch to another, and then trying to run "Clean Project". I used ack to search for the Task name, and found it in a .iml file.
My solution was to regenerate the project's .iml file by clicking (in the main menu) Tools > Android > Sync Project with Gradle Files. (Thanks to this answer.)
In my case, setting the 'Gradle version' same as the 'Android Plugin version' under File->Project Structure->Project fixed the issue for me.
Simple fix for me was
Build > Clean project
Restart Android Studio
Yet another solution to the same problem:
This happened to me every time I imported an eclipse project into studio using the wizard (studio version 1.3.2).
What I found, quite by chance, was that quitting out of Android studio and then restarting studio again made the problem go away.
Frustrating, but hope this helps someone...
Sometimes, if you have opened two windows of Android Studio, and when you try to compile, this issue might happen. For me, when I was compiling a backed Google Cloud Endpoint module which was not embedded in a project, rather shared among different Android Studio projects, and when there is more than once instance open, this error use to spring up for me. But as soon as you close other windows, everything will be fine. Sometimes, you might have to restart Android Studio altogether.
I got this problem because it could not find the Android SDK path. I was missing a local.properties file with it or an ANDROID_HOME environment variable with it.
Make sure you have the latest values in your gradle files. As of this writing:
buildToolsVersion "21.1.2"
dependencies {
classpath 'com.android.tools.build:gradle:1.1.0'
}
Open Command Prompt
then go your project folder thru Command prompt
Type gradlew build and run
Apparently this issue caused by Android Studio on the various situation but the reason is build error When importing an existing project into android studio. In my case, I've imported my exist project where I was supposed to install few build tools then finally build configuration was done with error. In this case, just do the following things
Close the current project
File>New>Import Project (Don't use the open recent project)
Note:
I'm sure this kind of error is not on source code when this happened on Import project.
Problem
I specifically got the "[module_name]:prepareDebugUnitTestDependencies" task not found error, every time I ran gradle build. This happened to me after updating my Android Studio to 3.0.0.
Investigation
I had previously added command-line options to the gradle-based compiler, which you can find under: File -> Settings -> Build, Execution, Deployment -> Compiler -> Command-line Options. Specifically, I had excluded a number of tasks, including the aforementioned task. While that worked fine on the previous stable version (2.3 at that time), it seems like this was the reason behind the build failure.
Solution
This is one of many possible solutions.
Make sure you have the correct command-line options specified in the settings under: File -> Settings -> Build, Execution, Deployment -> Compiler -> Command-line Options, and that none of them is causing this problem.
In my case, I removed the exclusion of this task (and other tasks that seemed related), left the unrelated tasks excluded, and it worked!
I had the same problem and the "Tasks" tab doesn't appear to me on the Gradle settings, neither doing the commands gradlew signinReport or something.
I fix it doing the following steps:
1.- Add android: exported = "true" in my main activity of the AndroidManifest (because that Activity has an intent-filter)
2.- Update in Build.gradle (app) the compileSdkVersion to 31
3.- Update in the same place the targetSdkVersion also to 31.
4.- Click on "Sync now".
And that works for me.
Farewell!
For this you may simply just goto: SETTINGS > EXPERIMENTAL > Then uncheck the option:
"Do not build Gradle Task List during Gradle sync", Click on "Apply" > "Ok" and then click on the "Sync Project with Gradle files" option from the right side of the menu bar.
Your issue should be resolved.
Set the path of the root folder and after run the below command
ex : cd C:\Users\maha\Documents\gradle\gs-gradle-master\initial
This is what I did
Remove .idea folder
$ mv .idea .idea.bak
Import the project again
I remove/Rename .gradle folder in c:\users\Myuser\.gradle and restart Android Studio and worked for me
In my case, I meet this problem that compile options in Android Studio is "stacktrace." Modify stacktrace to --stacktrace, the problem solved.
I have solved this problem You just need to Create file in Android Folder
Go android folder
Create file local.properties
then just add this code in local.properties file:-
If you are using MacBook then sdk.dir=/Users/USERNAME/Library/android/sdk
if you are using Windows then sdk.dir=C:\Users\USERNAME\AppData\Local\Android\sdk
if you are using Linux then sdk.dir = /home/USERNAME/Android/sdk
if you want to know what is your system USERNAME then just use command for Mac whoami
and then just rerun command react-native run-android
Thanks :)
Am on Mac so answer is as per like that.
Go to Android Studio(From Menu Bar) -> Preferences -> Build, Execution, Deployment -> Compiler . Then look for Command-Line Options , there make sure nothing typed in its Text Field. That should be empty. Then rebulid project and thats it.

Categories

Resources