Reduce Gradle from 3.3 to 2.14.1

In short: My Android phone continues to disconnect from ADB. I was told to update android studio, did it. I open my project in Intellij and try to run on android, and I get an error message:

BUILD FAILED Total time: 48.986 secs Error: /Users/me/Desktop/comp/Development/comp-ionic/platforms/android/gradlew: Command failed with exit code 1 Error output: FAILURE: Build failed with an exception. * What went wrong: Execution failed for task ':compileDebugJavaWithJavac'. > java.lang.NullPointerException (no error message) 

My first thought is that my gradle is the wrong version. For this particular application, I need to use gradle version 2.14.1 .

When I type gradle -v , I get version 3.3.

Is there a way to remove / downgrade gradle from 3.3 to 2.14.1?

Or is this another problem?

+12
source share
5 answers

If you use a gradle wrapper, then in your project called "gradle" there will be a folder with a subfolder named "wrapper", inside which there are 2 files:
- gradle -wrapper.jar
- gradle -wrapper.properties

Open "gradle -wrapper.properties" and change the location where "3.3" to "2.14.1" is indicated. Then sync the gradle and it will automatically download 2.14.1.

If you are using the new 2.3 Android Studio, you need to use gradle wrapper 3.3 as the minimum supported version of the gradle shell. If so, then you have to download Android Studio 2.2 or fix any problem in your project that needs gradle version 2.14.1 gradle.

To learn more about the problems, try the following:. / gradlew clean assemble -stacktrace

This will clear your project, try to compile it, and if / when it fails, it will show you a stack error.

+14
source

What you have to do is change the version of gradle build tools to the version that matches your version of gradle. According to here, you can set gradle to 2.14.1 by changing the build tools below 1.0.0 .

 buildscript { repositories { jcenter() } dependencies { classpath 'com.android.tools.build:gradle:1.0.0'// For gradle 2.2.1 - 2.3 // NOTE: Do not place your application dependencies here; they belong // in the individual module build.gradle files } } 

Please note: if you continue to check the specified link, you will see Higher is better for gradle.

+2
source

I have the same problem when upgrading to Android Studio 2.3.1. There is something funky about Gradle 3.3 (This fails with "java.lang.NullPointerException: null value in entry: destinationDir = null on com.google.common.collect.CollectPreconditions.checkEntryNotNull (CollectPreconditions.java:33)") .
The good news is that the latest version (3.5) seems to be working.

Go to File | Project Structure | Project and use the following versions:
Gradle version = 3.5
Android Plugin Version = 2.3.1

0
source

I upgrade the version of Android Studio to 3.3 Canary 4, then I update the gradle plugin and the project stops working.

I do not know how to restore my AS to its previous state, not the Gradle plugin.

But only with this command the project now works, for me: gradlew clean assemble -stacktrace , on the terminal tab in AS.

0
source

For me, Android Studio > File > Invalidate Caches/Restart did the trick.

0
source

Source: https://habr.com/ru/post/1014653/


All Articles