nativescript-cli
nativescript-cli copied to clipboard
Unable to preview android 'hello world' app --android
I was following the 'tutorial/instructions' for creating a new project, from template.
Used the command ns create HelloWorld --template @nativescript/template-hello-world-ts
Did clean, and then did preview.
Everything looks to work correctly, except when it tries to open on my device, it crashes. I believe it is due to the line that talks about local plugin is 8.0.0 and preview app is only 6.5.0.... but i have yet to successfully figure out how to run things locally (I can utilize the online playground without issue).
If you have any ideas what is causing this, or more specifically how to fix it, please let me know. I'm just trying to see how to start a project at this point, and would like to be able to test along the way as i learn. Slightly concerning if the preview app doesn't even work with the included hello world tutorials.
This is the cmd log:
`Platform android successfully added. v8.0.0
Preparing project...
webpack is watching the files...* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
asset vendor.js 5.66 MiB [emitted] (name: vendor) (id hint: defaultVendor) *
asset bundle.js 436 KiB [emitted] (name: bundle)plugins with native dependencies. *
Entrypoint bundle 6.09 MiB = vendor.js 5.66 MiB bundle.js 436 KiBtns preview. Please, use $ tns run
-
*
- In the app are used one or more NativeScript plugins with native dependencies. *
- Those plugins will not work while building the project via $ tns preview. Please, use $ tns run
command instead. * -
*
-
*
- The platforms/android folder appears to be invalid. If the build fails, run 'ns clean' and rebuild the app. *
-
*
Preparing project... Updating runtime package.json with configuration values... Project successfully prepared (android) Start sending initial files for device Galaxy S9+ (787634b7-220b-419c-b209-89bf92a15a3c). Successfully sent initial files for device Galaxy S9+ (787634b7-220b-419c-b209-89bf92a15a3c). LOG from device Galaxy S9+: An uncaught Exception occurred on "main" thread. Unable to start activity ComponentInfo{org.nativescript.preview/com.tns.NativeScriptActivity}: com.tns.NativeScriptException: Calling js method onCreate failed Error: Failed to load component from module: app-root
StackTrace: java.lang.RuntimeException: Unable to start activity ComponentInfo{org.nativescript.preview/com.tns.NativeScriptActivity}: com.tns.NativeScriptException: Calling js method onCreate failed Error: Failed to load component from module: app-root at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:3654) at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:3806) at android.app.servertransaction.LaunchActivityItem.execute(LaunchActivityItem.java:83) at android.app.servertransaction.TransactionExecutor.executeCallbacks(TransactionExecutor.java:135) at android.app.servertransaction.TransactionExecutor.execute(TransactionExecutor.java:95) at android.app.ActivityThread$H.handleMessage(ActivityThread.java:2267) at android.os.Handler.dispatchMessage(Handler.java:107) at android.os.Looper.loop(Looper.java:237) at android.app.ActivityThread.main(ActivityThread.java:8167) at java.lang.reflect.Method.invoke(Native Method) at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:496) at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1100) Caused by: com.tns.NativeScriptException: Calling js method onCreate failed Error: Failed to load component from module: app-root at com.tns.Runtime.callJSMethodNative(Native Method) at com.tns.Runtime.dispatchCallJSMethodNative(Runtime.java:1286) at com.tns.Runtime.callJSMethodImpl(Runtime.java:1173) at com.tns.Runtime.callJSMethod(Runtime.java:1160) at com.tns.Runtime.callJSMethod(Runtime.java:1138) at com.tns.Runtime.callJSMethod(Runtime.java:1134) at com.tns.NativeScriptActivity.onCreate(NativeScriptActivity.java:20) at android.app.Activity.performCreate(Activity.java:7963) at android.app.Activity.performCreate(Activity.java:7952) at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1307) at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:3629) ... 11 more`
I think the preview app currently does not support "@nativescript/core" : "8.0.0"
yet.
You could connect your android device to your computer via USB and run the app with ns run android
NativeScript Playground app looks abandoned. Currently its version marked 24 july 2019...
Then they should update all the beginner documentation or fix it!!!!! instead of wasting my time!!!
NativeScript Preview 2.0 has been released: https://preview.nativescript.org/