Kotlin 库 'rxkotlin-0.21.0.jar' 的格式不受支持。请更新库或插件
Kotlin library 'rxkotlin-0.21.0.jar' has an unsupported format. Please update the library or the plugin
标题中的错误出现在 Android Studio 中,作为我所有代码上方的警告栏:
Android 工作室版本:1.1.0
Android Studio 的 Kotlin 插件版本:0.11.91.AndroidStudio.4
build.gradle
似乎使用所有最新版本的 Kotlin 库的文件:
apply plugin: 'com.android.application'
apply plugin: 'kotlin-android'
android {
compileSdkVersion 22
buildToolsVersion "22.0.1"
defaultConfig {
applicationId "ca.amandeep.simpletransit"
minSdkVersion 16
targetSdkVersion 22
versionCode 1
versionName "1.0"
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
sourceSets {
main.java.srcDirs += 'src/main/kotlin'
}
}
dependencies {
compile fileTree(dir: 'libs', include: ['*.jar'])
compile 'com.android.support:appcompat-v7:22.0.0'
compile "org.jetbrains.kotlin:kotlin-stdlib:$kotlin_version"
compile 'com.squareup.retrofit:retrofit:1.9.0'
compile('com.squareup.retrofit:converter-simplexml:1.9.0') {
exclude module: 'stax'
exclude module: 'stax-api'
exclude module: 'xpp3'
}
compile 'com.squareup.okhttp:okhttp:2.3.0'
compile 'com.squareup.okhttp:okhttp-urlconnection:2.3.0'
compile 'com.google.guava:guava:18.0'
compile 'com.facebook.stetho:stetho:1.0.1'
compile 'com.facebook.stetho:stetho-okhttp:1.0.1'
compile 'com.jakewharton.timber:timber:2.7.1'
compile 'io.reactivex:rxkotlin:0.21.0'
compile 'io.reactivex:rxandroid:0.24.0'
compile 'com.github.techfreak:wizardpager:1.0.0'
}
buildscript {
ext.kotlin_version = '0.11.91.1'
repositories {
mavenCentral()
}
dependencies {
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
classpath "org.jetbrains.kotlin:kotlin-android-extensions:$kotlin_version"
classpath 'com.jakewharton.hugo:hugo-plugin:1.2.1'
}
}
repositories {
mavenCentral()
}
apply plugin: 'com.jakewharton.hugo'
我认为他们错误地打包了这个版本。 github 上有一个问题:
https://github.com/ReactiveX/RxKotlin/issues/18
也许你应该 ping 一下它。
Kotlin M12 的 RxKotlin 版本解决了这个问题。这不再是问题。
关于错误信息...
当 Kotlin 创建的 class 文件的 ABI 版本号与 Kotlin 编译器使用的预期版本号不匹配时,会出现 "unsupported format" 错误。这不再是 Kotlin 1.0 Betas 的问题,因为 ABI 编号不会在 1.0 中再次更改。但是,在 1.0 候选发布版中将进行一次强制重新编译,以确保没有旧的编译器错误影响库或代码,并且一切都重建干净。之后就不会再有这样的问题了。
因此,如果库不是具有相同 ABI 的最新版本,或者遇到最后的“1.0 重新编译”,您可能 运行 会出现类似的错误。解决方案总是找到更新的库。
在 Kotlin 1.0 Beta 4 announcement "What's Next" 部分中有更多相关信息:
After the Beta period is over, there will an RC and then 1.0.
We would really like to make sure that no code compiled with
pre-release versions of Kotlin are kept around after 1.0, so the RC
compiler will force recompilation of all the old code. We will
coordinate with library maintainers outside JetBrains to make sure
that all the widely-used libraries will be recompiled in time.
We’ll also take the opportunity to remove some legacy at this point:
- remove all the deprecations that we have accumulated in the process of evolving our libraries,
- remove all the deprecations from the generated code (you might not have heard of those, but they exist!),
- get rid of some legacy bytecode peculiarities that were found during the beta,
- move some of the stdlib code around so that the packages there have
more structure.
After that point, the only compatible changes to the
standard library are deprecations and additions (this does not include
reflection APIs). We are running an open review for the library API to
make sure we haven’t missed anything important.
标题中的错误出现在 Android Studio 中,作为我所有代码上方的警告栏:
Android 工作室版本:1.1.0
Android Studio 的 Kotlin 插件版本:0.11.91.AndroidStudio.4
build.gradle
似乎使用所有最新版本的 Kotlin 库的文件:
apply plugin: 'com.android.application'
apply plugin: 'kotlin-android'
android {
compileSdkVersion 22
buildToolsVersion "22.0.1"
defaultConfig {
applicationId "ca.amandeep.simpletransit"
minSdkVersion 16
targetSdkVersion 22
versionCode 1
versionName "1.0"
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
sourceSets {
main.java.srcDirs += 'src/main/kotlin'
}
}
dependencies {
compile fileTree(dir: 'libs', include: ['*.jar'])
compile 'com.android.support:appcompat-v7:22.0.0'
compile "org.jetbrains.kotlin:kotlin-stdlib:$kotlin_version"
compile 'com.squareup.retrofit:retrofit:1.9.0'
compile('com.squareup.retrofit:converter-simplexml:1.9.0') {
exclude module: 'stax'
exclude module: 'stax-api'
exclude module: 'xpp3'
}
compile 'com.squareup.okhttp:okhttp:2.3.0'
compile 'com.squareup.okhttp:okhttp-urlconnection:2.3.0'
compile 'com.google.guava:guava:18.0'
compile 'com.facebook.stetho:stetho:1.0.1'
compile 'com.facebook.stetho:stetho-okhttp:1.0.1'
compile 'com.jakewharton.timber:timber:2.7.1'
compile 'io.reactivex:rxkotlin:0.21.0'
compile 'io.reactivex:rxandroid:0.24.0'
compile 'com.github.techfreak:wizardpager:1.0.0'
}
buildscript {
ext.kotlin_version = '0.11.91.1'
repositories {
mavenCentral()
}
dependencies {
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
classpath "org.jetbrains.kotlin:kotlin-android-extensions:$kotlin_version"
classpath 'com.jakewharton.hugo:hugo-plugin:1.2.1'
}
}
repositories {
mavenCentral()
}
apply plugin: 'com.jakewharton.hugo'
我认为他们错误地打包了这个版本。 github 上有一个问题:
https://github.com/ReactiveX/RxKotlin/issues/18
也许你应该 ping 一下它。
Kotlin M12 的 RxKotlin 版本解决了这个问题。这不再是问题。
关于错误信息...
当 Kotlin 创建的 class 文件的 ABI 版本号与 Kotlin 编译器使用的预期版本号不匹配时,会出现 "unsupported format" 错误。这不再是 Kotlin 1.0 Betas 的问题,因为 ABI 编号不会在 1.0 中再次更改。但是,在 1.0 候选发布版中将进行一次强制重新编译,以确保没有旧的编译器错误影响库或代码,并且一切都重建干净。之后就不会再有这样的问题了。
因此,如果库不是具有相同 ABI 的最新版本,或者遇到最后的“1.0 重新编译”,您可能 运行 会出现类似的错误。解决方案总是找到更新的库。
在 Kotlin 1.0 Beta 4 announcement "What's Next" 部分中有更多相关信息:
After the Beta period is over, there will an RC and then 1.0.
We would really like to make sure that no code compiled with pre-release versions of Kotlin are kept around after 1.0, so the RC compiler will force recompilation of all the old code. We will coordinate with library maintainers outside JetBrains to make sure that all the widely-used libraries will be recompiled in time.
We’ll also take the opportunity to remove some legacy at this point:
- remove all the deprecations that we have accumulated in the process of evolving our libraries,
- remove all the deprecations from the generated code (you might not have heard of those, but they exist!),
- get rid of some legacy bytecode peculiarities that were found during the beta,
- move some of the stdlib code around so that the packages there have more structure.
After that point, the only compatible changes to the standard library are deprecations and additions (this does not include reflection APIs). We are running an open review for the library API to make sure we haven’t missed anything important.