android - com.android.build.api.transform.TransformException:生成主 dex 列表时出错
问题描述
我正在一个 react native 项目中实现 react-native-firebase 通知库。这是我的 android gradle.build
buildscript {
repositories {
google()
jcenter()
maven {
url 'https://maven.google.com/'
name 'Google'
}
maven { url 'https://maven.fabric.io/public' }
flatDir {
dirs 'libs'
}
}
dependencies {
classpath 'io.fabric.tools:gradle:1.+'
classpath 'com.android.tools.build:gradle:3.1.4'
classpath 'com.google.gms:google-services:4.0.1'
// NOTE: Do not place your application dependencies here; they belong
// in the individual module build.gradle files
}
}
allprojects {
repositories {
mavenLocal()
google()
jcenter()
maven { url "$rootDir/../node_modules/react-native/android" }
maven { url "https://maven.google.com" }
flatDir {
dirs 'libs'
}
}
}
和应用程序gradle.build
dependencies {
implementation fileTree(include: ['*.jar'], dir: 'libs')
implementation(project(':react-native-maps')) {
exclude group: 'com.google.android.gms', module: 'play-services-base'
exclude group: 'com.google.android.gms', module: 'play-services-maps'
}
implementation 'com.android.support:multidex:1.0.3'
implementation('com.crashlytics.sdk.android:crashlytics:2.6.8@aar') {
transitive = true;
}
implementation "com.android.support:appcompat-v7:27.1.0"
implementation 'com.facebook.react:react-native:+'
implementation(project(':react-native-firebase'))
implementation "com.google.android.gms:play-services-base:15.0.1"
implementation "com.google.firebase:firebase-core:16.0.1"
}
task copyDownloadableDepsToLibs(type: Copy) {
from configurations.compile
into 'libs'
}
apply plugin: 'com.google.gms.google-services'
com.google.gms.googleservices.GoogleServicesPlugin.config.disableVersionCheck = true
生成构建时出现异常。我玩过更改版本但结果相同。这是例外
* What went wrong:
Execution failed for task ':app:transformClassesWithMultidexlistForDebug'.
> com.android.build.api.transform.TransformException: Error while generating the main dex list.
解决方案
在你的应用程序的 gradle.build 文件中添加这个 implementation "com.android.support:design:27.1.0"
推荐阅读
- javascript - Redux-persist 不适用于 Redux-Toolkit
- android - 在android中使用WorkManager多次调用一个api
- java - 创建Java项目管道的最佳方法
- node.js - 并发大删除操作挂在 NodeJS
- cairo - Cairo:如何绘制夹在边缘的位图?
- java - 如何在 SageMaker 中为笔记本设置 Java 主页
- c# - 在c#app中,如何在SQL中连接子任务表的外键?
- json - 试图反序列化在正文中传递的 Json 对象
- docusaurus - 弹出窗口可能在 docusaurus 中?
- c++ - 获取 C++ 中的类字段列表?