java - Lottie Android Studio 错误 Appcompat
问题描述
在实现 lottie 时,它告诉我 appcompat 中的这个错误。当我拿出彩票时,它工作得很好。
错误:任务“:app:transformDexArchiveWithExternalLibsDexMergerForDebug”的执行失败。java.lang.RuntimeException:com.android.builder.dexing.DexArchiveMergerException:无法合并dex
apply plugin: 'com.android.application'
android {
compileSdkVersion 26
defaultConfig {
applicationId "com.kevinladelfa.life"
minSdkVersion 23
targetSdkVersion 26
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'
}
}
}
dependencies {
implementation fileTree(dir: 'libs', include: ['*.jar'])
implementation 'com.android.support:appcompat-v7:26.1.0'
implementation 'com.android.support:design:26.1.0'
implementation 'com.android.support.constraint:constraint-layout:1.1.0'
implementation 'com.airbnb.android:lottie:2.5.4'
testImplementation 'junit:junit:4.12'
androidTestImplementation 'com.android.support.test:runner:1.0.2'
androidTestImplementation 'com.android.support.test.espresso:espresso-
core:3.0.2'
compile 'com.android.support:support-annotations:27.1.1'
compile 'com.google.firebase:firebase-core:11.8.0'
compile 'com.google.firebase:firebase-database:11.8.0'
compile 'com.google.firebase:firebase-storage:11.8.0'
compile 'com.google.firebase:firebase-crash:11.8.0'
compile 'com.google.firebase:firebase-auth:11.8.0'
compile 'com.google.firebase:firebase-messaging:11.8.0'
compile 'com.google.firebase:firebase-invites:11.8.0'
compile 'com.google.firebase:firebase-ads:11.8.0'
compile 'com.google.firebase:firebase-perf:11.8.0'
}
-
apply plugin: 'com.google.gms.google-services'
buildscript {
repositories {
google()
jcenter()
}
dependencies {
classpath 'com.android.tools.build:gradle:3.0.1'
classpath 'com.google.gms:google-services:4.0.0'
// NOTE: Do not place your application dependencies here; they belong
// in the individual module build.gradle files
}
}
allprojects {
repositories {
google()
jcenter()
maven{
url "https://maven.google.com"
}
}
}
task clean(type: Delete) {
delete rootProject.buildDir
}
解决方案
未启用多索引。请按照以下步骤打开此功能。第 1 步:将其添加到模块依赖项中
implementation 'com.android.support:multidex:1.0.3'
第2步:在默认配置下添加
multiDexEnabled true
第 3 步:将其添加到应用程序标签下的清单中
android:name="android.support.multidex.MultiDexApplication" >
然后清理并重建。
推荐阅读
- python - z3py,列出在数据类型中声明的函数
- python - ttk 样式在函数内部不起作用
- docker - 如何获取 docker 镜像的最后推送日期?
- node.js - Node.js 应用程序的分析
- css - 防止点击时出现材质按钮动画
- java - Maven 构建失败 - 插件解析错误
- android - Android studio firebase 如何下载和显示图像(无需先上传!)
- r - 取决于其他列值的选定行的中位数
- c# - 尝试捕获和线程中的索引更改
- javascript - Uncaught TypeError: Object(...) is not a function when bundled with WebPack 4