错误:“程序类型已存在:androidx.versionedparcelable.CustomVersionedParcelable" [英] Error: "Program type already present: androidx.versionedparcelable.CustomVersionedParcelable"

查看:1077
本文介绍了错误:“程序类型已存在:androidx.versionedparcelable.CustomVersionedParcelable"的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我遇到以下错误-> 错误:程序类型已存在:androidx.versionedparcelable.CustomVersionedParcelable

I am having trouble with the following Error --> Error: Program type already present: androidx.versionedparcelable.CustomVersionedParcelable

当我单击生成错误"时,它显示以下内容:

When I click in Build errors it shows me this:

AGPBI: {"kind":"error","text":"Program type already present: androidx.versionedparcelable.CustomVersionedParcelable","sources":[{}],"tool":"D8"}
:app:transformDexArchiveWithExternalLibsDexMergerForDebug FAILED
FAILURE: Build failed with an exception.

我不知道是什么原因导致了此问题,因为我使用的是Parcelable库,但从未引起过此类错误.

I don't understand what it is causing this problem because I am using Parcelable library but never caused me this type of error.

这是我项目的gradle文件.

This is my project's gradle file.

    apply plugin: 'com.android.application'

android {
    compileSdkVersion 28
    defaultConfig {
        applicationId "com.example.package.name"
        minSdkVersion 22
        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 'com.android.support:appcompat-v7:28.0.0'
    implementation 'com.android.support.constraint:constraint-layout:1.1.3'
    testImplementation 'junit:junit:4.12'
    androidTestImplementation 'com.android.support.test:runner:1.0.2'
    androidTestImplementation 'com.android.support.test.espresso:espresso-core:3.0.2'
    // Lottie
    implementation 'com.airbnb.android:lottie:2.8.0'
    //Gson
    implementation 'com.google.code.gson:gson:2.8.5'
    implementation 'com.squareup.retrofit2:converter-gson:2.4.0'
    //Dagger 2
    implementation 'com.google.dagger:dagger:2.18'
    implementation "com.google.dagger:dagger-android-support:2.18"
    annotationProcessor 'com.google.dagger:dagger-compiler:2.18'
    //Asyncjob
    implementation 'com.arasthel:asyncjob-library:1.0.3'
    //Butterknife
    implementation 'com.jakewharton:butterknife:9.0.0-rc1'
    annotationProcessor 'com.jakewharton:butterknife-compiler:9.0.0-rc1'
}

这是我在Android Studio中的构建"面板

This is my Build panel in Android Studio

有什么想法吗??谢谢!

Any thoughts?? Thanks!!

更新(12-1-2018)

我想我已经找到了解决这个问题的方法.我读到所有支持库都将迁移到androidx库.

I think I have found the answer for this problem. I read that all the support libraries are going to migrate to androidx library.

因此,我已经阅读了Android开发者文档,并说明了如何将所有android.support.库迁移到androidx.

So I have read in the Android Developers Documentation and explain how to migrate all the android.support. libraries to androidx.

您只需要转到Android Studio,然后从菜单栏中进行重构>>迁移到AndroidX .

You only have to go to Android Studio and make Refactor >> Migrate to AndroidX from the menu bar.

这是更多信息的链接-> Android开发者文档(迁移到Androidx).

This is the link for more information --> Android Developers Documentation (Migrate to Androidx).

推荐答案

将此添加到您的gradle.properties文件

android.useAndroidX=true
android.enableJetifier=true

这篇关于错误:“程序类型已存在:androidx.versionedparcelable.CustomVersionedParcelable"的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