I have recently updated to openjdk 11 and update my build gradle files. But now my app doesnt run. I have tried with gradle commands clean, build and then sync project with gradle files. App still doesnt run and I thinks its something with dependencies and gradle files are wrong. What changes do I need to do?
// Project-level build.gradle
plugins {
id("com.android.application") version "7.4.2" apply false // Updated Android Gradle Plugin version
id("org.jetbrains.kotlin.android") version "1.6.21" apply false // Updated Kotlin version
id("com.google.gms.google-services") version "4.4.2" apply false // Firebase services plugin
}
buildscript {
repositories {
google() // Google's Maven repository
mavenCentral() // Maven Central repository
}
dependencies {
classpath("com.android.tools.build:gradle:7.4.2") // Updated Android Gradle Plugin
classpath("org.jetbrains.kotlin:kotlin-gradle-plugin:1.6.21") // Updated Kotlin plugin version
classpath("com.google.gms:google-services:4.4.2") // Firebase services plugin
}
}
allprojects {
repositories {
google()
mavenCentral()
}
}
configurations.all {
resolutionStrategy.eachDependency {
if (requested.group == "org.jetbrains.kotlin" && requested.name == "kotlin-stdlib") {
useVersion("1.6.21") // Ensure consistent Kotlin version
}
}
}
task("clean", Delete::class) {
delete(rootProject.buildDir) // Task to clean build directories
}
//Module level build.gradle
plugins {
id("com.android.application") // Android plugin
id("org.jetbrains.kotlin.android") // Kotlin plugin
id("com.google.gms.google-services") // Firebase plugin
}
android {
namespace = "com.example.test” // Set the app's namespace
compileSdk = 35 // Updated compileSdkVersion
defaultConfig {
applicationId = ”com.example.test” // Set the app's ID
minSdk = 26 // Set minimum SDK version
targetSdk = 34 // Set target SDK version
versionCode = 6 // App version code
versionName = "1.0.6" // App version name
testInstrumentationRunner = "androidx.test.runner.AndroidJUnitRunner" // Default test runner
}
buildTypes {
release {
isMinifyEnabled = false // Disable ProGuard minification
proguardFiles(
getDefaultProguardFile("proguard-android-optimize.txt"),
"proguard-rules.pro" // ProGuard rules file
)
}
}
compileOptions {
sourceCompatibility = JavaVersion.VERSION_11 // Use Java 11 for source compatibility
targetCompatibility = JavaVersion.VERSION_11 // Use Java 11 for target compatibility
}
kotlinOptions {
jvmTarget = "11" // Ensure Kotlin compatibility with Java 11
}
buildFeatures {
compose = true // Enable Jetpack Compose features
}
composeOptions {
kotlinCompilerExtensionVersion = "1.5.3" // Set Kotlin compiler extension for Compose
}
}
dependencies {
// Core Android dependencies
implementation("org.jetbrains.kotlin:kotlin-stdlib:1.6.21") // Use Kotlin 1.6.21 version
implementation("androidx.core:core-ktx:1.15.0") // Core KTX library
implementation("androidx.lifecycle:lifecycle-runtime-ktx:2.6.2") // Lifecycle runtime
// Jetpack Compose dependencies
implementation(platform("androidx.compose:compose-bom:2023.08.00")) // Jetpack Compose BOM
implementation("androidx.compose.ui:ui") // Compose UI
implementation("androidx.compose.material3:material3") // Material3 for Compose
implementation("androidx.compose.ui:ui-graphics") // UI Graphics for Compose
implementation("androidx.compose.ui:ui-tooling-preview") // UI Tooling for Compose
// Activity and ViewModel
implementation("androidx.activity:activity-compose:1.7.2") // Activity for Compose
implementation("androidx.lifecycle:lifecycle-viewmodel-compose:2.6.2") // ViewModel for Compose
// Image loading
implementation("io.coil-kt:coil-compose:2.4.0") // Coil image loader for Compose
// Country Code Picker
implementation("io.github.joelkanyi:komposecountrycodepicker:1.2.8") // Country code picker for Compose
// Firebase dependencies
implementation(platform("com.google.firebase:firebase-bom:32.3.0")) // Firebase BOM
implementation("com.google.firebase:firebase-analytics-ktx") // Firebase Analytics
implementation("com.google.firebase:firebase-auth-ktx") // Firebase Auth
implementation("com.google.firebase:firebase-firestore-ktx") // Firebase Firestore
implementation("com.google.firebase:firebase-database-ktx") // Firebase Realtime Database
// Testing
testImplementation("junit:junit:4.13.2")
androidTestImplementation("androidx.test.ext:junit:1.1.5")
androidTestImplementation("androidx.test.espresso:espresso-core:3.5.1")
androidTestImplementation(platform("androidx.compose:compose-bom:2023.12.00"))
androidTestImplementation("androidx.compose.ui:ui-test-junit4")
debugImplementation("androidx.compose.ui:ui-tooling")
debugImplementation("androidx.compose.ui:ui-test-manifest")
}
//Settings
pluginManagement {
repositories {
google()
mavenCentral()
gradlePluginPortal()
}
}
dependencyResolutionManagement {
repositoriesMode.set(RepositoriesMode.PREFER_PROJECT)
repositories {
google()
mavenCentral()
}
}
rootProject.name = "Test"
include(":app")
Source: View source