首页 > 解决方案 > 找不到 android.arch.lifecycle:compailer:1.1.1 错误

问题描述

我正在尝试在 android studio 中创建一个房间数据库。但是当我构建项目时,我出现“找不到 android.arch.lifecycle:compailer:1.1.1”这个错误。

我的 gradle 版本是 3.4.1 android studio 版本是 3.4.1 我使用 java 作为编程语言。有人可以帮我吗

我在网上搜索了这个错误,但找不到任何东西。

''' 我的 gradle 文件:应用插件:'com.android.application'

android {
compileSdkVersion 28
defaultConfig {
    applicationId "com.company.archroomdatabase"
    minSdkVersion 15
    targetSdkVersion 28
    versionCode 1
    versionName "1.0"
    testInstrumentationRunner 
"android.support.test.runner.AndroidJUnitRunner"
}
buildTypes {
    release {
        minifyEnabled false
        proguardFiles getDefaultProguardFile('proguard-android- 
 optimize.txt'), 'proguard-rules.pro'
    }
 }
 }

dependencies {
def lifecycle_version = "1.1.1"
def room_version = "1.1.1"

implementation fileTree(dir: 'libs', include: ['*.jar'])
implementation 'com.android.support:appcompat-v7:28.0.0'
implementation 'com.android.support:design:28.0.0'
implementation 'com.android.support:cardview-v7:28.0.0'
implementation 'com.android.support.constraint:constraint-layout:1.1.3'
testİmplementation 'junit:junit:4.12'
androidTestİmplementation 'com.android.support.test:runner:1.0.2'
androidTestİmplementation 'com.android.support.test.espresso:espresso-core:3.0.2'

//lifecycle components
implementation "android.arch.lifecycle:extensions:$lifecycle_version"
annotationProcessor "android.arch.lifecycle:compailer:$lifecycle_version"

//Room components
implementation "android.arch.persistence.room:runtime:$room_version"
annotationProcessor "android.arch.persistence.room:compiler:$room_version"}

我的毕业项目文件:

buildscript {
repositories {
    google()
    jcenter()
    maven { url 'http://repo1.maven.org/maven2' }
    maven {
        url "https://maven.google.com"
    }

}
dependencies {
    classpath 'com.android.tools.build:gradle:3.4.1'

    // 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.arch.lifecycle:compailer:1.1.1

在以下位置搜索: - https://dl.google.com/dl/android/maven2/android/arch/lifecycle/compailer/1.1.1/compailer-1.1.1.pom - https://dl.google .com/dl/android/maven2/android/arch/lifecycle/compailer/1.1.1/compailer-1.1.1.jar - https://jcenter.bintray.com/android/arch/lifecycle/compailer/1.1.1 /compailer-1.1.1.pom - https://jcenter.bintray.com/android/arch/lifecycle/compailer/1.1.1/compailer-1.1.1.jar

要求:项目:app

标签: javaandroidandroid-gradle-plugin

解决方案


你写错了,不是

annotationProcessor "android.arch.lifecycle:compailer:$lifecycle_version"

它是

annotationProcessor "android.arch.lifecycle:compiler:$lifecycle_version"

推荐阅读