nodejs-mobile / nodejs-mobile-react-native

Node.js for Mobile Apps React Native plugin
https://nodejs-mobile.github.io
MIT License
171 stars 41 forks source link

React Native It Force close Application #77

Open pranavithape opened 2 months ago

pranavithape commented 2 months ago

BUILD SUCCESSFUL in 1m 37s 70 actionable tasks: 10 executed, 60 up-to-date info Connecting to the development server... 8081 info Starting the app on "emulator-5554"... Starting: Intent { act=android.intent.action.MAIN cat=[android.intent.category.LAUNCHER] cmp=com.appnamet/.MainActivity }

after showing this in terminal app opens instant in emulator and then closes instantly

staltz commented 1 month ago

Can you provide more details?

For instance, using adb logcat, you can see more logs, and about the same time it crashes there should be some error in the log related to Node.js Mobile.

Priyanshu-psiborg commented 3 weeks ago

@staltz I am also facing the same problem, here are some logs from the logcat

2024-08-26 15:20:49.734 31108-31108 om.file_sharin          com.file_sharing                     W  Accessing hidden field Landroid/widget/ScrollView;->mScroller:Landroid/widget/OverScroller; (greylist, reflection, allowed)
2024-08-26 15:20:50.311 31108-31205 libc                    com.file_sharing                     E  Access denied finding property "vendor.debug.drm.logv"
2024-08-26 15:20:50.312 31108-31205 libc                    com.file_sharing                     E  Access denied finding property "vendor.debug.drm.logv"
2024-08-26 15:20:50.313 31108-31205 libc                    com.file_sharing                     E  Access denied finding property "vendor.debug.drm.logd"
2024-08-26 15:20:50.313 31108-31205 libc                    com.file_sharing                     E  Access denied finding property "vendor.debug.drm.logv"
2024-08-26 15:20:50.649 31108-31195 nodejs                  com.file_sharing                     E  node:internal/modules/cjs/loader:1080 (Ask Gemini)
                                                                                                      throw err;
                                                                                                      ^

                                                                                                    Error: Cannot find module '/data/user/0/com.file_sharing/files/nodejs-project/main.js'
                                                                                                        at Module._resolveFilename (node:internal/modules/cjs/loader:1077:15)
                                                                                                        at Module._load (node:internal/modules/cjs/loader:922:27)
                                                                                                        at Function.executeUserEntryPoint [as runMain] (node:internal/modules/run_main:81:12)
                                                                                                        at node:internal/main/run_main_module:23:47 {
                                                                                                      code: 'MODULE_NOT_FOUND',
                                                                                                      requireStack: []
                                                                                                    }
2024-08-26 15:20:50.650 31108-31195 nodejs                  com.file_sharing                     E  Node.js v18.17.1
2024-08-26 15:20:50.786   952-1031  InputDispatcher         system_server                        E  channel 'd011b84 com.file_sharing/com.file_sharing.MainActivity (server)' ~ Channel is unrecoverably broken and will be disposed!

React-native info:

npx react-native doctor
Common
 ✓ Node.js - Required to execute JavaScript code
 ✓ npm - Required to install NPM dependencies
 ✓ Watchman - Used for watching changes in the filesystem when in development mode
 ✓ Metro - Required for bundling the JavaScript code

Android
 ✓ Adb - Required to verify if the android device is attached correctly
 ✓ JDK - Required to compile Java code
 ✓ Android Studio - Required for building and installing your app on Android
 ✓ ANDROID_HOME - Environment variable that points to your Android SDK installation
 ✓ Gradlew - Build tool required for Android builds
 ✖ Android SDK - Required for building and installing your app on Android
   - Versions found: N/A
   - Version supported: 34.0.0

iOS
 ✓ Xcode - Required for building and installing your app on iOS
 ✓ Ruby - Required for installing iOS dependencies
 ✓ CocoaPods - Required for installing iOS dependencies
 ✓ ios-deploy - Required for installing your app on a physical device with the CLI
 ✓ .xcode.env - File to customize Xcode environment
staltz commented 3 weeks ago

@Priyanshu-psiborg As the error says, it cannot find main.js, which is the entry point for your Node.js subprogram inside the mobile app. You may have done or moved the main.js somewhere such that nodejs-mobile-react-native cannot find it (thus cannot move it into the mobile app). Have you renamed sample-main.js to main.js?

Priyanshu-psiborg commented 3 weeks ago

Yes It was renamed when i tried reinstalling the module . Another thing, do we need to create whole build every time after every change ?