I'm trying to get familiar with jetpack compose. I cloned the Android Developer Codelab, and I'm practicing the Navigation Codelab.
I haven't even done much in the codelab, but when i run the code I get an error;
I don't know the cause, or what is needed to solve this.
So I'm going to just paste the gradle files. Not to have a lengthy question. If you need anymore information, I'll happily provide it. Thanks in Advance.
Build.Gradle (Project Module);
buildscript {
// Define versions in a single place
ext {
// Sdk and tools
compileSdkVersion = 32
minSdkVersion = 21
targetSdkVersion = 32
// App dependencies
appCompatVersion = '1.4.2'
activityComposeVersion = '1.6.0-alpha03'
composeVersion = '1.2.0'
// composeCompilerVersion = "1.2.0"
composeCompilerVersion = "1.3.0-rc01"
coreTestingVersion = '2.1.0'
espressoVersion = '3.4.0'
gradleVersion = '7.2.1'
kotlinVersion = '1.7.10'
// kotlinVersion = '1.7.0'
ktlintVersion = '0.45.2'
ktxVersion = '1.8.0'
materialVersion = '1.6.1'
navigationComposeVersion = '2.5.0'
}
repositories {
google()
mavenCentral()
}
dependencies {
classpath "com.android.tools.build:gradle:$gradleVersion"
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlinVersion"
}
}
plugins {
id 'com.diffplug.spotless' version '6.7.0'
}
subprojects {
repositories {
google()
mavenCentral()
}
apply plugin: 'com.diffplug.spotless'
spotless {
kotlin {
target '**/*.kt'
targetExclude("$buildDir/**/*.kt")
targetExclude('bin/**/*.kt')
ktlint(rootProject.ktlintVersion)
licenseHeaderFile rootProject.file('spotless/copyright.kt')
}
}
}
Build.gradle (App module);
plugins {
id 'com.android.application'
id 'kotlin-android'
}
android {
compileSdkVersion 32
defaultConfig {
applicationId "com.example.compose.rally"
minSdkVersion 21
targetSdkVersion 32
versionCode 1
versionName '1.0'
testInstrumentationRunner 'androidx.test.runner.AndroidJUnitRunner'
vectorDrawables.useSupportLibrary = true
}
signingConfigs {
// We use a bundled debug keystore, to allow debug builds from CI to be upgradable
debug {
storeFile rootProject.file('debug.keystore')
storePassword 'android'
keyAlias 'androiddebugkey'
keyPassword 'android'
}
}
buildTypes {
debug {
signingConfig signingConfigs.debug
}
release {
minifyEnabled true
proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
}
}
compileOptions {
sourceCompatibility JavaVersion.VERSION_1_8
targetCompatibility JavaVersion.VERSION_1_8
}
kotlinOptions {
jvmTarget = '1.8'
}
buildFeatures {
compose true
}
composeOptions {
kotlinCompilerExtensionVersion rootProject.composeCompilerVersion
}
packagingOptions {
exclude "META-INF/licenses/**"
exclude "META-INF/AL2.0"
exclude "META-INF/LGPL2.1"
}
}
dependencies {
implementation "androidx.appcompat:appcompat:$rootProject.appCompatVersion"
implementation "androidx.core:core-ktx:$rootProject.ktxVersion"
implementation "com.google.android.material:material:$rootProject.materialVersion"
// Compose
implementation "androidx.compose.runtime:runtime:$rootProject.composeVersion"
implementation "androidx.compose.ui:ui:$rootProject.composeVersion"
implementation "androidx.compose.foundation:foundation:$rootProject.composeVersion"
implementation "androidx.compose.material:material:$rootProject.composeVersion"
implementation "androidx.compose.material:material-icons-extended:$rootProject.composeVersion"
implementation "androidx.activity:activity-compose:$rootProject.activityComposeVersion"
implementation "androidx.navigation:navigation-compose:$rootProject.navigationComposeVersion"
debugImplementation "androidx.compose.ui:ui-tooling:$rootProject.composeVersion"
// Testing dependencies
androidTestImplementation "androidx.arch.core:core-testing:$rootProject.coreTestingVersion"
androidTestImplementation "androidx.test.espresso:espresso-contrib:$rootProject.espressoVersion"
androidTestImplementation "androidx.test.espresso:espresso-core:$rootProject.espressoVersion"
// Compose testing dependencies
androidTestImplementation "androidx.compose.ui:ui-test-junit4:$rootProject.composeVersion"
debugImplementation "androidx.compose.ui:ui-test-manifest:$rootProject.composeVersion"
}
tasks.withType(org.jetbrains.kotlin.gradle.tasks.KotlinCompile).configureEach {
kotlinOptions {
// Treat all Kotlin warnings as errors
allWarningsAsErrors = true
freeCompilerArgs += '-opt-in=kotlin.RequiresOptIn'
// Set JVM target to 1.8
jvmTarget = "1.8"
}
}
Thanks a lot for your help, in Advance. Again, if you need anymore information I'm happy to provide.