Android Studio: How to fix error "java.lang.NullPointerException (no error message)"

I try to work with old project that hasn’t been updated years ago. I got an exception without any explanation.

Code:

A problem occurred configuring project ':app'.
> java.lang.NullPointerException (no error message)

1614965852718.png

The error is caused by gradle. Most of the answers I found didn’t help, because whatever I do, it always fails. After hours and hours, I finally found a fix by myself. Change gradle version to latest verison

Assuming you know the latest version of gradle version, open build.gradle (NOT in /app/build.gradle) and change com.android.tools.build:gradle to latest version in the dependencies.
Example:

Code:

'com.android.tools.build:gradle:3.4.0'

to

Code:

'com.android.tools.build:gradle:4.1.2'

(4.1.2 as of March 2021)

Now Sync, if asked

Image 1614966539.png

You will now get another error about Gradle version, just click the blue text Fix Gradle wrapper and re-import project.

Image 1614966683.png

You should be good to go \o/

Image 1614966894.png

Hope it helps!

Popular Posts

[TOOL] Unity Assets Bundle Extractor

Il2CppDumper GUI Android App