ModelCache.computeIfAbsent must not be null
Asked Answered
S

5

5

After upgrading to Android Studio 3 Canary 4 I've got this error:

Gradle sync failed: Argument for @NotNull parameter 'key' of com/android/tools/idea/gradle/project/model/ide/android/ModelCache.computeIfAbsent must not be null

Anyone else has the same problem?

Sneeze answered 24/6, 2017 at 22:56 Comment(0)
P
10

update project level build.gradle file with

```

dependencies {
        classpath 'com.android.tools.build:gradle:2.3.3'
    }

```

and module build.gradle:

buildToolsVersion '25.0.3'

Poulterer answered 11/7, 2017 at 1:27 Comment(1)
I am using Android Studio 3.0 Canary 7. I changed classpath as 'com.android.tools.build:gradle:2.3.1' and I also changed buildToolsVersion as '25.0.0' and the problem was resolved for me.Fivepenny
P
1

classpath 'com.android.tools.build:gradle:4.2.0'

Pinkham answered 21/2, 2022 at 7:10 Comment(1)
Your answer could be improved with additional supporting information. Please edit to add further details, such as citations or documentation, so that others can confirm that your answer is correct. You can find more information on how to write good answers in the help center.Patrickpatrilateral
S
0

In case someone else has had this problem:

This error only raises in Preview versions of Canary, if you come back to an stable Version 2.X, everything is ok

Sneeze answered 25/6, 2017 at 9:20 Comment(0)
C
0

Kindly replace your gradle build version with "+" in your project gradle file dependencies as mentioned below -

dependencies {
    classpath 'com.android.tools.build:gradle:+'
}

It works for me.

Canary answered 27/6, 2017 at 19:10 Comment(0)
U
0

Had the same problem when I got Android Studio Bumblebee ModelCache.safeGet(androidProjectResult.androidProject::getNdkVersion, "") must not be null

This worked for me, go to File > Project Structure > Modules > and select NDK Version ex. 21.4.71. ..

Umbilicus answered 31/1, 2022 at 9:19 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.