I want to release my react native app to Google play store after upgrading it to new SDK but I am facing a problem in releasing it in AAB format. I am able to run my app in the emulator but not when i ran npx react-native build-android --mode=release
as stated in the documentation.
Error
<code>Starting Metro Bundler
warning: Bundler cache is empty, rebuilding (this may take a minute)
Error: Unable to resolve module .index.js from C:UsersuserDocumentsmadeeasyfinalMadeEasyLearningAppView/.: .index.js could not be found within the project or in these directories:
> Task :app:createBundleReleaseJsAndAssets FAILED
FAILURE: Build failed with an exception.
Execution failed for task ':app:createBundleReleaseJsAndAssets'.
> Process 'command 'cmd'' finished with non-zero exit value 1
error Failed to build the app.
Error: Command failed with exit code 1: gradlew.bat app:bundleRelease
at makeError (C:UsersuserDocumentsmadeeasyfinalMadeEasyLearningAppViewnode_modules@react-native-communitycli-platform-androidnode_modulesexecaliberror.js:60:11)
at module.exports.sync (C:UsersuserDocumentsmadeeasyfinalMadeEasyLearningAppViewnode_modules@react-native-communitycli-platform-androidnode_modulesexecaindex.js:194:17)
at build (C:UsersuserDocumentsmadeeasyfinalMadeEasyLearningAppViewnode_modules@react-native-communitycli-platform-androidbuildcommandsbuildAndroidindex.js:68:22)
at Object.buildAndroid [as func] (C:UsersuserDocumentsmadeeasyfinalMadeEasyLearningAppViewnode_modules@react-native-communitycli-platform-androidbuildcommandsbuildAndroidindex.js:60:10)
at Command.handleAction ...
<code>Starting Metro Bundler
warning: Bundler cache is empty, rebuilding (this may take a minute)
Error: Unable to resolve module .index.js from C:UsersuserDocumentsmadeeasyfinalMadeEasyLearningAppView/.: .index.js could not be found within the project or in these directories:
> Task :app:createBundleReleaseJsAndAssets FAILED
FAILURE: Build failed with an exception.
* What went wrong:
Execution failed for task ':app:createBundleReleaseJsAndAssets'.
> Process 'command 'cmd'' finished with non-zero exit value 1
error Failed to build the app.
Error: Command failed with exit code 1: gradlew.bat app:bundleRelease
at makeError (C:UsersuserDocumentsmadeeasyfinalMadeEasyLearningAppViewnode_modules@react-native-communitycli-platform-androidnode_modulesexecaliberror.js:60:11)
at module.exports.sync (C:UsersuserDocumentsmadeeasyfinalMadeEasyLearningAppViewnode_modules@react-native-communitycli-platform-androidnode_modulesexecaindex.js:194:17)
at build (C:UsersuserDocumentsmadeeasyfinalMadeEasyLearningAppViewnode_modules@react-native-communitycli-platform-androidbuildcommandsbuildAndroidindex.js:68:22)
at Object.buildAndroid [as func] (C:UsersuserDocumentsmadeeasyfinalMadeEasyLearningAppViewnode_modules@react-native-communitycli-platform-androidbuildcommandsbuildAndroidindex.js:60:10)
at Command.handleAction ...
</code>
Starting Metro Bundler
warning: Bundler cache is empty, rebuilding (this may take a minute)
Error: Unable to resolve module .index.js from C:UsersuserDocumentsmadeeasyfinalMadeEasyLearningAppView/.: .index.js could not be found within the project or in these directories:
> Task :app:createBundleReleaseJsAndAssets FAILED
FAILURE: Build failed with an exception.
* What went wrong:
Execution failed for task ':app:createBundleReleaseJsAndAssets'.
> Process 'command 'cmd'' finished with non-zero exit value 1
error Failed to build the app.
Error: Command failed with exit code 1: gradlew.bat app:bundleRelease
at makeError (C:UsersuserDocumentsmadeeasyfinalMadeEasyLearningAppViewnode_modules@react-native-communitycli-platform-androidnode_modulesexecaliberror.js:60:11)
at module.exports.sync (C:UsersuserDocumentsmadeeasyfinalMadeEasyLearningAppViewnode_modules@react-native-communitycli-platform-androidnode_modulesexecaindex.js:194:17)
at build (C:UsersuserDocumentsmadeeasyfinalMadeEasyLearningAppViewnode_modules@react-native-communitycli-platform-androidbuildcommandsbuildAndroidindex.js:68:22)
at Object.buildAndroid [as func] (C:UsersuserDocumentsmadeeasyfinalMadeEasyLearningAppViewnode_modules@react-native-communitycli-platform-androidbuildcommandsbuildAndroidindex.js:60:10)
at Command.handleAction ...
I do have my index.js
file in the directory C:UsersuserDocumentsmadeeasyfinalMadeEasyLearningAppViewindex.js so not sure what went wrong
What i have done
-
react-native bundle --platform android --dev false --entry-file index.js --bundle-output android/app/src/main/assets/index.android.bundle --assets-dest android/app/src/main/res
then ./gradlew assembleRelease -x bundleReleaseJsAndAssets
but I am getting Task 'bundleReleaseJsAndAssets' not found in root project
-
Disabled the enabledHermes but it still doesnt work as well
I would appreciate any help with this matter. Thank you in advance