Kotlin扩展功能构建失败

时间:2018-06-28 13:00:55

标签: android kotlin kotlin-android-extensions kotlin-extension

我正在尝试在我的应用中使用kotlin扩展功能。一切正常,但除非在构建中添加 work-runtime ktx 。 gradle文件。

之后,当我尝试运行我的应用程序时,总是会收到此错误。

  

程序类型已存在:android.support.v4.app.INotificationSideChannel $ Stub $ Proxy   消息{种类=错误,文本=程序类型已经存在:android.support.v4.app.INotificationSideChannel $ Stub $ Proxy,来源= [未知源文件],工具名称= Optional.of(D8)}

下面是我的 build.gradle 文件。

apply plugin: 'com.android.application'
apply plugin: 'kotlin-android'
apply plugin: 'kotlin-android-extensions'

android {
     compileSdkVersion 28
     defaultConfig {
     applicationId "com.spartons.androiddxcollection"
     minSdkVersion 20
     targetSdkVersion 28
     versionCode 1
     versionName "1.0"
     testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
}
buildTypes {
    release {
        minifyEnabled false
        proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
    }
}

dependencies {
      implementation fileTree(dir: 'libs', include: ['*.jar'])
      implementation"org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlin_version"
      implementation 'androidx.appcompat:appcompat:1.0.0-alpha3'
      implementation 'androidx.constraintlayout:constraintlayout:1.1.2'
      implementation 'androidx.lifecycle:lifecycle-reactivestreams-ktx:2.0.0-alpha1'
      implementation 'android.arch.work:work-runtime-ktx:1.0.0-alpha04'
      testImplementation 'junit:junit:4.12'
      androidTestImplementation 'androidx.test:runner:1.1.0-alpha3'
      androidTestImplementation 'androidx.test.espresso:espresso-core:3.1.0-alpha3'  
}

我还向 gradle.properties 文件中添加了一些属性。

# Project-wide Gradle settings.
# IDE (e.g. Android Studio) users:
# Gradle settings configured through the IDE *will override*
# any settings specified in this file.
# For more details on how to configure your build environment visit
# http://www.gradle.org/docs/current/userguide/build_environment.html
# Specifies the JVM arguments used for the daemon process.
# The setting is particularly useful for tweaking memory settings.
org.gradle.jvmargs=-Xmx1536m
# When configured, Gradle will run in incubating parallel mode.
# This option should only be used with decoupled projects. More details, visit
# org.gradle.parallel=true
android.useAndroidX = true
android.enableJetifier = true

以前有人遇到此问题,请帮忙。 预先感谢。

0 个答案:

没有答案