我从Eclipse导入了项目,我收到了很多错误,我在成功构建后最终解决了所有错误,我收到了错误:
找不到com.google.dagger:dagger-compiler:3.0.0
build.gradle(project)
中的代码
buildscript {
repositories {
jcenter()
maven {
url 'https://maven.google.com/'
name 'Google'
}
google()
}
dependencies {
classpath 'com.android.tools.build:gradle:3.1.2'
classpath 'com.google.gms:google-services:3.2.0'
}
}
allprojects {
repositories {
jcenter()
maven {
url 'https://maven.google.com/'
name 'Google'
}
}
}
和build.gradle(module:app)中的代码是
android {
compileSdkVersion 27
buildToolsVersion "27.0.3"
defaultConfig {
applicationId "com.thanu.schoolbustracker"
minSdkVersion 24
targetSdkVersion 27
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.txt'
}
}
}
dependencies {
annotationProcessor 'com.google.dagger:dagger-compiler:3.0.0'
compile 'com.android.support:support-v4:27.0.0'
compile 'com.google.android.gms:play-services:8.3.0'
compile files('libs/google-play-services.jar')
compile files('libs/maps.jar')
compile 'com.android.support:support-annotations:27.0.2'
compile 'com.android.support:support-v13:27.0.2'
compile 'com.android.support:appcompat-v7:27.0.2'
compile 'com.android.support:support-vector-drawable:27.0.2'
compile 'com.android.support:design:27.0.2'
compile 'com.android.support:gridlayout-v7:27.0.2'
compile 'com.android.support:mediarouter-v7:27.0.2'
compile 'com.android.support:cardview-v7:27.0.2'
compile 'com.android.support:palette-v7:27.0.2'
compile 'com.android.support:leanback-v17:27.0.2'
compile 'com.android.support:recyclerview-v7:27.0.2'
compile 'com.android.support:exifinterface:27.0.2'
compile 'com.android.support.constraint:constraint-layout:1.1.0'
compile 'com.android.support.test:runner:1.0.1'
compile 'com.android.support.test.espresso:espresso-core:3.0.2'
compile 'com.android.support.test.espresso:espresso-contrib:3.0.2'
compile 'com.android.databinding:library:3.1.2'
compile 'com.android.databinding:baseLibrary:3.1.2'
compile 'com.android.databinding:compiler:3.1.2'
compile 'com.android.databinding:adapters:3.1.2'
compile 'com.google.android.gms:play-services-ads:15.0.0'
compile 'com.google.android.gms:play-services-wearable:15.0.0'
compile 'com.google.android.gms:play-services-maps:15.0.0'
compile 'com.google.android.support:wearable:2.3.0'
}
configurations.all {
resolutionStrategy.eachDependency { DependencyResolveDetails details ->
def requested = details.requested
if (requested.group == 'com.android.support') {
if (!requested.name.startsWith("multidex")) {
details.useVersion '25.3.0'
}
}
}
}
重建后,项目已成功构建,但它没有创建APK并提供错误;
找不到com.google.dagger:dagger-compiler:3.0.0
答案 0 :(得分:1)
目前最新版本的Dagger 2.15 ,更改此行:
annotationProcessor 'com.google.dagger:dagger-compiler:2.15'
其他Dagger图书馆也是:
compile "com.google.dagger:dagger:2.15"
compile "com.google.dagger:dagger-android:2.15"
compile "com.google.dagger:dagger-android-support:2.15"
annotationProcessor "com.google.dagger:dagger-android-processor:2.15"