虽然存在许多类似的问题,但我检查了所有答案,但没有一个对我有效!
Program type already present: android.support.v4.app.BackStackRecord$Op
Message{kind=ERROR, text=Program type already present: android.support.v4.app.BackStackRecord$Op, sources=[UnkNown source file], tool name=Optional.of(D8)}
这是我的gradle文件:
apply plugin: 'com.android.application'
android {
compileSdkVersion 27
defaultConfig {
applicationId "com.narsun.grocery"
minSdkVersion 21
targetSdkVersion 27
versionCode 1
versionName "1.0"
multiDexEnabled true
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
packagingOptions {
exclude 'meta-inf/DEPENDENCIES.txt'
exclude 'meta-inf/LICENSE.txt'
exclude 'meta-inf/NOTICE.txt'
exclude 'meta-inf/NOTICE'
exclude 'meta-inf/LICENSE'
exclude 'meta-inf/DEPENDENCIES'
exclude 'meta-inf/notice.txt'
exclude 'meta-inf/license.txt'
exclude 'meta-inf/dependencies.txt'
exclude 'meta-inf/LGPL2.1'
}
}
dependencies {
implementation filetree(dir: 'libs', include: ['*.jar'])
androidTestImplementation('com.android.support.test.espresso:espresso-core:2.2.2', {
exclude group: 'com.android.support', module: 'support-annotations'
})
implementation 'com.android.support:appcompat-v7:27.1.0'
implementation 'com.android.support:cardview-v7:27.1.0'
implementation 'com.android.support:design:27.1.0'
implementation 'com.android.support.constraint:constraint-layout:1.0.2'
implementation 'com.github.sd6352051.niftydialogeffects:niftydialogeffects:1.0.0@aar'
implementation 'com.squareup.picasso:picasso:2.5.2'
implementation 'com.squareup:android-times-square:1.6.5@aar'
implementation 'com.daimajia.slider:library:1.1.5@aar'
implementation 'com.astuetz:pagerslidingtabstrip:1.0.1'
implementation 'de.hdodenhof:circleimageview:2.2.0'
implementation 'com.github.myinnos:AwesomeImagePicker:1.0.2'
implementation 'com.github.ratty3697:android-smart-animation-library:1.6'
implementation 'com.github.zcweng:switch-button:0.0.3@aar'
implementation 'com.github.JakeWharton:ViewPagerIndicator:2.4.1'
implementation 'com.google.android.exoplayer:exoplayer:2.6.1'
implementation 'pl.droidsonroids.gif:android-gif-drawable:1.2.10'
implementation 'com.android.support:multidex:1.0.3'
testImplementation 'junit:junit:4.12'
}
你可以告诉我是否还有其他东西需要补充,以了解我在做什么或我错在哪里.
解决方法:
包版本可能不兼容.尝试降级com.android.support包,即appcompat
所以 – 实现’com.android.support:appcompat-v7:27.0.1′