I have an app that has been working properly for many years and I also installed it on several phones and tablets without any problems. Unfortunately I mad an update of Android Studio (from Flamingo 2022 to ALadybug Feature Drop | 2024.2.2) and now all of a sudden, the app does not compile anymore.

When I try to run it, I get a lot of long errors like:

Executing tasks: [:app:assembleDebug] in project C:\Users\thoma\bwSyncShare\Sonstiges\Projects\AndroidStudioProjects\Game

> Task :app:createDebugVariantModel
> Task :app:preBuild UP-TO-DATE
> Task :app:preDebugBuild UP-TO-DATE
> Task :app:mergeDebugNativeDebugMetadata NO-SOURCE
> Task :app:dataBindingMergeDependencyArtifactsDebug
> Task :app:generateDebugResValues
> Task :app:generateDebugResources
> Task :app:generateDebugBuildConfig
> Task :app:generateSafeArgsDebug
> Task :app:mapDebugSourceSetPaths
> Task :app:createDebugCompatibleScreenManifests
> Task :app:extractDeepLinksDebug
> Task :app:checkDebugAarMetadata
> Task :app:processDebugMainManifest
> Task :app:processDebugManifest
> Task :app:javaPreCompileDebug
> Task :app:mergeDebugShaders
> Task :app:compileDebugShaders NO-SOURCE
> Task :app:generateDebugAssets UP-TO-DATE
> Task :app:mergeDebugAssets
> Task :app:processDebugJavaRes NO-SOURCE
> Task :app:compressDebugAssets
> Task :app:desugarDebugFileDependencies
> Task :app:mergeDebugJniLibFolders
> Task :app:mergeDebugNativeLibs NO-SOURCE
> Task :app:stripDebugDebugSymbols NO-SOURCE
> Task :app:validateSigningDebug
> Task :app:writeDebugAppMetadata
> Task :app:writeDebugSigningConfigVersions
> Task :app:processDebugManifestForPackage
> Task :app:checkDebugDuplicateClasses
> Task :app:mergeDebugResources
> Task :app:dataBindingGenBaseClassesDebug
> Task :app:mergeLibDexDebug
> Task :app:mergeExtDexDebug
> Task :app:processDebugResources
> Task :app:compileDebugKotlin

> Task :app:compileDebugJavaWithJavac
Warnung: [options] Quellwert 8 ist veraltet und wird in einem zukünftigen Release entfernt
Warnung: [options] Zielwert 8 ist veraltet und wird in einem zukünftigen Release entfernt
Warnung: [options] Verwenden Sie -Xlint:-options, um Warnungen zu veralteten Optionen zu unterdrücken.
Hinweis: Einige Eingabedateien verwenden oder überschreiben eine veraltete API.
Hinweis: Wiederholen Sie die Kompilierung mit -Xlint:deprecation, um Details zu erhalten.
3 Warnungen

> Task :app:dexBuilderDebug FAILED
AGPBI: {"kind":"error","text":"java.lang.NullPointerException","sources":[{"file":"C:\\Users\\thoma\\bwSyncShare\\Sonstiges\\Projects\\AndroidStudioProjects\\Game\\app\\build\\intermediates\\javac\\debug\\classes\\com\\example\\game\\FR_Game$1.class"}],"tool":"D8"}
AGPBI: {"kind":"error","text":"java.lang.NullPointerException","sources":[{"file":"C:\\Users\\thoma\\bwSyncShare\\Sonstiges\\Projects\\AndroidStudioProjects\\Game\\app\\build\\intermediates\\javac\\debug\\classes\\com\\example\\game\\LiveData_FirebaseHighScore$MyValueEventListener.class"}],"tool":"D8"}
AGPBI: {"kind":"error","text":"java.lang.NullPointerException","sources":[{"file":"C:\\Users\\thoma\\bwSyncShare\\Sonstiges\\Projects\\AndroidStudioProjects\\Game\\app\\build\\intermediates\\javac\\debug\\classes\\com\\example\\game\\FR_Game$3.class"}],"tool":"D8"}
AGPBI: {"kind":"error","text":"java.lang.NullPointerException","sources":[{"file":"C:\\Users\\thoma\\bwSyncShare\\Sonstiges\\Projects\\AndroidStudioProjects\\Game\\app\\build\\intermediates\\javac\\debug\\classes\\com\\example\\game\\DialogFR_LevelEnd$1.class"}],"tool":"D8"}
AGPBI: {"kind":"error","text":"java.lang.NullPointerException","sources":[{"file":"C:\\Users\\thoma\\bwSyncShare\\Sonstiges\\Projects\\AndroidStudioProjects\\Game\\app\\build\\intermediates\\javac\\debug\\classes\\com\\example\\game\\FR_Game$2.class"}],"tool":"D8"}
org.gradle.workers.WorkerExecutionException: There were multiple failures while executing work items
    at org.gradle.workers.internal.DefaultWorkerExecutor.workerExecutionException(DefaultWorkerExecutor.java:225)
    at org.gradle.workers.internal.DefaultWorkerExecutor.await(DefaultWorkerExecutor.java:205)
    at com.android.build.gradle.internal.tasks.DexArchiveBuilderTaskDelegate.doProcess(DexArchiveBuilderTaskDelegate.kt:226)
    at com.android.build.gradle.internal.tasks.DexArchiveBuilderTask.doTaskAction(DexArchiveBuilderTask.kt:229)
    at com.android.build.gradle.internal.tasks.NewIncrementalTask$taskAction$$inlined$recordTaskAction$1.invoke(BaseTask.kt:69)
    at com.android.build.gradle.internal.tasks.Blocks.recordSpan(Blocks.java:51)
    at com.android.build.gradle.internal.tasks.NewIncrementalTask.taskAction(NewIncrementalTask.kt:46)
    at java.base/jdk.internal.reflect.DirectMethodHandleAccessor.invoke(Unknown Source)
    at java.base/java.lang.reflect.Method.invoke(Unknown Source)
    at org.gradle.internal.reflect.JavaMethod.invoke(JavaMethod.java:125)
    at org.gradle.api.internal.project.taskfactory.IncrementalTaskAction.doExecute(IncrementalTaskAction.java:45)
    at org.gradle.api.internal.project.taskfactory.StandardTaskAction.execute(StandardTaskAction.java:51)
    at org.gradle.api.internal.project.taskfactory.IncrementalTaskAction.execute(IncrementalTaskAction.java:26)
    at org.gradle.api.internal.project.taskfactory.StandardTaskAction.execute(StandardTaskAction.java:29)

