Nativescript-vue of create project run occurring error java.lang.RuntimeException: Unable to create application com.tns.NativeScriptApplication: com.tns.NativeScriptException:


#1

java.lang.RuntimeException: Unable to create application com.tns.NativeScriptApplication: com.tns.NativeScriptException:

error info :

Successfully synced application com.im.zlpopo on device emulator-5554.
ActivityManager: Start proc 8758:com.im.zlpopo/u0a67 for activity com.im.zlpopo/com.tns.NativeScriptActivity
System.err: java.lang.RuntimeException: Unable to create application com.tns.NativeScriptApplication: com.tns.NativeScriptException:
System.err: Cannot compile /data/data/com.im.zlpopo/files/app/main.js
System.err: SyntaxError: Unexpected identifier
System.err: File: "file:///data/data/com.im.zlpopo/files/app/main.js, line: 1, column: 67
System.err: StackTrace:
System.err: Frame: function:‘require’, file:’’, line: 1, column: 266
System.err: SyntaxError: Unexpected identifier
System.err: File: ", line: 1, column: 265
System.err: StackTrace:
System.err: Frame: function:‘require’, file:’’, line: 1, column: 266
System.err: at android.app.ActivityThread.handleBindApplication(ActivityThread.java:4710)
System.err: at android.app.ActivityThread.-wrap1(ActivityThread.java)
System.err: at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1405)
System.err: at android.os.Handler.dispatchMessage(Handler.java:102)
System.err: at android.os.Looper.loop(Looper.java:148)
System.err: at android.app.ActivityThread.main(ActivityThread.java:5417)
System.err: at java.lang.reflect.Method.invoke(Native Method)
System.err: at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:726)
System.err: at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:616)
System.err: Caused by: com.tns.NativeScriptException:
System.err: Cannot compile /data/data/com.im.zlpopo/files/app/main.js
System.err: SyntaxError: Unexpected identifier
System.err: File: "file:///data/data/com.im.zlpopo/files/app/main.js, line: 1, column: 67
System.err: StackTrace:
System.err: Frame: function:‘require’, file:’’, line: 1, column: 266
System.err: SyntaxError: Unexpected identifier
System.err: File: ", line: 1, column: 265
System.err: StackTrace:
System.err: Frame: function:‘require’, file:’’, line: 1, column: 266
System.err: at com.tns.Runtime.runModule(Native Method)
System.err: at com.tns.Runtime.runModule(Runtime.java:553)
System.err: at com.tns.Runtime.run(Runtime.java:545)
System.err: at com.tns.NativeScriptApplication.onCreate(NativeScriptApplication.java:21)
System.err: at android.app.Instrumentation.callApplicationOnCreate(Instrumentation.java:1013)
System.err: at android.app.ActivityThread.handleBindApplication(ActivityThread.java:4707)
System.err: … 8 more
ActivityManager: Process com.im.zlpopo (pid 8758) has died



#2

That looks something related to your code, would you mind sharing it?


#4

of course can ,my project is new create , May not be useful to you .

code url:


#6

Just fixed it on my end. If your tns doctor shows everything is okay, it might be because you’re using NativeScript + another framework. Therefore, run
tns run android --bundle
The --bundle compiles your vue/angular/etc files with webpack. Hope this fixes your problem!


#7

it may be an environmental issue