I built an expo app and in the development it works fine (I'm using expo run:android
to run the app), but when I generated the apk and installed it's doesn't work. The app never load, just show the expo screen. Anyone know what's happening here?
app.json:
{
"expo": {
"name": "sleeper-app",
"slug": "sleeper-app",
"version": "1.0.0",
"orientation": "portrait",
"icon": "./assets/icon.png",
"userInterfaceStyle": "light",
"splash": {
"image": "./assets/splash.png",
"resizeMode": "contain",
"backgroundColor": "#ffffff"
},
"updates": {
"fallbackToCacheTimeout": 0
},
"assetBundlePatterns": [
"**/*"
],
"ios": {
"supportsTablet": true
},
"android": {
"adaptiveIcon": {
"foregroundImage": "./assets/adaptive-icon.png",
"backgroundColor": "#FFFFFF"
},
"package": "com.antiduhring.sleeperapp"
},
"web": {
"favicon": "./assets/favicon.png"
}
}
}
logcat:
06-30 17:36:28.964 13688 14145 W System.err: java.io.FileNotFoundException: shell-app-manifest.json
06-30 17:36:28.965 13688 14145 W System.err: at android.content.res.AssetManager.nativeOpenAsset(Native Method)
06-30 17:36:28.965 13688 14145 W System.err: at android.content.res.AssetManager.open(AssetManager.java:875)
06-30 17:36:28.965 13688 14145 W System.err: at android.content.res.AssetManager.open(AssetManager.java:852)
06-30 17:36:28.965 13688 14145 W System.err: at versioned.host.exp.exponent.modules.universal.ScopedFileSystemModule.getBundledAssets(ScopedFileSystemModule.kt:2)
06-30 17:36:28.965 13688 14145 W System.err: at versioned.host.exp.exponent.modules.universal.ScopedFileSystemModule.getConstants(ScopedFileSystemModule.kt:2)
06-30 17:36:28.965 13688 14145 W System.err: at expo.modules.adapters.react.NativeModulesProxy.getConstants(NativeModulesProxy.java:9)
06-30 17:36:28.965 13688 14145 W System.err: at com.facebook.react.bridge.JavaModuleWrapper.getConstants(JavaModuleWrapper.java:14)
06-30 17:36:28.965 13688 14145 W System.err: at com.facebook.react.bridge.queue.NativeRunnable.run(Native Method)
06-30 17:36:28.965 13688 14145 W System.err: at android.os.Handler.handleCallback(Handler.java:883)
06-30 17:36:28.965 13688 14145 W System.err: at android.os.Handler.dispatchMessage(Handler.java:100)
06-30 17:36:28.965 13688 14145 W System.err: at com.facebook.react.bridge.queue.MessageQueueThreadHandler.dispatchMessage(MessageQueueThreadHandler.java:1)
06-30 17:36:28.965 13688 14145 W System.err: at android.os.Looper.loop(Looper.java:237)
06-30 17:36:28.965 13688 14145 W System.err: at com.facebook.react.bridge.queue.MessageQueueThreadImpl$4.run(MessageQueueThreadImpl.java:8)
06-30 17:36:28.965 13688 14145 W System.err: at java.lang.Thread.run(Thread.java:919)
06-30 17:36:28.982 13688 14145 D i : WARNING: getPackageName called on ScopedContext
06-30 17:36:29.157 13688 14145 E ReactNativeJS: TypeError: null is not an object (evaluating 't.RATING_HEART')
06-30 17:36:29.166 13688 14145 I ReactNativeJS: Running "main
06-30 17:36:29.169 13688 14145 E ReactNativeJS: Invariant Violation: "main" has not been registered. This can happen if:
06-30 17:36:29.169 13688 14145 E ReactNativeJS: * Metro (the local dev server) is run from the wrong folder. Check if Metro is running, stop it and restart it in the current project.
06-30 17:36:29.169 13688 14145 E ReactNativeJS: * A module failed to load due to an error and `AppRegistry.registerComponent` wasn't called.
06-30 17:36:29.171 13688 14146 W System.err: java.lang.reflect.InvocationTargetException
06-30 17:36:29.171 13688 14146 W System.err: at java.lang.reflect.Method.invoke(Native Method)
06-30 17:36:29.171 13688 14146 W System.err: at com.facebook.react.bridge.DefaultNativeModuleCallExceptionHandler.handleException(DefaultNativeModuleCallExceptionHandler.java:4)
06-30 17:36:29.171 13688 14146 W System.err: at com.facebook.react.devsupport.DisabledDevSupportManager.handleException(DisabledDevSupportManager.java:1)
06-30 17:36:29.171 13688 14146 W System.err: at com.facebook.react.bridge.CatalystInstanceImpl.onNativeException(CatalystInstanceImpl.java:1)
06-30 17:36:29.171 13688 14146 W System.err: at com.facebook.react.bridge.CatalystInstanceImpl.access$1100(CatalystInstanceImpl.java:1)
06-30 17:36:29.171 13688 14146 W System.err: at com.facebook.react.bridge.CatalystInstanceImpl$NativeExceptionHandler.handleException(CatalystInstanceImpl.java:1)
06-30 17:36:29.171 13688 14146 W System.err: at com.facebook.react.bridge.queue.MessageQueueThreadHandler.dispatchMessage(MessageQueueThreadHandler.java:2)
06-30 17:36:29.171 13688 14146 W System.err: at android.os.Looper.loop(Looper.java:237)
06-30 17:36:29.171 13688 14146 W System.err: at com.facebook.react.bridge.queue.MessageQueueThreadImpl$4.run(MessageQueueThreadImpl.java:8)
06-30 17:36:29.171 13688 14146 W System.err: at java.lang.Thread.run(Thread.java:919)
06-30 17:36:29.172 13688 14146 W System.err: Caused by: com.facebook.react.common.JavascriptException: TypeError: null is not an object (evaluating 't.RATING_HEART'), stack:
06-30 17:36:29.172 13688 14146 W System.err: <unknown>@723:1143
06-30 17:36:29.172 13688 14146 W System.err: <unknown>@723:1407
06-30 17:36:29.172 13688 14146 W System.err: h@2:1585
06-30 17:36:29.172 13688 14146 W System.err: <unknown>@722:1821
06-30 17:36:29.172 13688 14146 W System.err: h@2:1585
06-30 17:36:29.172 13688 14146 W System.err: <unknown>@720:415
06-30 17:36:29.172 13688 14146 W System.err: h@2:1585
06-30 17:36:29.172 13688 14146 W System.err: <unknown>@6:69
06-30 17:36:29.172 13688 14146 W System.err: h@2:1585
06-30 17:36:29.172 13688 14146 W System.err: d@2:958
06-30 17:36:29.172 13688 14146 W System.err: global code@1105:3
06-30 17:36:29.172 13688 14146 W System.err: at host.exp.exponent.ReactNativeStaticHelpers.handleReactNativeError(ReactNativeStaticHelpers.kt:5)
06-30 17:36:29.172 13688 14146 W System.err: ... 10 more
06-30 17:36:29.176 13688 14146 W System.err: java.lang.reflect.InvocationTargetException
06-30 17:36:29.177 13688 14146 W System.err: at java.lang.reflect.Method.invoke(Native Method)
06-30 17:36:29.177 13688 14146 W System.err: at com.facebook.react.bridge.DefaultNativeModuleCallExceptionHandler.handleException(DefaultNativeModuleCallExceptionHandler.java:4)
06-30 17:36:29.177 13688 14146 W System.err: at com.facebook.react.devsupport.DisabledDevSupportManager.handleException(DisabledDevSupportManager.java:1)
06-30 17:36:29.177 13688 14146 W System.err: at com.facebook.react.bridge.CatalystInstanceImpl.onNativeException(CatalystInstanceImpl.java:1)
06-30 17:36:29.177 13688 14146 W System.err: at com.facebook.react.bridge.CatalystInstanceImpl.access$1100(CatalystInstanceImpl.java:1)
06-30 17:36:29.177 13688 14146 W System.err: at com.facebook.react.bridge.CatalystInstanceImpl$NativeExceptionHandler.handleException(CatalystInstanceImpl.java:1)
06-30 17:36:29.177 13688 14146 W System.err: at com.facebook.react.bridge.queue.MessageQueueThreadHandler.dispatchMessage(MessageQueueThreadHandler.java:2)
06-30 17:36:29.177 13688 14146 W System.err: at android.os.Looper.loop(Looper.java:237)
06-30 17:36:29.177 13688 14146 W System.err: at com.facebook.react.bridge.queue.MessageQueueThreadImpl$4.run(MessageQueueThreadImpl.java:8)
06-30 17:36:29.177 13688 14146 W System.err: at java.lang.Thread.run(Thread.java:919)
06-30 17:36:29.177 13688 14146 W System.err: Caused by: com.facebook.react.common.JavascriptException: Invariant Violation: "main" has not been registered. This can happen if:
06-30 17:36:29.177 13688 14146 W System.err: * Metro (the local dev server) is run from the wrong folder. Check if Metro is running, stop it and restart it in the current project.
06-30 17:36:29.177 13688 14146 W System.err: * A module failed to load due to an error and `AppRegistry.registerComponent` wasn't called., stack:
06-30 17:36:29.177 13688 14146 W System.err: exports@12:289
06-30 17:36:29.177 13688 14146 W System.err: runApplication@337:2081
06-30 17:36:29.177 13688 14146 W System.err: value@58:3579
06-30 17:36:29.177 13688 14146 W System.err: <unknown>@58:758
06-30 17:36:29.177 13688 14146 W System.err: value@58:2582
06-30 17:36:29.177 13688 14146 W System.err: value@58:730
06-30 17:36:29.177 13688 14146 W System.err: value@-1
06-30 17:36:29.177 13688 14146 W System.err: at host.exp.exponent.ReactNativeStaticHelpers.handleReactNativeError(ReactNativeStaticHelpers.kt:5)
06-30 17:36:29.177 13688 14146 W System.err: ... 10 more
06-30 17:36:29.195 13688 14146 E unknown:ReactContextBaseJavaModule: Unhandled SoftException
06-30 17:36:29.195 13688 14146 E unknown:ReactContextBaseJavaModule: java.lang.RuntimeException: Catalyst Instance has already disappeared: requested by DeviceInfo
06-30 17:36:29.195 13688 14146 E unknown:ReactContextBaseJavaModule: at com.facebook.react.bridge.ReactContextBaseJavaModule.getReactApplicationContextIfActiveOrWarn(ReactContextBaseJavaModule.java:4)
06-30 17:36:29.195 13688 14146 E unknown:ReactContextBaseJavaModule: at com.facebook.react.modules.deviceinfo.DeviceInfoModule.invalidate(DeviceInfoModule.java:2)
06-30 17:36:29.195 13688 14146 E unknown:ReactContextBaseJavaModule: at com.facebook.react.bridge.ModuleHolder.destroy(ModuleHolder.java:2)
06-30 17:36:29.195 13688 14146 E unknown:ReactContextBaseJavaModule: at com.facebook.react.bridge.NativeModuleRegistry.notifyJSInstanceDestroy(NativeModuleRegistry.java:4)
06-30 17:36:29.195 13688 14146 E unknown:ReactContextBaseJavaModule: at com.facebook.react.bridge.CatalystInstanceImpl$1.run(CatalystInstanceImpl.java:1)
06-30 17:36:29.195 13688 14146 E unknown:ReactContextBaseJavaModule: at android.os.Handler.handleCallback(Handler.java:883)
06-30 17:36:29.195 13688 14146 E unknown:ReactContextBaseJavaModule: at android.os.Handler.dispatchMessage(Handler.java:100)
06-30 17:36:29.195 13688 14146 E unknown:ReactContextBaseJavaModule: at com.facebook.react.bridge.queue.MessageQueueThreadHandler.dispatchMessage(MessageQueueThreadHandler.java:1)
06-30 17:36:29.195 13688 14146 E unknown:ReactContextBaseJavaModule: at android.os.Looper.loop(Looper.java:237)
06-30 17:36:29.195 13688 14146 E unknown:ReactContextBaseJavaModule: at com.facebook.react.bridge.queue.MessageQueueThreadImpl$4.run(MessageQueueThreadImpl.java:8)
06-30 17:36:29.195 13688 14146 E unknown:ReactContextBaseJavaModule: at java.lang.Thread.run(Thread.java:919)
06-30 17:36:29.197 13688 14146 E unknown:ReactContextBaseJavaModule: Unhandled SoftException
06-30 17:36:29.197 13688 14146 E unknown:ReactContextBaseJavaModule: java.lang.RuntimeException: Catalyst Instance has already disappeared: requested by NativeAnimatedModule
06-30 17:36:29.197 13688 14146 E unknown:ReactContextBaseJavaModule: at com.facebook.react.bridge.ReactContextBaseJavaModule.getReactApplicationContextIfActiveOrWarn(ReactContextBaseJavaModule.java:4)
06-30 17:36:29.197 13688 14146 E unknown:ReactContextBaseJavaModule: at com.facebook.react.animated.NativeAnimatedModule.invalidate(NativeAnimatedModule.java:1)
06-30 17:36:29.197 13688 14146 E unknown:ReactContextBaseJavaModule: at com.facebook.react.bridge.ModuleHolder.destroy(ModuleHolder.java:2)
06-30 17:36:29.197 13688 14146 E unknown:ReactContextBaseJavaModule: at com.facebook.react.bridge.NativeModuleRegistry.notifyJSInstanceDestroy(NativeModuleRegistry.java:4)
06-30 17:36:29.197 13688 14146 E unknown:ReactContextBaseJavaModule: at com.facebook.react.bridge.CatalystInstanceImpl$1.run(CatalystInstanceImpl.java:1)
06-30 17:36:29.197 13688 14146 E unknown:ReactContextBaseJavaModule: at android.os.Handler.handleCallback(Handler.java:883)
06-30 17:36:29.197 13688 14146 E unknown:ReactContextBaseJavaModule: at android.os.Handler.dispatchMessage(Handler.java:100)
06-30 17:36:29.197 13688 14146 E unknown:ReactContextBaseJavaModule: at com.facebook.react.bridge.queue.MessageQueueThreadHandler.dispatchMessage(MessageQueueThreadHandler.java:1)
06-30 17:36:29.197 13688 14146 E unknown:ReactContextBaseJavaModule: at android.os.Looper.loop(Looper.java:237)
06-30 17:36:29.197 13688 14146 E unknown:ReactContextBaseJavaModule: at com.facebook.react.bridge.queue.MessageQueueThreadImpl$4.run(MessageQueueThreadImpl.java:8)
06-30 17:36:29.197 13688 14146 E unknown:ReactContextBaseJavaModule: at java.lang.Thread.run(Thread.java:919)
06-30 17:36:29.197 13688 14146 E unknown:ReactContextBaseJavaModule: Unhandled SoftException
06-30 17:36:29.197 13688 14146 E unknown:ReactContextBaseJavaModule: java.lang.RuntimeException: Catalyst Instance has already disappeared: requested by FrescoModule
06-30 17:36:29.197 13688 14146 E unknown:ReactContextBaseJavaModule: at com.facebook.react.bridge.ReactContextBaseJavaModule.getReactApplicationContextIfActiveOrWarn(ReactContextBaseJavaModule.java:4)
06-30 17:36:29.197 13688 14146 E unknown:ReactContextBaseJavaModule: at com.facebook.react.modules.fresco.FrescoModule.invalidate(FrescoModule.java:2)
06-30 17:36:29.197 13688 14146 E unknown:ReactContextBaseJavaModule: at com.facebook.react.bridge.ModuleHolder.destroy(ModuleHolder.java:2)
06-30 17:36:29.197 13688 14146 E unknown:ReactContextBaseJavaModule: at com.facebook.react.bridge.NativeModuleRegistry.notifyJSInstanceDestroy(NativeModuleRegistry.java:4)
06-30 17:36:29.197 13688 14146 E unknown:ReactContextBaseJavaModule: at com.facebook.react.bridge.CatalystInstanceImpl$1.run(CatalystInstanceImpl.java:1)
06-30 17:36:29.197 13688 14146 E unknown:ReactContextBaseJavaModule: at android.os.Handler.handleCallback(Handler.java:883)
06-30 17:36:29.197 13688 14146 E unknown:ReactContextBaseJavaModule: at android.os.Handler.dispatchMessage(Handler.java:100)
06-30 17:36:29.197 13688 14146 E unknown:ReactContextBaseJavaModule: at com.facebook.react.bridge.queue.MessageQueueThreadHandler.dispatchMessage(MessageQueueThreadHandler.java:1)
06-30 17:36:29.197 13688 14146 E unknown:ReactContextBaseJavaModule: at android.os.Looper.loop(Looper.java:237)
06-30 17:36:29.197 13688 14146 E unknown:ReactContextBaseJavaModule: at com.facebook.react.bridge.queue.MessageQueueThreadImpl$4.run(MessageQueueThreadImpl.java:8)
06-30 17:36:29.197 13688 14146 E unknown:ReactContextBaseJavaModule: at java.lang.Thread.run(Thread.java:919)
CodePudding user response:
Seems like after conversation with you index.bundle is not created
do this in same order
cd android
./gradlew clean
cd..
after cd paste code below:
react-native bundle --platform android --dev false --entry-file index.android.js --bundle-output android/app/src/main/assets/index.android.bundle --assets-dest android/app/build/intermediates/res/merged/release/
after that
cd android
./gradlew bundleRelease (not apk if you want to deploy to google play store)
cd ..
react-native run-android --variant=release
CodePudding user response:
Update: Something was wrong with a specific package that I used (react-native-track-player), it only worked with the repositore jcenter()
declared inside the build.gradle, but they updated the package and now it works fine.