1

I'm running Android Studio Bumblebee 2021.1.1 Patch 1 on macOS. I'm trying to sync Gradle (because the Gradle tab doesn't appear on the right of the screen) and it fails when building with this error:

org.gradle.internal.operations.BuildOperationInvocationException: SDK Registry token is null. See README.md for more details.

Here's how it happens.

First, I open my app/build.gradle.

def localProperties = new Properties()
def localPropertiesFile = rootProject.file('local.properties')
if (localPropertiesFile.exists()) {
    localPropertiesFile.withReader('UTF-8') { reader ->
        localProperties.load(reader)
    }
}

def flutterRoot = localProperties.getProperty('flutter.sdk')
if (flutterRoot == null) {
    throw new FileNotFoundException("Flutter SDK not found. Define location with flutter.sdk in the local.properties file.")
}

def flutterVersionCode = localProperties.getProperty('flutter.versionCode')
if (flutterVersionCode == null) {
    flutterVersionCode = '1'
}

def flutterVersionName = localProperties.getProperty('flutter.versionName')
if (flutterVersionName == null) {
    flutterVersionName = '1.0'
}

apply plugin: 'com.android.application'
apply plugin: 'kotlin-android'
apply from: "$flutterRoot/packages/flutter_tools/gradle/flutter.gradle"

android {
    compileSdkVersion flutter.compileSdkVersion

    compileOptions {
        sourceCompatibility JavaVersion.VERSION_1_8
        targetCompatibility JavaVersion.VERSION_1_8
    }

    kotlinOptions {
        jvmTarget = '1.8'
    }

    sourceSets {
        main.java.srcDirs += 'src/main/kotlin'
    }

    defaultConfig {
        // TODO: Specify your own unique Application ID (https://developer.android.com/studio/build/application-id.html).
        applicationId "com.example.delete_me"
        minSdkVersion flutter.minSdkVersion
        targetSdkVersion flutter.targetSdkVersion
        versionCode flutterVersionCode.toInteger()
        versionName flutterVersionName
    }

    buildTypes {
        release {
            // TODO: Add your own signing config for the release build.
            // Signing with the debug keys for now, so `flutter run --release` works.
            signingConfig signingConfigs.debug
        }
    }
}

flutter {
    source '../..'
}

dependencies {
    implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlin_version"
}

Next, I see this above the file.

enter image description here

Next, I click it and downloading and building begins.

Finally I run into the error.

enter image description here

enter image description here

I've tried invalidating caches, removing .gradle from my home directory, and restarting Android Studio, but still no luck.

Any ideas?

Dylan
  • 2,315
  • 2
  • 20
  • 33
  • I also now removed Android Studio entirely (per https://stackoverflow.com/questions/17625622/how-to-completely-uninstall-android-studio-on-mac), reinstalled it and the problem remains. – Dylan Feb 11 '22 at 14:03

0 Answers0