gpt4 book ai didi

android - React-Native(Android)-任务 ':app:transformClassesWithMultidexlistForRelease'的执行失败

转载 作者:行者123 更新时间:2023-12-03 04:58:10 27 4
gpt4 key购买 nike

将库react-native-fcm更新为版本16(现在支持Android 8)后,出现以下错误:

Execution failed for task ':app:transformClassesWithMultidexlistForRelease'.
> com.android.build.api.transform.TransformException: Error while generating the main dex list.

关于如何处理这个想法?

project / build.gradle :
// Top-level build file where you can add configuration options common to all sub-projects/modules.

buildscript {
repositories {
jcenter()
maven {
url 'https://maven.google.com/'
name 'Google'
}
google()
}
dependencies {
classpath 'com.android.tools.build:gradle:3.1.2'
classpath 'com.google.gms:google-services:4.0.2'
// NOTE: Do not place your application dependencies here; they belong
// in the individual module build.gradle files
}
}

allprojects {
repositories {
// Add jitpack repository (added by tipsi-stripe)
maven { url "https://jitpack.io" }
mavenLocal()
jcenter()
google()
maven {
// All of React Native (JS, Obj-C sources, Android binaries) is installed from npm
url "$rootDir/../node_modules/react-native/android"
}
configurations.all {
resolutionStrategy {
force 'com.facebook.android:facebook-android-sdk:4.28.0'
force 'com.android.support:support-v4:27.1.0'
force 'com.android.support:design:27.1.0'
}
}
maven {
url 'https://maven.google.com/'
name 'Google'
}
}
}

subprojects {
if (project.name.contains('react-native-image-picker') ||
project.name.contains('react-native-vector-icons')) {
buildscript {
repositories {
jcenter()
maven { url "https://dl.bintray.com/android/android-tools/" }
}
}
}
}

和我的 project / app / build.gradle :
apply plugin: "com.android.application"

import com.android.build.OutputFile

apply from: "../../node_modules/react-native/react.gradle"

def enableSeparateBuildPerCPUArchitecture = false

def enableProguardInReleaseBuilds = false

android {
compileSdkVersion 28
buildToolsVersion "28.0.2"

defaultConfig {
applicationId "com.lisdoworker"
minSdkVersion 18
targetSdkVersion 28
versionCode 14
versionName "1.0.0"
ndk {
abiFilters "armeabi-v7a", "x86"
}
manifestPlaceholders = [
tipsiStripeRedirectScheme: "example"
]
multiDexEnabled true
}
signingConfigs {
release {
storeFile file(MYAPP_RELEASE_STORE_FILE)
storePassword MYAPP_RELEASE_STORE_PASSWORD
keyAlias MYAPP_RELEASE_KEY_ALIAS
keyPassword MYAPP_RELEASE_KEY_PASSWORD
}
}
splits {
abi {
reset()
enable enableSeparateBuildPerCPUArchitecture
universalApk false // If true, also generate a universal APK
include "armeabi-v7a", "x86"
}
}
buildTypes {
release {
signingConfig signingConfigs.release
minifyEnabled enableProguardInReleaseBuilds
proguardFiles getDefaultProguardFile("proguard-android.txt"), "proguard-rules.pro"
}
}
// applicationVariants are e.g. debug, release
applicationVariants.all { variant ->
variant.outputs.each { output ->
// For each separate APK per architecture, set a unique version code as described here:
// http://tools.android.com/tech-docs/new-build-system/user-guide/apk-splits
def versionCodes = ["armeabi-v7a":1, "x86":2]
def abi = output.getFilter(OutputFile.ABI)
if (abi != null) { // null for the universal-debug, universal-release variants
output.versionCodeOverride =
versionCodes.get(abi) * 1048576 + defaultConfig.versionCode
}
}
}
dexOptions {
jumboMode true
}
}

dependencies {
compile project(':react-native-fast-image')
compile ('com.google.firebase:firebase-core:10.2.1') {
force = true;
}
compile ('com.google.firebase:firebase-messaging:10.2.1') {
force = true;
}
compile ('com.google.android.gms:play-services-base:10.2.1') {
force = true;
}
compile ('com.google.android.gms:play-services-location:10.2.1') {
force = true;
}
compile ('com.google.android.gms:play-services-places:10.2.1') {
force = true;
}
compile ('com.google.android.gms:play-services-maps:10.2.1') {
force = true;
}
compile ('com.google.android.gms:play-services-gcm:10.2.1') {
force = true;
}
compile ('com.google.android.gms:play-services-wallet:10.2.1') {
force = true;
}
compile ('com.google.android.gms:play-services-identity:10.2.1') {
force = true;
}
compile project(':tipsi-stripe')
compile project(':react-native-fcm')
compile project(':react-native-extra-dimensions-android')
compile project(':react-native-google-places')
compile project(':react-native-vector-icons')
compile project(':react-native-linear-gradient')
compile project(':react-native-image-picker')
compile project(':react-native-fetch-blob')
compile project(':react-native-fbsdk')
compile fileTree(dir: "libs", include: ["*.jar"])
compile "com.android.support:appcompat-v7:27.1.0"
compile "com.facebook.react:react-native:+" // From node_modules
}

// Run this once to be able to run the application with BUCK
// puts all compile dependencies into folder libs for BUCK to use
task copyDownloadableDepsToLibs(type: Copy) {
from configurations.compile
into 'libs'
}

apply plugin: 'com.google.gms.google-services'

最佳答案

我相信仅仅添加multiDexEnabled = true是不够的。
尝试将此行添加到您的app/build.gradle文件:

implementation 'com.android.support:multidex:1.0.3'

同样,您的Application类(如果有的话)应该是这样的:
public class App extends MultiDexApplication {
...
}

或像这样:
public class App extends Application {

@Override
public void onCreate() {
super.onCreate();
MultiDex.install(this);
}
}

希望能帮助到你。

关于android - React-Native(Android)-任务 ':app:transformClassesWithMultidexlistForRelease'的执行失败,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/53746608/

27 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com