Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Use SQL to read and write to a database: Cannot make project #67

Open
Andy-Cuong opened this issue Oct 4, 2024 · 2 comments
Open

Use SQL to read and write to a database: Cannot make project #67

Andy-Cuong opened this issue Oct 4, 2024 · 2 comments

Comments

@Andy-Cuong
Copy link

Andy-Cuong commented Oct 4, 2024

URL of codelab

In which task and step of the codelab can this issue be found?

Describe the problem
After downloading the sample, it is impossible to make (build) the project due to multiple errors after updating Gradle dependencies, AGP and Kapt-to-KSP migration. The untouched version of the sample cannot be built either (different error). It is even using View UI instead of Compose. The project should be updated in order to keep up with the latest technology.

Steps to reproduce?

  1. Download the sample
  2. Perform AGP upgrade
  3. Update Gradle dependencies as well as Android minSdk and targetSdk
  4. Migrate from Kapt to KSP according to (https://developer.android.com/build/migrate-to-ksp)
  5. Build > Make project

Versions
Android Studio version: Android Studio Ladybug | 2024.2.1
API version of the emulator:

Additional information
Build output:

Task :app:kspDebugKotlin FAILED
Execution failed for task ':app:kspDebugKotlin'.
Error while evaluating property 'compilerOptions.jvmTarget' of task ':app:kspDebugKotlin'.
Failed to calculate the value of property 'jvmTarget'.
> Unknown Kotlin JVM target: 21

build.gradle (Module:app)

plugins {
    id 'com.android.application'
    id 'kotlin-android'
    id("com.google.devtools.ksp")
}

android {
    compileSdk 34

    defaultConfig {
        applicationId "com.example.sqlbasics"
        minSdkVersion 24
        targetSdkVersion 34
        versionCode 1
        versionName "1.0"

        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.sqlbasics'
}

dependencies {
    def room_version = '2.6.1'

    implementation "androidx.room:room-runtime:$room_version"
    ksp("androidx.room:room-compiler:$room_version")

    // optional - Kotlin Extensions and Coroutines support for Room
    implementation "androidx.room:room-ktx:$room_version"

    implementation 'org.jetbrains.kotlinx:kotlinx-coroutines-android:1.8.1'
    implementation 'androidx.core:core-ktx:1.13.1'
    implementation 'androidx.appcompat:appcompat:1.7.0'
    implementation 'com.google.android.material:material:1.12.0'
    implementation 'androidx.constraintlayout:constraintlayout:2.1.4'
    testImplementation 'junit:junit:4.13.2'
    androidTestImplementation 'androidx.test.ext:junit:1.2.1'
    androidTestImplementation 'androidx.test.espresso:espresso-core:3.6.1'
}

build.gradle (Project: SQL_Basics)

buildscript {
    ext.kotlin_version = "1.7.10"
    repositories {
        google()
        mavenCentral()
    }
    dependencies {
        classpath 'com.android.tools.build:gradle:8.7.0'
        classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"

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

plugins {
    id("com.google.devtools.ksp") version "1.8.10-1.0.9" apply false
}

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

tasks.register('clean', Delete) {
    delete rootProject.buildDir
}
@g0eki
Copy link

g0eki commented Oct 24, 2024

Same problem !

@alan614
Copy link
Contributor

alan614 commented Nov 10, 2024

I made this pull request in case it would help: #68

I didn't aggressively upgrade everything to the latest version, just enough to get it to build on the newer android studio versions

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants