【问题标题】:Android Studio 3.0 Proguard using kotlin & greendao returns ClassLookupException使用 kotlin 和 greendao 的 Android Studio 3.0 Proguard 返回 ClassLookupException
【发布时间】:2017-05-27 07:41:17
【问题描述】:

完整的例外是:

错误:java.lang.RuntimeException:java.lang.RuntimeException:com.android.build.gradle.shrinker.ClassLookupException:无效的类引用:java/rmi/server/RemoteStub

错误:java.lang.RuntimeException:com.android.build.gradle.shrinker.ClassLookupException:无效的类引用:java/rmi/server/RemoteStub

错误:com.android.build.gradle.shrinker.ClassLookupException:无效的类引用: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 类(片段和活动)。 greenDAO 存在两个实体。在我添加 kotlin proguard 之前完美运行。

【问题讨论】:

    标签: android android-studio gradle kotlin


    【解决方案1】:

    GreenDAO 还不支持 Kotlin(请参阅 this)。

    【讨论】:

      【解决方案2】:

      你试过这个顺序吗?

      apply plugin: 'com.android.application'
      apply plugin: 'org.greenrobot.greendao'
      apply plugin: 'kotlin-android'
      

      就像 deviant-studio 所说的here

      【讨论】:

        猜你喜欢
        • 1970-01-01
        • 2017-12-16
        • 2015-03-15
        • 2018-05-01
        • 1970-01-01
        • 1970-01-01
        • 2012-04-26
        • 1970-01-01
        • 2014-11-19
        相关资源
        最近更新 更多