and a lot more.I assume it might have something to do with the build.gradle file which look like this:

// Top-level build file where you can add configuration options common to all sub-projects/modules.
buildscript {
    ext.nav_version = '2.5.3'

    repositories {
        google()
        mavenCentral()
    }
    dependencies {
        classpath 'com.android.tools.build:gradle:8.0.0'
        classpath "androidx.navigation:navigation-safe-args-gradle-plugin:$nav_version"
        classpath 'com.google.gms:google-services:4.4.0'

        // NOTE: Do not place your application dependencies here; they belong
        // in the individual module build.gradle files
    }
}

allprojects {
    repositories {
        google()
        mavenCentral()
    }
}

task clean(type: Delete) {
    delete rootProject.buildDir
}

and under Module:app

plugins {
    id 'com.android.application'
    id 'kotlin-android'
}

apply plugin: "androidx.navigation.safeargs"



android {
    compileSdkVersion 33
    buildToolsVersion "30.0.3"

    lintOptions {
        disable 'ContentDescription'
    }

    defaultConfig {
        applicationId "com.example.game"
        minSdkVersion 24
        targetSdkVersion 33
        versionCode 1
        versionName "1.0"
        viewBinding {
            enabled = true
        }

        testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
    }

    buildTypes {
        release {
            minifyEnabled false
            proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
        }
    }
    compileOptions {
        sourceCompatibility JavaVersion.VERSION_1_8
        targetCompatibility JavaVersion.VERSION_1_8
    }
    kotlinOptions {
        jvmTarget = '1.8'
    }
    namespace 'com.example.game'
}

dependencies {

    implementation 'androidx.core:core-ktx:1.10.0'
    implementation 'androidx.appcompat:appcompat:1.6.1'
    implementation 'com.google.android.material:material:1.8.0'
    implementation "androidx.constraintlayout:constraintlayout:2.1.4"


    implementation 'androidx.legacy:legacy-support-v4:1.0.0'
    implementation 'androidx.gridlayout:gridlayout:1.0.0'
    testImplementation 'junit:junit:'
    androidTestImplementation 'androidx.test.ext:junit:1.1.5'
    androidTestImplementation 'androidx.test.espresso:espresso-core:3.5.1'

    implementation "androidx.navigation:navigation-fragment-ktx:$nav_version"
    implementation "androidx.navigation:navigation-ui-ktx:$nav_version"

    implementation "androidx.navigation:navigation-fragment:$nav_version"
    implementation "androidx.navigation:navigation-ui:$nav_version"
    implementation platform('com.google.firebase:firebase-bom:29.0.3')
    implementation 'com.google.firebase:firebase-database'

    implementation(platform("org.jetbrains.kotlin:kotlin-bom:1.8.0"))

}

and the grandle-wrapper properties:

distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-8.9-bin.zip
networkTimeout=10000
validateDistributionUrl=true
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists

Do you see a possible cause of the errors and can you think about ways how to get rid of them? As stated before, on the old android studio everything was working perfectly on the emulators and also on several real devices

Source: View source