微信公众号搜"智元新知"关注
微信扫一扫可直接关注哦!

java – 程序类型已存在错误

虽然存在许多类似的问题,但我检查了所有答案,但没有一个我有效!

这是编译代码时我遇到的错误

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′

版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。

相关推荐