问题描述
我在Kotlin开发了一个Android库模块 - 在Kotlin项目上进行了测试,一切正常。使用gradle的 maven-publishing
插件,我生成了 aar
文件并将它们上传到Maven服务器上,所以后者我使用 compile'group:artifact:version'
在Android Java应用程序上添加了lib。
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'
.
库文件似乎但是,当我尝试启动Lib上存在的活动时,我会得到以下堆栈跟踪:
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)
这是我的模块的build.gradle:
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
}
推荐答案
kotlin-stdlib-jre7
工件不适用于Android,目前仅支持Java 6平台。在定位Android时,您应该使用 kotlin-stdlib
,这是为JRE 6构建的:
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"
这篇关于在Kotlin中开发的Android库模块导出到Java Application导致失败的解析:Lkotlin / jvm / internal / Intrinsics的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!