具体错误信息如下:
AGPBI: {"kind":"error","text":"Program type already present: android.support.v4.app.FragmentTransitionCompat21$1","sources":[{}],"tool":"D8"}
:app:transformDexArchiveWithExternalLibsDexMergerForDebug FAILED
下面有几个方法(最后一个可以使用):
1.添加“multiDexEnabled true”到 defaultConfig
android{}里:
defaultConfig {
multiDexEnabled true
applicationId "com.example.m1571.mycolorfulnews"
minSdkVersion 15
targetSdkVersion 28
versionCode 1
versionName "1.0"
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
}
此方法在我的项目中使用没有效果
2.在gradle.properties中国添加:
android.useAndroidX=true android.enableJetifier=true
此方法在我的项目中使用没有效果
3.删除冲突的依赖包:
implementation 'com.android.support:appcompat-v7:28.0.0'
删除上面的v7包,可以正常运行