正在获取“程序类型已存在:android.support.v4.app.LoaderManager”

时间:2018-09-27 18:42:47

标签: android

当我在我的应用程序上运行我的Android应用程序时,编译器给出以下错误

Program type already present: android.support.v4.app.LoaderManager
java.lang.RuntimeException: 
com.android.builder.dexing.DexArchiveMergerException: Error while merging 
dex archives: 
C:\Users\xxx\xxx\app\build\intermediates\transforms\dexBuilder\debug\1.jar,
com.android.tools.r8.CompilationFailedException: Compilation failed to 
complete 
com.android.tools.r8.utils.AbortException

enter image description here

implementation fileTree(dir: 'libs', include: ['*.jar'])
implementation 'com.android.support:appcompat-v7:27.1.1'
implementation 'com.android.support:design:27.1.1'
implementation 'com.android.support.constraint:constraint-layout:1.1.2'
implementation 'com.android.support:support-v4:27.1.1'
implementation 'com.squareup.retrofit:retrofit:1.9.0'
implementation 'com.squareup.okhttp:mockwebserver:2.3.0'
implementation 'com.squareup.okhttp3:okhttp:3.10.0'
implementation 'org.codehaus.jackson:jackson-mapper-asl:1.9.13'
implementation 'com.android.support:recyclerview-v7:28.0.0'
implementation 'com.squareup.picasso:picasso:2.71828'
testImplementation 'junit:junit:4.12'
androidTestImplementation 'com.android.support.test:runner:1.0.2'
androidTestImplementation 'com.android.support.test.espresso:espressocore:3.0.2'
implementation 'com.android.support:cardview-v7:27.1.1'

2 个答案:

答案 0 :(得分:0)

尝试进入gradle脚本,在buildTypes{ }下的build.gradle中添加此行multiDexEnabled true,然后同步Gradle。

例如:

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

答案 1 :(得分:0)

如果您使用Google Play服务com.google.android.gms:play-services:... 将其更改为新版本,然后

清理并重建项目