这是我的模型级:
apply plugin: 'com.android.application'
android {
compileSdkVersion 26
defaultConfig {
applicationId "cn.xpcheng.dagger2demo"
minSdkVersion 18
targetSdkVersion 26
versionCode 1
versionName "1.0"
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
javaCompileOptions {
annotationProcessorOptions {
includeCompileClasspath true
}
}
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
}
dependencies {
implementation fileTree(include: ['*.jar'], dir: 'libs')
implementation 'com.android.support:appcompat-v7:26.1.0'
testImplementation 'junit:junit:4.12'
androidTestImplementation 'com.android.support.test:runner:1.0.1'
androidTestImplementation 'com.android.support.test.espresso:espresso-core:3.0.1'
compile 'com.google.dagger:dagger:2.13'
annotationProcessor 'com.google.dagger:dagger-compiler:2.13'
}
这是我的项目build.gradle:
buildscript {
repositories {
jcenter()
}
dependencies {
classpath 'com.android.tools.build:gradle:3.0.0'
}
}
allprojects {
repositories {
google()
jcenter()
}
}
task clean(type: Delete) {
delete rootProject.buildDir
}
当我创建Project时,Android给我以下消息:
错误:无法解析配置的所有文件“:app:debugAnnotationProcessorClasspath”。
无法解析com.google.dagger:dagger-编译器:2.13。要求: project :app No缓存版本com.google.dagger:dagger-编译器:2.13可用于脱机模式。没有缓存版本的com.google.dagger:dagger-编译器:2.13可用于脱机模式。
我试着清理和重建这个项目很多次,但它不起作用,我觉得很困惑,谁能帮我吗?
发布于 2017-12-23 13:00:52
我也面临同样的错误。
清洁/重建不是为我工作的。
溶液
编辑应用程序级别的build.gradle (只需添加一些空白)&立即单击同步
希望这对任何人都有帮助
https://stackoverflow.com/questions/47301769
复制相似问题