完整的例外是:的Android 3.0工作室使用Proguard的科特林&greendao返回ClassLookupException
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
我使用科特林和GreenDao。
我gradle這個:
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
}
所有我的程序做了到目前爲止添加寫在科特林幾個UI類(片段和活動)。 greenDAO有兩個實體。在我添加kotlin proguard之前完美地工作。