简体   繁体   中英

React Native: Generating the Release Build APK error :app:mergeReleaseAssets FAILED

I am trying to create signed apk for a react native app. The debug app is working fine. I am following the react native guide for creating the signed APK.

I have added the keystore to the app and set up the gradle variable, but unable to make signed apk.

Below is the error for the assembleRelease build

./gradlew assembleRelease --stacktrace

    NDK is missing a "platforms" directory.
If you are using NDK, verify the ndk.dir is set to a valid NDK directory.  It is currently set to /home/anuragdhunna/Android/Sdk/ndk-bundle.
If you are not using NDK, unset the NDK variable from ANDROID_NDK_HOME or local.properties to remove this warning.

NDK is missing a "platforms" directory.
If you are using NDK, verify the ndk.dir is set to a valid NDK directory.  It is currently set to /home/anuragdhunna/Android/Sdk/ndk-bundle.
If you are not using NDK, unset the NDK variable from ANDROID_NDK_HOME or local.properties to remove this warning.

:app:preBuild UP-TO-DATE
    :app:preReleaseBuild UP-TO-DATE
    :app:checkReleaseManifest
    :app:preDebugBuild UP-TO-DATE
    :app:prepareAndroidArchLifecycleRuntime100Library
    :app:prepareComAndroidSupportAnimatedVectorDrawable2610Library
    :app:prepareComAndroidSupportAppcompatV72610Library
    :app:prepareComAndroidSupportSupportCompat2610Library
    :app:prepareComAndroidSupportSupportCoreUi2610Library
    :app:prepareComAndroidSupportSupportCoreUtils2610Library
    :app:prepareComAndroidSupportSupportFragment2610Library
    :app:prepareComAndroidSupportSupportMediaCompat2610Library
    :app:prepareComAndroidSupportSupportV42610Library
    :app:prepareComAndroidSupportSupportVectorDrawable2610Library
    :app:prepareComFacebookFbuiTextlayoutbuilderTextlayoutbuilder100Library
    :app:prepareComFacebookFrescoDrawee190Library
    :app:prepareComFacebookFrescoFbcore190Library
    :app:prepareComFacebookFrescoFresco190Library
    :app:prepareComFacebookFrescoImagepipeline190Library
    :app:prepareComFacebookFrescoImagepipelineBase190Library
    :app:prepareComFacebookFrescoImagepipelineOkhttp3190Library
    :app:prepareComFacebookReactReactNative0560Library
    :app:prepareComFacebookSoloaderSoloader030Library
    :app:prepareOrgWebkitAndroidJscR174650Library
    :react-native-splash-screen:preBuild UP-TO-DATE
    :react-native-splash-screen:preReleaseBuild UP-TO-DATE
    :react-native-splash-screen:checkReleaseManifest
    :react-native-splash-screen:preDebugAndroidTestBuild UP-TO-DATE
    :react-native-splash-screen:preDebugBuild UP-TO-DATE
    :react-native-splash-screen:preDebugUnitTestBuild UP-TO-DATE
    :react-native-splash-screen:preReleaseUnitTestBuild UP-TO-DATE
    :react-native-splash-screen:prepareAndroidArchLifecycleRuntime100Library
    :react-native-splash-screen:prepareComAndroidSupportAnimatedVectorDrawable2610Library
    :react-native-splash-screen:prepareComAndroidSupportAppcompatV72610Library
    :react-native-splash-screen:prepareComAndroidSupportSupportCompat2610Library
    :react-native-splash-screen:prepareComAndroidSupportSupportCoreUi2610Library
    :react-native-splash-screen:prepareComAndroidSupportSupportCoreUtils2610Library
    :react-native-splash-screen:prepareComAndroidSupportSupportFragment2610Library
    :react-native-splash-screen:prepareComAndroidSupportSupportMediaCompat2610Library
    :react-native-splash-screen:prepareComAndroidSupportSupportV42610Library
    :react-native-splash-screen:prepareComAndroidSupportSupportVectorDrawable2610Library
    :react-native-splash-screen:prepareComFacebookFbuiTextlayoutbuilderTextlayoutbuilder100Library
    :react-native-splash-screen:prepareComFacebookFrescoDrawee190Library
    :react-native-splash-screen:prepareComFacebookFrescoFbcore190Library
    :react-native-splash-screen:prepareComFacebookFrescoFresco190Library
    :react-native-splash-screen:prepareComFacebookFrescoImagepipeline190Library
    :react-native-splash-screen:prepareComFacebookFrescoImagepipelineBase190Library
    :react-native-splash-screen:prepareComFacebookFrescoImagepipelineOkhttp3190Library
    :react-native-splash-screen:prepareComFacebookReactReactNative0560Library
    :react-native-splash-screen:prepareComFacebookSoloaderSoloader030Library
    :react-native-splash-screen:prepareOrgWebkitAndroidJscR174650Library
    :react-native-splash-screen:prepareReleaseDependencies
    :react-native-splash-screen:compileReleaseAidl UP-TO-DATE
    :react-native-splash-screen:compileReleaseNdk NO-SOURCE
    :react-native-splash-screen:compileLint UP-TO-DATE
    :react-native-splash-screen:copyReleaseLint NO-SOURCE
    :react-native-splash-screen:compileReleaseRenderscript UP-TO-DATE
    :react-native-splash-screen:generateReleaseBuildConfig UP-TO-DATE
    :react-native-splash-screen:generateReleaseResValues UP-TO-DATE
    :react-native-splash-screen:generateReleaseResources UP-TO-DATE
    :react-native-splash-screen:mergeReleaseResources UP-TO-DATE
    :react-native-splash-screen:processReleaseManifest UP-TO-DATE
    :react-native-splash-screen:processReleaseResources UP-TO-DATE
    :react-native-splash-screen:generateReleaseSources UP-TO-DATE
    :react-native-splash-screen:incrementalReleaseJavaCompilationSafeguard UP-TO-DATE
    :react-native-splash-screen:javaPreCompileRelease
    :react-native-splash-screen:compileReleaseJavaWithJavac UP-TO-DATE
    :react-native-splash-screen:extractReleaseAnnotations UP-TO-DATE
    :react-native-splash-screen:mergeReleaseShaders UP-TO-DATE
    :react-native-splash-screen:compileReleaseShaders UP-TO-DATE
    :react-native-splash-screen:generateReleaseAssets UP-TO-DATE
    :react-native-splash-screen:mergeReleaseAssets UP-TO-DATE
    :react-native-splash-screen:mergeReleaseProguardFiles UP-TO-DATE
    :react-native-splash-screen:packageReleaseRenderscript NO-SOURCE
    :react-native-splash-screen:packageReleaseResources UP-TO-DATE
    :react-native-splash-screen:processReleaseJavaRes NO-SOURCE
    :react-native-splash-screen:transformResourcesWithMergeJavaResForRelease UP-TO-DATE
    :react-native-splash-screen:transformClassesAndResourcesWithSyncLibJarsForRelease UP-TO-DATE
    :react-native-splash-screen:mergeReleaseJniLibFolders UP-TO-DATE
    :react-native-splash-screen:transformNativeLibsWithMergeJniLibsForRelease UP-TO-DATE
    :react-native-splash-screen:transformNativeLibsWithSyncJniLibsForRelease UP-TO-DATE
    :react-native-splash-screen:bundleRelease UP-TO-DATE
    :app:prepareReleaseDependencies
    :app:compileReleaseAidl UP-TO-DATE
    :app:compileReleaseRenderscript UP-TO-DATE
    :app:generateReleaseBuildConfig UP-TO-DATE
    :app:mergeReleaseShaders UP-TO-DATE
    :app:compileReleaseShaders UP-TO-DATE
    :app:generateReleaseAssets UP-TO-DATE
    :app:mergeReleaseAssets FAILED

    FAILURE: Build failed with an exception.

    * What went wrong:
    Execution failed for task ':app:mergeReleaseAssets'.
    > java.io.IOException: Could not delete path '/home/anuragdhunna/projects/stu/tnpsuite/android/app/build/intermediates/assets/release/fonts/SimpleLineIcons.ttf'.

    * Try:
    Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output.

    BUILD FAILED

Also, I have one more question in my mind why i am facing NDK warnings I am not using the ndk, Well I have SDK platform tools. How can I remove NDK warnings, Any guesses?

If ./gradlew clean doesn't solve the issue you can try the following:

  1. Rename ReactNativeApp/android/build directory to old.build
  2. Close Android Studio
  3. Inside ReactNativeApp/android execute ./gradlew clean
  4. Then finally execute the command ./gradlew assembleRelease
  1. The error about SimpleLineIcons.ttf has nothing to do with the NDK warnings.
  2. The warnings are caused by ReactNative, which has not yet been adopted to the latest releases of NDK and Android Studio.
  3. You can probably ignore these warnings now.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM