完整的异常(exception)是:
Error:java.lang.RuntimeException: java.lang.RuntimeException: com.android.build.gradle.shrinker.ClassLookupException: Invalid class reference: java/rmi/server/RemoteStub
Error:java.lang.RuntimeException: com.android.build.gradle.shrinker.ClassLookupException: Invalid class reference: java/rmi/server/RemoteStub
Error:com.android.build.gradle.shrinker.ClassLookupException: Invalid class reference: java/rmi/server/RemoteStub
我正在使用 Kotlin 和 GreenDao。
我的毕业典礼:
apply plugin: 'org.greenrobot.greendao'
apply plugin: 'com.android.application'
apply plugin: 'kotlin-android'
apply plugin: 'kotlin-android-extensions'
android {
compileSdkVersion 25
buildToolsVersion "25.0.2"
defaultConfig {
applicationId "com.xxx.xxx"
minSdkVersion 19
targetSdkVersion 25
versionCode 4
versionName "0.0.0.3"
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
}
buildTypes {
buildTypes.each {
it.buildConfigField 'String', 'GreenDAODatabaseName', '"App_Database"'
}
release {
minifyEnabled true
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
debug {
minifyEnabled true
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
compileOptions {
sourceCompatibility JavaVersion.VERSION_1_8
targetCompatibility JavaVersion.VERSION_1_8
}
}
第二个gradle文件:
// Top-level build file where you can add configuration options common to all sub-projects/modules.
buildscript {
ext.kotlin_version = '1.1.2-4'
repositories {
jcenter()
}
dependencies {
classpath 'com.android.tools.build:gradle:3.0.0-alpha1'
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
classpath 'org.greenrobot:greendao-gradle-plugin:3.2.2'
// 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
}
到目前为止,我在应用程序中所做的只是添加一些用 kotlin 编写的 UI 类( fragment 和 Activity )。 greenDAO 存在两个实体。在我添加 kotlin proguard 之前,它可以完美地工作。
最佳答案
GreenDAO 尚不支持 Kotlin(请参阅 this)。
关于使用 kotlin 和 greendao 的 Android Studio 3.0 Proguard 返回 ClassLookupException,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/44214306/