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′

相关文章

Android性能优化——之控件的优化 前面讲了图像的优化,接下...
前言 上一篇已经讲了如何实现textView中粗字体效果,里面主要...
最近项目重构,涉及到了数据库和文件下载,发现GreenDao这个...
WebView加载页面的两种方式 一、加载网络页面 加载网络页面,...
给APP全局设置字体主要分为两个方面来介绍 一、给原生界面设...
前言 最近UI大牛出了一版新的效果图,按照IOS的效果做的,页...