Not able to make release APK React Native Android app

我们两清 提交于 2019-12-06 14:56:13

问题


i want to make release for android application in react native so when i generate build i got below error message like

Error:Execution failed for task ':app:bundleReleaseJsAndAssets'.

A problem occurred starting process 'command 'node''

see attachment also

any idea how can i solve this ? your all suggestions are appreciable


回答1:


After spending 2 days I resolved it, Please follow the below steps:-

1) Stop Running Gradle

 $ cd RectNatoveProjectName & cd android  (Open your project and go to android folder)  
 $ ./gradlew --stop (Run this command to stop old running Gradle service )

2) Update the android app build gradle

project.ext.react = [
        nodeExecutableAndArgs : ["/usr/local/bin/node"]
];

3) Get Node details

$ which node 

> (Result will be like "/usr/username/.nvm/versions/node/v10.7.0/bin/node")

4) Link node (very imp step copy the above result in step 3)

- ln -s /usr/username/.nvm/versions/node/v10.7.0/bin/node /usr/local/bin/node

5) If Step - 4 return file exist - then to go the folder /usr/local/bin/ and delete the "node" file and perform the step -4 again.

6) If Step - 4 run successfully then this node issue will be resolved.




回答2:


It can have following possible solutions:
1] You need to change the node executable path in your build.gradle(i.e android/app/build.gradle) file as follows:

project.ext.react = [
        nodeExecutableAndArgs : ["/usr/local/bin/node"]
];

Or
2] You need to close your Android Studio and need to run below command from project root directory:

cd android
./gradlew assembleRelease

Or
3] You need to simply run "./gradlew --stop" command and then run "./gradlew assembleRelease" command




回答3:


Add the below following code in app/build.gradle at the end of the file.

 afterEvaluate{
    android.applicationVariants.all { variant ->
        variant.ext.bundleJsAndAssets.enabled = false
     }
   }


来源:https://stackoverflow.com/questions/51779314/not-able-to-make-release-apk-react-native-android-app

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!