I used sdk to install gradle and I run into this error … heres my build.gradle
// Top-level build file where you can add configuration options common to all sub-projects/modules.
buildscript {
repositories {
jcenter()
}
dependencies {
classpath ‘com.android.tools.build:gradle:3.3.0’
}
}
allprojects {
repositories {
mavenCentral()
}
}
If I try using an older version, I get this error…
Error:java.lang.NullPointerException (no error message)
Try This -
Go To File> Project Structure > Project > And change the gradle version to the one you were using before.
Change build.gradle(Project : app_name) > classpath ‘com.android.tools.build:gradle:3.3.0’ to the one you used in gradle version settings.
Let me Know if it worked.
Take Care.
Dont use 3.3 yet, instead use gradle 2.3 in your Settings(Project Structure > Project).
And also in your build.gradle as I’ve explained in my previous reply. Try it and tell me if it worked…
Thanks after trying many things it worked out. The issue was Android Studio 2,3 and it’s default gradle version is 3.3.
I accidentally updated SDK build tools to latest one 25.0 .0, after Android Studio popped up message to update and Gradle plugin version to 2.3.0 for which required gradle version is 3.3+.
I did the below changes to fix the issue:
Installed older SDK build tools 19.1.0 to use previous Gradle versions
File> Project Structure > Project > And change the gradle version to 2.3.0
Changed build.gradle(Project: app_name) > classpath ‘com.android.tools.build:gradle:3.3.0’ to ‘com.android.tools.build:gradle:2.1.2’
In my case, path_provider package need gradle 3 and I was getting this error.
Could not resolve all artifacts for configuration ':path_provider_android:classpath'
Could not find gradle-3.3.0.jar (com.android.tools.build:gradle:3.3.0)
These changes solved my problem.
1- In android\build.gradle I changed gradle version from 4.1.0 to 3.6.4
classpath 'com.android.tools.build:gradle:3.6.4'
2- In android\gradle\wrapper\gradle-wrapper.properties I changed distribution url from gradle-6.7-all.zip to gradle-6.1.1-all.zip