【问题标题】:Androidx.core 1.6.0 throwing the error : Cannot access 'kotlin.Lazy'Androidx.core 1.6.0 抛出错误:无法访问 'kotlin.Lazy'
【发布时间】:2021-08-23 17:33:18
【问题描述】:

改变这个

implementation 'androidx.core:core-ktx:1.3.2'

进入

implementation 'androidx.core:core-ktx:1.6.0'

正在抛出错误 ---> Image Link

否则不会出错---> Image Link

Gradle(应用程序)

plugins {
 id 'com.android.application'
 id 'kotlin-android'
 id 'androidx.navigation.safeargs.kotlin'
}

android {
 compileSdkVersion 30
 buildToolsVersion "30.0.2"

 defaultConfig {
     applicationId "com.saif.jetpacknavigationexample"
     minSdkVersion 21
     targetSdkVersion 30
     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'
 }
}

dependencies {

 implementation "org.jetbrains.kotlin:kotlin-stdlib:$kotlin_version"
 implementation 'androidx.core:core-ktx:1.3.2'
 implementation 'androidx.appcompat:appcompat:1.2.0'
 implementation 'com.google.android.material:material:1.2.1'
 implementation 'androidx.constraintlayout:constraintlayout:2.0.4'
 testImplementation 'junit:junit:4.+'
 androidTestImplementation 'androidx.test.ext:junit:1.1.2'
 androidTestImplementation 'androidx.test.espresso:espresso-core:3.3.0'

 def nav_version = "2.3.1"

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

Gradle(项目)

// Top-level build file where you can add configuration options common to all sub-projects/modules.
buildscript {
    ext.kotlin_version = "1.4.10"
    ext.nav_version = "2.3.1"
    repositories {
        google()
        jcenter()
    }
    dependencies {
        classpath 'com.android.tools.build:gradle:4.1.2'
        classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
        classpath "androidx.navigation:navigation-safe-args-gradle-plugin:$nav_version"

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

allprojects {
    repositories {
        google()
        jcenter()
    }
}

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

【问题讨论】:

    标签: android kotlin build.gradle android-jetpack android-jetpack-compose


    【解决方案1】:

    请更改为 1.5.31,它为我解决了问题。

    【讨论】:

    • 但是他想用1.6.0
    • 问题创建者需要他发布的版本。
    猜你喜欢
    • 1970-01-01
    • 2011-10-08
    • 2017-12-15
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2022-06-11
    • 2012-01-22
    • 1970-01-01
    相关资源
    最近更新 更多