Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/java/364.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181

Warning: file_get_contents(/data/phpspider/zhask/data//catemap/3/android/221.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Java 任务';的执行失败:应用程序:transformDexArchiveWithDexMergerForRelease';?_Java_Android_React Native_Android Studio - Fatal编程技术网

Java 任务';的执行失败:应用程序:transformDexArchiveWithDexMergerForRelease';?

Java 任务';的执行失败:应用程序:transformDexArchiveWithDexMergerForRelease';?,java,android,react-native,android-studio,Java,Android,React Native,Android Studio,我正在尝试为react本机应用程序v0.61.5发布APK, 但我犯了这个错误 任务的执行失败 “:app:transformDexArchiveWithDexMergerForRelease” 我遵循所有相关的答案,但不适合我我不知道为什么 我在过去两周发布了一个APK,它生成得非常好 android/app/build.gradle defaultConfig { applicationId "com.app.example" minSdkVersion r

我正在尝试为react本机应用程序v0.61.5发布APK, 但我犯了这个错误

任务的执行失败 “:app:transformDexArchiveWithDexMergerForRelease”

我遵循所有相关的答案,但不适合我我不知道为什么

我在过去两周发布了一个APK,它生成得非常好

android/app/build.gradle

 defaultConfig {
        applicationId "com.app.example"
        minSdkVersion rootProject.ext.minSdkVersion
        targetSdkVersion rootProject.ext.targetSdkVersion
        versionCode 1
        versionName "1.0"
        multiDexEnabled true
    }

...
dependencies {
    def multidex_version = "2.0.1"
    implementation 'androidx.multidex:multidex:$multidex_version' //added this
 implementation project(':react-native-splash-screen')
    implementation fileTree(dir: "libs", include: ["*.jar"])
    implementation "com.facebook.react:react-native:+"  // From node_modules
    implementation 'androidx.appcompat:appcompat:1.1.0-rc01'
    implementation 'androidx.swiperefreshlayout:swiperefreshlayout:1.1.0-alpha02'
    implementation 'com.facebook.android:facebook-login:[5,6)'
...
}
buildscript {
    ext {
        buildToolsVersion = "28.0.3"
        minSdkVersion = 16
        compileSdkVersion = 28
        targetSdkVersion = 28
    }
    repositories {
        google()
        jcenter()
    }
    dependencies {
        classpath("com.android.tools.build:gradle:3.4.2")

        // NOTE: Do not place your application dependencies here; they belong
        // in the individual module build.gradle files
        classpath 'com.google.gms:google-services:4.3.3'
    }

}

allprojects {
    repositories {
        mavenLocal()
        maven {
            // All of React Native (JS, Obj-C sources, Android binaries) is installed from npm
            url("$rootDir/../node_modules/react-native/android")
        }
        maven {
            // Android JSC is installed from npm
            url("$rootDir/../node_modules/jsc-android/dist")
        }

        google()
        jcenter()
        maven { url 'https://jitpack.io' }
    }
}
android/build.gradle

 defaultConfig {
        applicationId "com.app.example"
        minSdkVersion rootProject.ext.minSdkVersion
        targetSdkVersion rootProject.ext.targetSdkVersion
        versionCode 1
        versionName "1.0"
        multiDexEnabled true
    }

...
dependencies {
    def multidex_version = "2.0.1"
    implementation 'androidx.multidex:multidex:$multidex_version' //added this
 implementation project(':react-native-splash-screen')
    implementation fileTree(dir: "libs", include: ["*.jar"])
    implementation "com.facebook.react:react-native:+"  // From node_modules
    implementation 'androidx.appcompat:appcompat:1.1.0-rc01'
    implementation 'androidx.swiperefreshlayout:swiperefreshlayout:1.1.0-alpha02'
    implementation 'com.facebook.android:facebook-login:[5,6)'
...
}
buildscript {
    ext {
        buildToolsVersion = "28.0.3"
        minSdkVersion = 16
        compileSdkVersion = 28
        targetSdkVersion = 28
    }
    repositories {
        google()
        jcenter()
    }
    dependencies {
        classpath("com.android.tools.build:gradle:3.4.2")

        // NOTE: Do not place your application dependencies here; they belong
        // in the individual module build.gradle files
        classpath 'com.google.gms:google-services:4.3.3'
    }

}

allprojects {
    repositories {
        mavenLocal()
        maven {
            // All of React Native (JS, Obj-C sources, Android binaries) is installed from npm
            url("$rootDir/../node_modules/react-native/android")
        }
        maven {
            // Android JSC is installed from npm
            url("$rootDir/../node_modules/jsc-android/dist")
        }

        google()
        jcenter()
        maven { url 'https://jitpack.io' }
    }
}
MainApplication.java

而不是

public class MainApplication extends Application implements ReactApplication {...}

cd-android&&gradlew-cleanBuildCache&&gradlew-clean&&cd../&react-native-run-android
发布时使用什么命令?@Bashirpour问题不在于
react-native-run-android
在运行正常之前运行它,但我正在努力产生APK@Bashirpour我正在使用Android Studio生成签名的APKBe,请务必再次阅读本文。因为新版本的发布非常不同。对于GooglePlay,最好有一个aab版本。