databinding 与 dagger2冲突问题
databinding 与 dagger2同时使用,会出现databinding类不存在错误,单独使用databinding把apt注释掉,可以编译运行, 请问下这个问题应该如何解决,我想在新项目中同时使用这两个库,但是根据网上的教程,还是会存在冲突
以下是配置文件代码
project:
buildscript {
repositories {
jcenter()
}
dependencies {
classpath 'com.android.tools.build:gradle:2.3.1'
classpath 'com.neenbedankt.gradle.plugins:android-apt:1.8'
// NOTE: Do not place your application dependencies here; they belong
// in the individual module build.gradle files
}
}
allprojects {
repositories {
jcenter()
}
}
task clean(type: Delete) {
delete rootProject.buildDir
}
module:
apply plugin: 'com.android.application'
apply plugin: 'com.neenbedankt.android-apt'
android {
compileSdkVersion 25
buildToolsVersion "25.0.1"
defaultConfig {
applicationId "com.shen.mzv"
minSdkVersion 15
targetSdkVersion 25
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
versionCode 49
versionName '1.1.1'
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
//
// compileOptions {
// targetCompatibility 1.8
// sourceCompatibility 1.8
// }
dataBinding {
enabled = true
}
}
dependencies {
compile fileTree(include: ['*.jar'], dir: 'libs')
androidTestCompile('com.android.support.test.espresso:espresso-core:2.2.2', {
exclude group: 'com.android.support', module: 'support-annotations'
})
compile 'com.android.support:appcompat-v7:25.3.1'
compile 'com.android.support.constraint:constraint-layout:1.0.2'
testCompile 'junit:junit:4.12'
compile 'com.lovedise:permissiongen:0.0.6'
compile 'io.reactivex.rxjava2:rxjava:2.0.2'
compile 'io.reactivex.rxjava2:rxandroid:2.0.1'
compile 'com.jakewharton.rxbinding2:rxbinding:2.0.0'
compile 'com.jakewharton.rxbinding2:rxbinding-design:2.0.0'
//dagger2
compile 'com.google.dagger:dagger:2.9'
//
provided 'com.google.dagger:dagger-compiler:2.9'
provided 'org.glassfish:javax.annotation:10.0-b28'
compile 'com.squareup.retrofit2:retrofit:2.2.0'
//Retrofit2所需要的包
compile 'com.squareup.retrofit2:converter-gson:2.2.0'
//ConverterFactory的Gson依赖包
compile 'com.squareup.retrofit2:converter-scalars:2.2.0'
//ConverterFactory的String依赖包
compile 'com.jakewharton.retrofit:retrofit2-rxjava2-adapter:1.0.0'
compile 'com.squareup.okhttp3:okhttp:3.6.0'
compile 'com.squareup.okhttp3:logging-interceptor:3.6.0'
// compile "com.google.code.gson:gson:2.8.0"
compile 'com.squareup.picasso:picasso:2.5.2'
compile 'de.hdodenhof:circleimageview:2.1.0'
}
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
已经解决
先把android-apt注释掉
使用 annotationProcessor 'com.google.dagger:dagger-compiler:2.x' 代替 apt 'com.google.dagger:dagger-compiler:2.x'