Android Library Module developed in Kotlin exporte

2019-02-09 00:29发布

问题:

I've developed an Android Library Module in Kotlin - tested it on a Kotlin project and it all works just fine. Using gradle's maven-publishing plugin, I've generated the aar files and uploaded them on a Maven Server, so latter I added the lib on a Android Java Application using compile 'group:artifact:version'.

Library files seems to be recognized, however, when I attempt to start an activity existent on the Lib I get the following stacktrace:

05-12 14:21:48.221 11735-11735/*****.*****.dev W/art: Unable to resolve Lbr/com/**********/dataform/renderengine/core/model/DataCollector; annotation class 182
05-12 14:21:48.222 11735-11735/*****.*****.dev W/art: Unable to resolve Lbr/com/**********/dataform/renderengine/core/model/DataCollector; annotation class 181
05-12 14:21:48.222 11735-11735/*****.*****.dev W/art: Unable to resolve Lbr/com/**********/dataform/renderengine/core/model/DataCollector; annotation class 181
05-12 14:21:48.223 11735-11735/*****.*****.dev W/art: Unable to resolve Lbr/com/**********/dataform/renderengine/core/model/Collect; annotation class 182
05-12 14:21:48.224 11735-11735/*****.*****.dev W/art: Unable to resolve Lbr/com/**********/dataform/renderengine/core/model/Collect; annotation class 180
05-12 14:21:48.224 11735-11735/*****.*****.dev W/art: Unable to resolve Lbr/com/**********/dataform/renderengine/core/model/Collect; annotation class 180
05-12 14:21:48.224 11735-11735/*****.*****.dev W/art: Unable to resolve Lbr/com/**********/dataform/renderengine/core/model/Collect; annotation class 179
05-12 14:21:48.225 11735-11735/*****.*****.dev W/art: Unable to resolve Lbr/com/**********/dataform/renderengine/core/model/Collect; annotation class 179
05-12 14:21:48.225 11735-11735/*****.*****.dev W/art: Unable to resolve Lbr/com/**********/dataform/renderengine/core/model/Collect; annotation class 180
05-12 14:21:48.225 11735-11735/*****.*****.dev W/art: Unable to resolve Lbr/com/**********/dataform/renderengine/core/model/Collect; annotation class 180
05-12 14:21:48.225 11735-11735/*****.*****.dev W/art: Unable to resolve Lbr/com/**********/dataform/renderengine/core/model/Collect; annotation class 179
05-12 14:21:48.226 11735-11735/*****.*****.dev W/art: Unable to resolve Lbr/com/**********/dataform/renderengine/core/model/Collect; annotation class 179
05-12 14:21:48.226 11735-11735/*****.*****.dev W/art: Unable to resolve Lbr/com/**********/dataform/renderengine/core/model/DataCollector; annotation class 180
05-12 14:21:48.227 11735-11735/*****.*****.dev W/art: Unable to resolve Lbr/com/**********/dataform/renderengine/core/model/DataCollector; annotation class 180
05-12 14:21:48.227 11735-11735/*****.*****.dev W/art: Unable to resolve Lbr/com/**********/dataform/renderengine/core/model/DataCollector; annotation class 179
05-12 14:21:48.227 11735-11735/*****.*****.dev W/art: Unable to resolve Lbr/com/**********/dataform/renderengine/core/model/DataCollector; annotation class 179
05-12 14:21:48.227 11735-11735/*****.*****.dev W/art: Unable to resolve Lbr/com/**********/dataform/renderengine/core/model/DataCollector; annotation class 180
05-12 14:21:48.228 11735-11735/*****.*****.dev W/art: Unable to resolve Lbr/com/**********/dataform/renderengine/core/model/DataCollector; annotation class 180
05-12 14:21:48.228 11735-11735/*****.*****.dev W/art: Unable to resolve Lbr/com/**********/dataform/renderengine/core/model/DataCollector; annotation class 179
05-12 14:21:48.228 11735-11735/*****.*****.dev W/art: Unable to resolve Lbr/com/**********/dataform/renderengine/core/model/DataCollector; annotation class 179
05-12 14:21:48.229 11735-11735/*****.*****.dev W/art: Unable to resolve Lbr/com/**********/dataform/renderengine/core/model/DataCollector; annotation class 179
05-12 14:21:48.229 11735-11735/*****.*****.dev W/art: Unable to resolve Lbr/com/**********/dataform/renderengine/core/model/DataCollector; annotation class 179
05-12 14:21:48.230 11735-11735/*****.*****.dev W/art: Unable to resolve Lbr/com/**********/dataform/renderengine/core/model/Feedback; annotation class 182
05-12 14:21:48.232 11735-11735/*****.*****.dev W/art: Unable to resolve Lbr/com/**********/dataform/renderengine/core/model/Feedback; annotation class 181
05-12 14:21:48.232 11735-11735/*****.*****.dev W/art: Unable to resolve Lbr/com/**********/dataform/renderengine/core/model/Feedback; annotation class 181
05-12 14:21:48.233 11735-11735/*****.*****.dev W/art: Unable to resolve Lbr/com/**********/dataform/renderengine/core/model/Entry; annotation class 182
05-12 14:21:48.233 11735-11735/*****.*****.dev W/art: Unable to resolve Lbr/com/**********/dataform/renderengine/core/model/Entry; annotation class 180
05-12 14:21:48.234 11735-11735/*****.*****.dev W/art: Unable to resolve Lbr/com/**********/dataform/renderengine/core/model/Entry; annotation class 180
05-12 14:21:48.234 11735-11735/*****.*****.dev W/art: Unable to resolve Lbr/com/**********/dataform/renderengine/core/model/Entry; annotation class 180
05-12 14:21:48.234 11735-11735/*****.*****.dev W/art: Unable to resolve Lbr/com/**********/dataform/renderengine/core/model/Entry; annotation class 180
05-12 14:21:48.235 11735-11735/*****.*****.dev W/art: Unable to resolve Lbr/com/**********/dataform/renderengine/core/model/Feedback; annotation class 179
05-12 14:21:48.235 11735-11735/*****.*****.dev W/art: Unable to resolve Lbr/com/**********/dataform/renderengine/core/model/Feedback; annotation class 179
05-12 14:21:48.272 11735-11735/*****.*****.dev I/art: Rejecting re-init on previously-failed class java.lang.Class<br.com.**********.dataform.renderengine.presentation.feedback.PieChartFeedback>: java.lang.NoClassDefFoundError: Failed resolution of: Lcom/github/mikephil/charting/charts/PieChart;
05-12 14:21:48.273 11735-11735/*****.*****.dev I/art:     at java.lang.Object java.lang.Class.newInstance!() (Class.java:-2)
05-12 14:21:48.273 11735-11735/*****.*****.dev I/art:     at android.app.Activity android.app.Instrumentation.newActivity(java.lang.ClassLoader, java.lang.String, android.content.Intent) (Instrumentation.java:1078)
05-12 14:21:48.273 11735-11735/*****.*****.dev I/art:     at android.app.Activity android.app.ActivityThread.performLaunchActivity(android.app.ActivityThread$ActivityClientRecord, android.content.Intent) (ActivityThread.java:2557)
05-12 14:21:48.273 11735-11735/*****.*****.dev I/art:     at void android.app.ActivityThread.handleLaunchActivity(android.app.ActivityThread$ActivityClientRecord, android.content.Intent, java.lang.String) (ActivityThread.java:2726)
05-12 14:21:48.273 11735-11735/*****.*****.dev I/art:     at void android.app.ActivityThread.-wrap12(android.app.ActivityThread, android.app.ActivityThread$ActivityClientRecord, android.content.Intent, java.lang.String) (ActivityThread.java:-1)
05-12 14:21:48.273 11735-11735/*****.*****.dev I/art:     at void android.app.ActivityThread$H.handleMessage(android.os.Message) (ActivityThread.java:1477)
05-12 14:21:48.273 11735-11735/*****.*****.dev I/art:     at void android.os.Handler.dispatchMessage(android.os.Message) (Handler.java:102)
05-12 14:21:48.273 11735-11735/*****.*****.dev I/art:     at void android.os.Looper.loop() (Looper.java:154)
05-12 14:21:48.273 11735-11735/*****.*****.dev I/art:     at void android.app.ActivityThread.main(java.lang.String[]) (ActivityThread.java:6119)
05-12 14:21:48.273 11735-11735/*****.*****.dev I/art:     at java.lang.Object java.lang.reflect.Method.invoke!(java.lang.Object, java.lang.Object[]) (Method.java:-2)
05-12 14:21:48.273 11735-11735/*****.*****.dev I/art:     at void com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run() (ZygoteInit.java:886)
05-12 14:21:48.273 11735-11735/*****.*****.dev I/art:     at void com.android.internal.os.ZygoteInit.main(java.lang.String[]) (ZygoteInit.java:776)
05-12 14:21:48.273 11735-11735/*****.*****.dev I/art: Caused by: java.lang.ClassNotFoundException: Didn't find class "com.github.mikephil.charting.charts.PieChart" on path: DexPathList[[zip file "/data/app/*****.*****.dev-2/base.apk", zip file "/data/app/*****.*****.dev-2/split_lib_dependencies_apk.apk", zip file "/data/app/*****.*****.dev-2/split_lib_slice_0_apk.apk", zip file "/data/app/*****.*****.dev-2/split_lib_slice_1_apk.apk", zip file "/data/app/*****.*****.dev-2/split_lib_slice_2_apk.apk", zip file "/data/app/*****.*****.dev-2/split_lib_slice_3_apk.apk", zip file "/data/app/*****.*****.dev-2/split_lib_slice_4_apk.apk", zip file "/data/app/*****.*****.dev-2/split_lib_slice_5_apk.apk", zip file "/data/app/*****.*****.dev-2/split_lib_slice_6_apk.apk", zip file "/data/app/*****.*****.dev-2/split_lib_slice_7_apk.apk", zip file "/data/app/*****.*****.dev-2/split_lib_slice_8_apk.apk", zip file "/data/app/*****.*****.dev-2/split_lib_slice_9_apk.apk"],nativeLibraryDirectories=[/data/app/*****.*****.dev-2/lib/x86, /system/lib, /vendor/lib]]
05-12 14:21:48.273 11735-11735/*****.*****.dev I/art:     at java.lang.Class dalvik.system.BaseDexClassLoader.findClass(java.lang.String) (BaseDexClassLoader.java:56)
05-12 14:21:48.273 11735-11735/*****.*****.dev I/art:     at java.lang.Class java.lang.ClassLoader.loadClass(java.lang.String, boolean) (ClassLoader.java:380)
05-12 14:21:48.273 11735-11735/*****.*****.dev I/art:     at java.lang.Class java.lang.ClassLoader.loadClass(java.lang.String) (ClassLoader.java:312)
05-12 14:21:48.273 11735-11735/*****.*****.dev I/art:     at java.lang.Object java.lang.Class.newInstance!() (Class.java:-2)
05-12 14:21:48.273 11735-11735/*****.*****.dev I/art:     at android.app.Activity android.app.Instrumentation.newActivity(java.lang.ClassLoader, java.lang.String, android.content.Intent) (Instrumentation.java:1078)
05-12 14:21:48.273 11735-11735/*****.*****.dev I/art:     at android.app.Activity android.app.ActivityThread.performLaunchActivity(android.app.ActivityThread$ActivityClientRecord, android.content.Intent) (ActivityThread.java:2557)
05-12 14:21:48.273 11735-11735/*****.*****.dev I/art:     at void android.app.ActivityThread.handleLaunchActivity(android.app.ActivityThread$ActivityClientRecord, android.content.Intent, java.lang.String) (ActivityThread.java:2726)
05-12 14:21:48.273 11735-11735/*****.*****.dev I/art:     at void android.app.ActivityThread.-wrap12(android.app.ActivityThread, android.app.ActivityThread$ActivityClientRecord, android.content.Intent, java.lang.String) (ActivityThread.java:-1)
05-12 14:21:48.273 11735-11735/*****.*****.dev I/art:     at void android.app.ActivityThread$H.handleMessage(android.os.Message) (ActivityThread.java:1477)
05-12 14:21:48.273 11735-11735/*****.*****.dev I/art:     at void android.os.Handler.dispatchMessage(android.os.Message) (Handler.java:102)
05-12 14:21:48.273 11735-11735/*****.*****.dev I/art:     at void android.os.Looper.loop() (Looper.java:154)
05-12 14:21:48.273 11735-11735/*****.*****.dev I/art:     at void android.app.ActivityThread.main(java.lang.String[]) (ActivityThread.java:6119)
05-12 14:21:48.273 11735-11735/*****.*****.dev I/art:     at java.lang.Object java.lang.reflect.Method.invoke!(java.lang.Object, java.lang.Object[]) (Method.java:-2)
05-12 14:21:48.273 11735-11735/*****.*****.dev I/art:     at void com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run() (ZygoteInit.java:886)
05-12 14:21:48.273 11735-11735/*****.*****.dev I/art:     at void com.android.internal.os.ZygoteInit.main(java.lang.String[]) (ZygoteInit.java:776)
05-12 14:21:48.275 11735-11735/*****.*****.dev I/art: Rejecting re-init on previously-failed class java.lang.Class<br.com.**********.dataform.renderengine.presentation.FormActivity$assembleWizard$1>: java.lang.NoClassDefFoundError: Failed resolution of: Lkotlin/jvm/internal/Lambda;
05-12 14:21:48.275 11735-11735/*****.*****.dev I/art:     at java.lang.Object java.lang.Class.newInstance!() (Class.java:-2)
05-12 14:21:48.275 11735-11735/*****.*****.dev I/art:     at android.app.Activity android.app.Instrumentation.newActivity(java.lang.ClassLoader, java.lang.String, android.content.Intent) (Instrumentation.java:1078)
05-12 14:21:48.275 11735-11735/*****.*****.dev I/art:     at android.app.Activity android.app.ActivityThread.performLaunchActivity(android.app.ActivityThread$ActivityClientRecord, android.content.Intent) (ActivityThread.java:2557)
05-12 14:21:48.275 11735-11735/*****.*****.dev I/art:     at void android.app.ActivityThread.handleLaunchActivity(android.app.ActivityThread$ActivityClientRecord, android.content.Intent, java.lang.String) (ActivityThread.java:2726)
05-12 14:21:48.275 11735-11735/*****.*****.dev I/art:     at void android.app.ActivityThread.-wrap12(android.app.ActivityThread, android.app.ActivityThread$ActivityClientRecord, android.content.Intent, java.lang.String) (ActivityThread.java:-1)
05-12 14:21:48.276 11735-11735/*****.*****.dev I/art:     at void android.app.ActivityThread$H.handleMessage(android.os.Message) (ActivityThread.java:1477)
05-12 14:21:48.276 11735-11735/*****.*****.dev I/art:     at void android.os.Handler.dispatchMessage(android.os.Message) (Handler.java:102)
05-12 14:21:48.276 11735-11735/*****.*****.dev I/art:     at void android.os.Looper.loop() (Looper.java:154)
05-12 14:21:48.276 11735-11735/*****.*****.dev I/art:     at void android.app.ActivityThread.main(java.lang.String[]) (ActivityThread.java:6119)
05-12 14:21:48.276 11735-11735/*****.*****.dev I/art:     at java.lang.Object java.lang.reflect.Method.invoke!(java.lang.Object, java.lang.Object[]) (Method.java:-2)
05-12 14:21:48.276 11735-11735/*****.*****.dev I/art:     at void com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run() (ZygoteInit.java:886)
05-12 14:21:48.276 11735-11735/*****.*****.dev I/art:     at void com.android.internal.os.ZygoteInit.main(java.lang.String[]) (ZygoteInit.java:776)
05-12 14:21:48.276 11735-11735/*****.*****.dev I/art: Caused by: java.lang.ClassNotFoundException: Didn't find class "kotlin.jvm.internal.Lambda" on path: DexPathList[[zip file "/data/app/*****.*****.dev-2/base.apk", zip file "/data/app/*****.*****.dev-2/split_lib_dependencies_apk.apk", zip file "/data/app/*****.*****.dev-2/split_lib_slice_0_apk.apk", zip file "/data/app/*****.*****.dev-2/split_lib_slice_1_apk.apk", zip file "/data/app/*****.*****.dev-2/split_lib_slice_2_apk.apk", zip file "/data/app/*****.*****.dev-2/split_lib_slice_3_apk.apk", zip file "/data/app/*****.*****.dev-2/split_lib_slice_4_apk.apk", zip file "/data/app/*****.*****.dev-2/split_lib_slice_5_apk.apk", zip file "/data/app/*****.*****.dev-2/split_lib_slice_6_apk.apk", zip file "/data/app/*****.*****.dev-2/split_lib_slice_7_apk.apk", zip file "/data/app/*****.*****.dev-2/split_lib_slice_8_apk.apk", zip file "/data/app/*****.*****.dev-2/split_lib_slice_9_apk.apk"],nativeLibraryDirectories=[/data/app/*****.*****.dev-2/lib/x86, /system/lib, /vendor/lib]]
05-12 14:21:48.276 11735-11735/*****.*****.dev I/art:     at java.lang.Class dalvik.system.BaseDexClassLoader.findClass(java.lang.String) (BaseDexClassLoader.java:56)
05-12 14:21:48.276 11735-11735/*****.*****.dev I/art:     at java.lang.Class java.lang.ClassLoader.loadClass(java.lang.String, boolean) (ClassLoader.java:380)
05-12 14:21:48.276 11735-11735/*****.*****.dev I/art:     at java.lang.Class java.lang.ClassLoader.loadClass(java.lang.String) (ClassLoader.java:312)
05-12 14:21:48.276 11735-11735/*****.*****.dev I/art:     at java.lang.Object java.lang.Class.newInstance!() (Class.java:-2)
05-12 14:21:48.276 11735-11735/*****.*****.dev I/art:     at android.app.Activity android.app.Instrumentation.newActivity(java.lang.ClassLoader, java.lang.String, android.content.Intent) (Instrumentation.java:1078)
05-12 14:21:48.276 11735-11735/*****.*****.dev I/art:     at android.app.Activity android.app.ActivityThread.performLaunchActivity(android.app.ActivityThread$ActivityClientRecord, android.content.Intent) (ActivityThread.java:2557)
05-12 14:21:48.276 11735-11735/*****.*****.dev I/art:     at void android.app.ActivityThread.handleLaunchActivity(android.app.ActivityThread$ActivityClientRecord, android.content.Intent, java.lang.String) (ActivityThread.java:2726)
05-12 14:21:48.276 11735-11735/*****.*****.dev I/art:     at void android.app.ActivityThread.-wrap12(android.app.ActivityThread, android.app.ActivityThread$ActivityClientRecord, android.content.Intent, java.lang.String) (ActivityThread.java:-1)
05-12 14:21:48.276 11735-11735/*****.*****.dev I/art:     at void android.app.ActivityThread$H.handleMessage(android.os.Message) (ActivityThread.java:1477)
05-12 14:21:48.276 11735-11735/*****.*****.dev I/art:     at void android.os.Handler.dispatchMessage(android.os.Message) (Handler.java:102)
05-12 14:21:48.276 11735-11735/*****.*****.dev I/art:     at void android.os.Looper.loop() (Looper.java:154)
05-12 14:21:48.276 11735-11735/*****.*****.dev I/art:     at void android.app.ActivityThread.main(java.lang.String[]) (ActivityThread.java:6119)
05-12 14:21:48.276 11735-11735/*****.*****.dev I/art:     at java.lang.Object java.lang.reflect.Method.invoke!(java.lang.Object, java.lang.Object[]) (Method.java:-2)
05-12 14:21:48.276 11735-11735/*****.*****.dev I/art:     at void com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run() (ZygoteInit.java:886)
05-12 14:21:48.276 11735-11735/*****.*****.dev I/art:     at void com.android.internal.os.ZygoteInit.main(java.lang.String[]) (ZygoteInit.java:776)
05-12 14:21:48.482 11735-11735/*****.*****.dev E/AndroidRuntime: FATAL EXCEPTION: main
                                                                 Process: *****.*****.dev, PID: 11735
                                                                 java.lang.NoClassDefFoundError: Failed resolution of: Lkotlin/jvm/internal/Intrinsics;
                                                                     at br.com.**********.dataform.renderengine.presentation.FormActivity.assembleWizard(FormActivity.kt:117)
                                                                     at br.com.**********.dataform.renderengine.presentation.FormActivity.onCreate(FormActivity.kt:71)
                                                                     at android.app.Activity.performCreate(Activity.java:6679)
                                                                     at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1118)
                                                                     at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2618)
                                                                     at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2726)
                                                                     at android.app.ActivityThread.-wrap12(ActivityThread.java)
                                                                     at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1477)
                                                                     at android.os.Handler.dispatchMessage(Handler.java:102)
                                                                     at android.os.Looper.loop(Looper.java:154)
                                                                     at android.app.ActivityThread.main(ActivityThread.java:6119)
                                                                     at java.lang.reflect.Method.invoke(Native Method)
                                                                     at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:886)
                                                                     at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:776)
                                                                  Caused by: java.lang.ClassNotFoundException: Didn't find class "kotlin.jvm.internal.Intrinsics" on path: DexPathList[[zip file "/data/app/*****.*****.dev-2/base.apk", zip file "/data/app/*****.*****.dev-2/split_lib_dependencies_apk.apk", zip file "/data/app/*****.*****.dev-2/split_lib_slice_0_apk.apk", zip file "/data/app/*****.*****.dev-2/split_lib_slice_1_apk.apk", zip file "/data/app/*****.*****.dev-2/split_lib_slice_2_apk.apk", zip file "/data/app/*****.*****.dev-2/split_lib_slice_3_apk.apk", zip file "/data/app/*****.*****.dev-2/split_lib_slice_4_apk.apk", zip file "/data/app/*****.*****.dev-2/split_lib_slice_5_apk.apk", zip file "/data/app/*****.*****.dev-2/split_lib_slice_6_apk.apk", zip file "/data/app/*****.*****.dev-2/split_lib_slice_7_apk.apk", zip file "/data/app/*****.*****.dev-2/split_lib_slice_8_apk.apk", zip file "/data/app/*****.*****.dev-2/split_lib_slice_9_apk.apk"],nativeLibraryDirectories=[/data/app/*****.*****.dev-2/lib/x86, /system/lib, /vendor/lib]]
                                                                     at dalvik.system.BaseDexClassLoader.findClass(BaseDexClassLoader.java:56)
                                                                     at java.lang.ClassLoader.loadClass(ClassLoader.java:380)
                                                                     at java.lang.ClassLoader.loadClass(ClassLoader.java:312)
                                                                     at br.com.**********.dataform.renderengine.presentation.FormActivity.assembleWizard(FormActivity.kt:117) 
                                                                     at br.com.**********.dataform.renderengine.presentation.FormActivity.onCreate(FormActivity.kt:71) 
                                                                     at android.app.Activity.performCreate(Activity.java:6679) 
                                                                     at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1118) 
                                                                     at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2618) 
                                                                     at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2726) 
                                                                     at android.app.ActivityThread.-wrap12(ActivityThread.java) 
                                                                     at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1477) 
                                                                     at android.os.Handler.dispatchMessage(Handler.java:102) 
                                                                     at android.os.Looper.loop(Looper.java:154) 
                                                                     at android.app.ActivityThread.main(ActivityThread.java:6119) 
                                                                     at java.lang.reflect.Method.invoke(Native Method) 
                                                                     at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:886) 
                                                                     at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:776) 

This is my module's build.gradle:

apply plugin: 'com.android.library'
apply plugin: 'kotlin-android'
apply plugin: 'kotlin-android-extensions'
apply from : 'publish.gradle'

android {
    compileSdkVersion 25
    buildToolsVersion "25.0.3"

    defaultConfig {
        minSdkVersion 14
        targetSdkVersion 25
        versionCode 1
        versionName libVersion

        testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"

    }

    buildTypes {
        release {
            minifyEnabled false
            proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
        }
    }

    sourceSets {
        main.java.srcDirs += 'src/main/kotlin'
    }

    lintOptions {
        abortOnError false
    }
}

dependencies {
    // TEST
    compile fileTree(dir: 'libs', include: ['*.jar'])
    androidTestCompile('com.android.support.test.espresso:espresso-core:2.2.2', {
        exclude group: 'com.android.support', module: 'support-annotations'
    })
    compile 'com.android.support:appcompat-v7:25.3.1'
    testCompile 'junit:junit:4.12'

    // GOOGLE
    compile 'com.google.code.gson:gson:2.8.0'
    compile "com.android.support:appcompat-v7:$appcompat"
    compile "com.android.support:cardview-v7:$appcompat"
    compile "com.android.support:design:$appcompat"

    // OTHER
    compile('org.simpleframework:simple-xml:2.7.+') {
        exclude module: 'stax'
        exclude module: 'stax-api'
        exclude module: 'xpp3'
    }
    compile 'com.github.PhilJay:MPAndroidChart:v3.0.2'
    compile 'org.apache.commons:commons-io:1.3.2'

    // RX ANDROID
    compile 'io.reactivex.rxjava2:rxandroid:2.0.1'
    compile 'io.reactivex.rxjava2:rxjava:2.0.1'

    // KOTLIN
    compile "org.jetbrains.kotlin:kotlin-stdlib-jre7:$kotlin_version"

    // ANKO
    compile "org.jetbrains.anko:anko-common:$anko_version"
    compile "org.jetbrains.anko:anko-sdk15:$anko_version"
    compile "org.jetbrains.anko:anko-support-v4:$anko_version"
    compile "org.jetbrains.anko:anko-appcompat-v7:$anko_version"
}

buildscript {
    repositories {
        jcenter()
    }
    dependencies {
        classpath "org.jetbrains.kotlin:kotlin-android-extensions:$kotlin_version"
    }
}

kapt {
    generateStubs = true
}

回答1:

The kotlin-stdlib-jre7 artifact is not supposed to work on Android, which currently supports only Java 6 platform. When targeting Android, you should use kotlin-stdlib, which is built for JRE 6:

// KOTLIN
compile "org.jetbrains.kotlin:kotlin-stdlib:$kotlin_version"