首页 > 解决方案 > Android studio 如何修复 android failed 链接失败

问题描述

所以我正在尝试重建项目然后这个错误发生帮助我对 android 新手有帮助,我只是按照教程来了解更多关于 android 的信息,我正在尝试在我的应用程序中实现 Hilt-Dagger,但不知道如何修复这个错误。这是我的毕业和错误: 错误

apply plugin: 'com.android.application'
apply plugin: 'kotlin-android'
apply plugin: 'kotlin-android-extensions'
apply plugin: 'kotlin-kapt'
apply plugin: "androidx.navigation.safeargs.kotlin"
apply plugin: "dagger.hilt.android.plugin"

android {
    compileSdkVersion 30
    buildToolsVersion "29.0.3"

    defaultConfig {
        applicationId "com.androiddevs.bikemap"
        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 = JavaVersion.VERSION_1_8.toString()
    }
}

dependencies {
    implementation fileTree(dir: 'libs', include: ['*.jar'])
    //noinspection GradleDependency
    implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlin_version"
    implementation 'androidx.appcompat:appcompat:1.3.1'
    implementation 'androidx.core:core-ktx:1.6.0'
    implementation 'androidx.constraintlayout:constraintlayout:2.1.0'
    testImplementation 'junit:junit:4.13.2'
    androidTestImplementation 'androidx.test.ext:junit:1.1.3'
    androidTestImplementation 'androidx.test.espresso:espresso-core:3.4.0'

    // Material Design
    implementation 'com.google.android.material:material:1.5.0-alpha03'

    // Architectural Components
    implementation "androidx.lifecycle:lifecycle-viewmodel-ktx:2.3.1"

    // Room
    implementation "androidx.room:room-runtime:2.3.0"
    kapt "androidx.room:room-compiler:2.3.0"

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

    // Coroutines
    implementation 'org.jetbrains.kotlinx:kotlinx-coroutines-core:1.4.1'
    implementation 'org.jetbrains.kotlinx:kotlinx-coroutines-android:1.4.1'

    // Coroutine Lifecycle Scopes
    implementation "androidx.lifecycle:lifecycle-viewmodel-ktx:2.3.1"
    implementation "androidx.lifecycle:lifecycle-runtime-ktx:2.3.1"

    // Navigation Components
    implementation "androidx.navigation:navigation-fragment-ktx:2.3.5"
    implementation "androidx.navigation:navigation-ui-ktx:2.3.5"

    // Glide
    implementation 'com.github.bumptech.glide:glide:4.11.0'
    kapt 'com.github.bumptech.glide:compiler:4.11.0'

    // Google Maps Location Services
    implementation 'com.google.android.gms:play-services-location:18.0.0'
    implementation 'com.google.android.gms:play-services-maps:17.0.1'

    // Dagger Core
    implementation "com.google.dagger:dagger:2.38.1"
    kapt "com.google.dagger:dagger-compiler:2.38.1"

    // Dagger Android
    api 'com.google.dagger:dagger-android:2.35.1'
    api 'com.google.dagger:dagger-android-support:2.28.1'
    kapt 'com.google.dagger:dagger-android-processor:2.23.2'

    //Activity KTX for ViewModels()
    implementation "androidx.activity:activity-ktx:1.3.1"

    //Dagger-Hilt
    implementation  'com.google.dagger:hilt-android:2.38.1'
    kapt    'com.google.dagger:hilt-android-compiler:2.38.1'

    implementation 'androidx.hilt:hilt-lifecycle-viewmodel:1.0.0-alpha03'
    kapt 'androidx.hilt:hilt-compiler:1.0.0'

    // Easy Permissions
    implementation 'pub.devrel:easypermissions:3.0.0'

    // Timber
    implementation 'com.jakewharton.timber:timber:4.7.1'

    // MPAndroidChart
    implementation 'com.github.PhilJay:MPAndroidChart:v3.1.0'

    implementation 'android.arch.lifecycle:extensions:1.1.1'
}

视窗 10

*"Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua。Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in "

标签: androidkotlin

解决方案


在你的错误图像中它说error: resource android:color/system_neutral1_1000 not found,所以你使用的颜色可能不存在。这导致了Android resource linking failed错误。


推荐阅读