我正在尝试使用Kotlin编译应用程序,但是我通过添加行kapt“ androidx.room:room-compiler:$room version”来跳过此问题
在控制台中显示错误:无法访问Publisher 找不到org.reactivestreams.Publisher的类文件 有关详细信息,请查阅以下堆栈跟踪。
我试图将rootProject.buildFileName ='build.gradle.kts'添加到settings.gradle
// App gradle
// Top-level build file where you can add configuration options common to all sub-projects/modules.
buildscript {
ext.kotlin_version = '1.3.21'
repositories {
google()
jcenter()
mavenCentral()
}
dependencies {
classpath 'com.android.tools.build:gradle:3.4.0'
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
// NOTE: Do not place your application dependencies here; they belong
// in the individual module build.gradle files
}
}
allprojects {
repositories {
google()
jcenter()
mavenCentral()
maven { url "http://jitpack.io/" }
maven{url "https://dl.bintray.com/kotlin/kotlin-eap"}
}
}
task clean(type: Delete) {
delete rootProject.buildDir
}
// Module gradle
apply plugin: 'com.android.application'
apply plugin: 'kotlin-android'
apply plugin: 'kotlin-android-extensions'
apply plugin: 'kotlin-kapt'
android {
compileSdkVersion 28
defaultConfig {
applicationId "dev.rivas.afilia2"
minSdkVersion 21
targetSdkVersion 28
versionCode 12
versionName "2.2"
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
}
buildTypes {
release {
minifyEnabled true
proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
}
}
}
dependencies {
implementation fileTree(dir: 'libs', include: ['*.jar'])
implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlin_version"
implementation 'androidx.appcompat:appcompat:1.1.0-alpha05'
implementation 'androidx.core:core-ktx:1.2.0-alpha01'
implementation 'com.google.android.material:material:1.0.0'
def anko_version = "0.10.8"
implementation "org.jetbrains.anko:anko:$anko_version"
implementation 'androidx.constraintlayout:constraintlayout:1.1.3'
testImplementation 'junit:junit:4.12'
androidTestImplementation 'androidx.test:runner:1.1.1'
androidTestImplementation 'androidx.test.espresso:espresso-core:3.1.1'
def room_version = "2.1.0-beta01"
implementation "androidx.room:room-runtime:$room_version"
kapt "androidx.room:room-compiler:$room_version"
implementation "com.squareup.retrofit2:retrofit:2.3.0"
implementation "com.squareup.retrofit2:adapter-rxjava2:2.3.0"
implementation "com.squareup.retrofit2:converter-gson:2.3.0"
implementation "io.reactivex.rxjava2:rxandroid:2.0.1"
implementation "com.squareup.okhttp3:okhttp:3.10.0"
implementation "com.squareup.okhttp3:logging-interceptor:3.10.0"
implementation 'ru.superjob:kotlin-permissions:1.0.2'
implementation 'com.github.quickpermissions:quickpermissions-kotlin:0.3.0'
implementation 'com.facebook.stetho:stetho:1.5.0'
}
我希望解决该错误并编译应用程序
答案 0 :(得分:0)
我找到的解决方案是将gradle-wrapper.properties文件中gradle中的版本更改为4.10.3-all版本。 zip文件,以及build.gradle文件中gradle插件的版本升至3.2.1版