因此,我正在尝试使用Kotlin构建我的Android项目并向其中添加AndroID DataBinding库.在AndroID Studio 2.2.3中,它没有问题.但是在更新到最新的AndroID Studio版本(2.3.0)之后,尝试运行该应用程序时出现此错误.
这是我的项目的build.gradle
buildscript { ext.kotlinVersion = '1.1.0' ext.androIDGradlePluginVersion = '2.3.0' ... dependencIEs { classpath "com.androID.tools.build:gradle:${androIDGradlePluginVersion}" classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlinVersion" classpath 'com.neenbedankt.gradle.plugins:androID-apt:1.8' }}...
这是我的应用程序的build.gradle
apply plugin: 'com.androID.application'apply plugin: 'com.neenbedankt.androID-apt'apply plugin: 'kotlin-androID'apply plugin: 'kotlin-android-extensions'androID { compileSdkVersion 25 buildToolsversion "25.0.2" ... packagingOptions { exclude 'meta-inf/rxjava.propertIEs' } sourceSets { main.java.srcDirs += 'src/main/kotlin' } dataBinding.enabled = true}dependencIEs { ... compile "com.Google.dagger:dagger:${daggerVersion}" compile "com.Google.dagger:dagger-compiler:${daggerVersion}" provIDed 'javax.annotation:Jsr250-API:1.0' kapt "com.androID.databinding:compiler:$androIDGradlePluginVersion" compile "org.jetbrains.kotlin:kotlin-stdlib:$kotlinVersion"}
为了使Kotlin与AndroID DataBinding库一起使用,我需要更新一些东西吗?请帮忙.提前致谢.
编辑:
基于@Rene答案,我试图用kotlin-kapt替换kotlin-android-extensions,但是当我尝试同步gradle时,我遇到了另一个错误.
有人从这个错误出了什么问题吗?谢谢
解决该问题的方法:
事实证明,我只需要更新gradle中与Dagger2相关的某些行即可.我从我的项目的build.gradle文件中删除了以下这一行.
classpath 'com.neenbedankt.gradle.plugins:androID-apt:1.8'
并在我的应用程序的build.gradle文件中更新与Dagger2相关的依赖项,如下所示.
compile "com.Google.dagger:dagger:${daggerVersion}"kapt "com.Google.dagger:dagger-compiler:${daggerVersion}"provIDed 'org.glassfish:javax.annotation:10.0-b28'
我从此article获得了此设置
这是我为我工作的build.gradle内容.
项目的build.gradle
buildscript { ext.kotlinVersion = '1.1.0' ext.androIDGradlePluginVersion = '2.3.0' repositorIEs { jcenter() } dependencIEs { classpath "com.androID.tools.build:gradle:${androIDGradlePluginVersion}" classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlinVersion" }}allprojects { repositorIEs { jcenter() }}task clean(type: Delete) { delete rootProject.buildDir}
应用程序的build.gradle
apply plugin: 'com.androID.application'apply plugin: 'kotlin-androID'apply plugin: 'kotlin-android-extensions'androID { compileSdkVersion 25 buildToolsversion "25.0.2" dexOptions { maxProcessCount 2 javaMaxHeapSize "2g" } defaultConfig { applicationID "my.application.ID" minSdkVersion 16 targetSdkVersion 25 versionCode 1 versionname "1.0" multIDexEnabled true testInstrumentationRunner "androID.support.test.runner.AndroIDJUnitRunner" } buildTypes { release { MinifyEnabled false proguardfiles getDefaultProguardfile('proguard-androID.txt'), 'proguard-rules.pro' } } packagingOptions { exclude 'meta-inf/rxjava.propertIEs' } sourceSets { main.java.srcDirs += 'src/main/kotlin' } dataBinding.enabled = true}kapt { generateStubs = true}ext { supportlibVersion = '25.2.0' retrofitVersion = '2.2.0' daggerVersion = '2.7' GoogleServiceVersion = '10.2.0' rxJavaVersion = '2.0.6' rxAndroIDVersion = '2.0.1' glIDeVersion = '3.7.0' constraintLayoutVersion = '1.0.1'}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' }) testCompile 'junit:junit:4.12' compile "com.squareup.retrofit2:retrofit:${retrofitVersion}" compile "com.squareup.retrofit2:converter-gson:${retrofitVersion}" compile "com.squareup.retrofit2:adapter-rxjava:${retrofitVersion}" compile 'com.squareup.okhttp3:logging-interceptor:3.3.0' compile "com.androID.support:support-compat:${supportlibVersion}" compile "com.androID.support:support-core-utils:${supportlibVersion}" compile "com.androID.support:support-core-ui:${supportlibVersion}" compile "com.androID.support:design:${supportlibVersion}" compile "com.androID.support:appcompat-v7:${supportlibVersion}" compile "com.androID.support:recyclervIEw-v7:${supportlibVersion}" compile "com.androID.support:cardvIEw-v7:${supportlibVersion}" compile "com.androID.support.constraint:constraint-layout:${constraintLayoutVersion}" compile "com.Google.dagger:dagger:${daggerVersion}" kapt "com.Google.dagger:dagger-compiler:${daggerVersion}" provIDed 'org.glassfish:javax.annotation:10.0-b28' compile 'com.androID.support:multIDex:1.0.1' compile('com.mikepenz:fastadapter:1.8.2@aar') { transitive = true } compile 'com.mikepenz:fastadapter-extensions:1.8.0@aar' compile 'com.mikepenz:materialize:1.0.0@aar' compile "com.Google.androID.gms:play-services-location:${GoogleServiceVersion}" compile "com.Google.androID.gms:play-services-maps:${GoogleServiceVersion}" compile "io.reactivex.rxjava2:rxjava:${rxJavaVersion}" compile "io.reactivex.rxjava2:rxandroID:${rxAndroIDVersion}" compile "com.github.bumptech.glIDe:glIDe:${glIDeVersion}" kapt "com.androID.databinding:compiler:$androIDGradlePluginVersion" compile "org.jetbrains.kotlin:kotlin-stdlib-jre7:$kotlinVersion" compile 'de.hdodenhof:circleimagevIEw:2.1.0'}repositorIEs { mavenCentral()}
谢谢.
解决方法:
从Kotlin 1.1开始,我不得不切换到更新的Kotlin注释处理器.
像这样应用它:
apply plugin: 'com.androID.application'apply plugin: 'kotlin-androID'apply plugin: 'kotlin-android-extensions'apply plugin: 'kotlin-kapt'
我发现它在kotlin-1-0-6-is-here的1.0.6版本中首次提到
总结以上是内存溢出为你收集整理的错误:找不到注释处理器’__gen.AnnotationProcessorWrapper_debug_android_databinding_annotationprocessor_ProcessDa全部内容,希望文章能够帮你解决错误:找不到注释处理器’__gen.AnnotationProcessorWrapper_debug_android_databinding_annotationprocessor_ProcessDa所遇到的程序开发问题。
如果觉得内存溢出网站内容还不错,欢迎将内存溢出网站推荐给程序员好友。
欢迎分享,转载请注明来源:内存溢出
评论列表(0条)