-
-
Notifications
You must be signed in to change notification settings - Fork 1.7k
Closed
Description
Environment
✔ Component nativescript has 6.5.0 version and is up to date.
✔ Component tns-core-modules has 6.5.1 version and is up to date.
✔ Component tns-android has 6.5.0 version and is up to date.
✔ Component tns-ios has 6.5.0 version and is up to date.
Describe the bug
I run several times into the same issue and the problem is, that as soon as this issue occurs, even after undo all the code changes and restart the app the error is still there! Here is the complete error message:
System.err: An uncaught Exception occurred on "main" thread.
System.err: Unable to instantiate activity ComponentInfo{org.nativescript.testbuguncoughterror/com.tns.NativeScriptActivity}: com.tns.NativeScriptException: Failed to create JavaScript extend wrapper for class 'com/tns/NativeScriptActivity'
System.err:
System.err: StackTrace:
System.err: java.lang.RuntimeException: Unable to instantiate activity ComponentInfo{org.nativescript.testbuguncoughterror/com.tns.NativeScriptActivity}: com.tns.NativeScriptException: Failed to create JavaScript extend wrapper for class 'com/tns/NativeScriptActivity'
System.err: at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:3194)
System.err: at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:3409)
System.err: at android.app.servertransaction.LaunchActivityItem.execute(LaunchActivityItem.java:83)
System.err: at android.app.servertransaction.TransactionExecutor.executeCallbacks(TransactionExecutor.java:135)
System.err: at android.app.servertransaction.TransactionExecutor.execute(TransactionExecutor.java:95)
System.err: at android.app.ActivityThread$H.handleMessage(ActivityThread.java:2016)
System.err: at android.os.Handler.dispatchMessage(Handler.java:107)
System.err: at android.os.Looper.loop(Looper.java:214)
System.err: at android.app.ActivityThread.main(ActivityThread.java:7356)
System.err: at java.lang.reflect.Method.invoke(Native Method)
System.err: at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:492)
System.err: at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:930)
System.err: Caused by: com.tns.NativeScriptException: Failed to create JavaScript extend wrapper for class 'com/tns/NativeScriptActivity'
System.err: at com.tns.Runtime.createJSInstanceNative(Native Method)
System.err: at com.tns.Runtime.createJSInstance(Runtime.java:820)
System.err: at com.tns.Runtime.initInstance(Runtime.java:793)
System.err: at com.tns.NativeScriptActivity.<init>(NativeScriptActivity.java:13)
System.err: at java.lang.Class.newInstance(Native Method)
System.err: at android.app.AppComponentFactory.instantiateActivity(AppComponentFactory.java:95)
System.err: at androidx.core.app.CoreComponentFactory.instantiateActivity(CoreComponentFactory.java:43)
System.err: at android.app.Instrumentation.newActivity(Instrumentation.java:1243)
System.err: at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:3182)
System.err: ... 11 more
Successfully synced application org.nativescript.testbuguncoughterror on device emulator-5554.
To Reproduce
Here are the steps to create this error. The order is very important, especially of step 3-6 :
- Create a new project
tns create projectname(select:Vue.js&SideDrawer) - Go into the newly created folder and start the app with
tns run android - Move
components/App.vueinto project root and adjust the import insideapp.jstoimport App from "./App"; - Create a new folder inside project root
app/views - Move one of the component files e.g.
Browse.vueinto the newly created folder - Open
DrawerContent.vuewith VSCode, clickCTRL+Hto find and replace every line of code which containsBrowsewith e.g.Projects. Save the file, so that a change is detected! - Now rename
views/Browse.vueintoviews/Projects.vue
Expected behavior
Run the projects without errors
Sample project
https://github.com/baermathias/bug-reproduction-nativescript
Additional context
- Sometimes step 7 is not necessary
- Sometimes the problem does not appear if step 3 is not done
- Also it might be that the error doesn't appear if you manage to edit Browse.vue before step 6 and rename
SelectedPageService.getInstance().updateSelectedPage("Browse");-->SelectedPageService.getInstance().updateSelectedPage("Projects");