dagger2编译失败

发布于 2021-12-01 02:33:09 字数 1343 浏览 801 评论 2

正在学习dagger2  ,但是写好一个例子,运行时 失败   请问是什么原因???

报异常

Error:Execution failed for task ':app:transformClassesWithDexForDebug'.
> com.android.build.api.transform.TransformException: com.android.ide.common.process.ProcessException: java.util.concurrent.ExecutionException: com.android.ide.common.process.ProcessException: org.gradle.process.internal.ExecException: Process 'command 'C:Program FilesJavajdk1.7.0_79binjava.exe'' finished with non-zero exit value 3

build.gradle的配置如下 :

apply plugin: 'com.android.application' apply plugin: 'com.neenbedankt.android-apt'  android {
    compileSdkVersion 23  buildToolsVersion "23.0.3"   defaultConfig { applicationId "com.example.app.simpledagger"  minSdkVersion 15  targetSdkVersion 23  versionCode 1  versionName "1.0"  multiDexEnabled true  }
    buildTypes {
        release { minifyEnabled false  proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'  }
    }
}
buildscript {
    repositories {
        jcenter()
    }
    dependencies {
        classpath 'com.neenbedankt.gradle.plugins:android-apt:1.4'  }
}

dependencies {
    compile fileTree(dir: 'libs', include: ['*.jar'])
    testCompile 'junit:junit:4.12' //    compile 'com.android.support:appcompat-v7:23.4.0' 
 compile 'com.google.dagger
              

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

初见你 2021-12-04 11:19:34

compile 'com.google.dagger:dagger-compiler:2.5' 这个不是吗?

成熟稳重的好男人 2021-12-03 11:27:32

知道原因了  要把

classpath 'com.neenbedankt.gradle.plugins:android-apt:1.4'  }  这句放到项目的build.gradle里
而不是module的build.gradle里
~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文