Nativescript: Unable to create application com.tns.NativeScriptApplication: com.tns.NativeScriptException

Created on 15 Mar 2017  路  7Comments  路  Source: NativeScript/NativeScript

Im getting this when launching app on device, any clue whats going on this is version 2.5.2 tns doctor confirms everything ok, this happen on genymotion too android 6.0

An uncaught Exception occurred on "main" thread.
java.lang.RuntimeException: Unable to create application com.tns.NativeScriptApplication: com.tns.NativeScriptException: 

Error calling module function 

Error: com.tns.NativeScriptException: Failed to find module: "application", relative to: app/tns_modules/
    com.tns.Module.resolvePathHelper(Module.java:159)
    com.tns.Module.resolvePath(Module.java:60)
    com.tns.Runtime.runModule(Native Method)
    com.tns.Runtime.runModule(Runtime.java:580)
    com.tns.Runtime.run(Runtime.java:574)
    com.tns.NativeScriptApplication.onCreate(NativeScriptApplication.java:17)
    android.app.Instrumentation.callApplicationOnCreate(Instrumentation.java:1014)
    android.app.ActivityThread.handleBindApplication(ActivityThread.java:4821)
    android.app.ActivityThread.access$1600(ActivityThread.java:157)
    android.app.ActivityThread$H.handleMessage(ActivityThread.java:1417)
    android.os.Handler.dispatchMessage(Handler.java:102)
    android.os.Looper.loop(Looper.java:148)
    android.app.ActivityThread.main(ActivityThread.java:5551)
    java.lang.reflect.Method.invoke(Native Method)
    com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:730)
    com.android.internal.os.ZygoteInit.main(ZygoteInit.java:620)
File: "<unknown>, line: 1, column: 265

StackTrace: 
    Frame: function:'require', file:'', line: 1, column: 266
    Frame: function:'', file:'file:///data/data/org.nativescript.ThreeSK/files/app/app.js', line: 2, column: 21
    Frame: function:'require', file:'', line: 1, column: 266


Error: com.tns.NativeScriptException: Failed to find module: "application", relative to: app/tns_modules/
    com.tns.Module.resolvePathHelper(Module.java:159)
    com.tns.Module.resolvePath(Module.java:60)
    com.tns.Runtime.runModule(Native Method)
    com.tns.Runtime.runModule(Runtime.java:580)
    com.tns.Runtime.run(Runtime.java:574)
    com.tns.NativeScriptApplication.onCreate(NativeScriptApplication.java:17)
    android.app.Instrumentation.callApplicationOnCreate(Instrumentation.java:1014)
    android.app.ActivityThread.handleBindApplication(ActivityThread.java:4821)
    android.app.ActivityThread.access$1600(ActivityThread.java:157)
    android.app.ActivityThread$H.handleMessage(ActivityThread.java:1417)
    android.os.Handler.dispatchMessage(Handler.java:102)
    android.os.Looper.loop(Looper.java:148)
    android.app.ActivityThread.main(ActivityThread.java:5551)
    java.lang.reflect.Method.invoke(Native Method)
    com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:730)
    com.android.internal.os.ZygoteInit.main(ZygoteInit.java:620)
File: "<unknown>, line: 1, column: 265

StackTrace: 
    Frame: function:'require', file:'', line: 1, column: 266
    Frame: function:'', file:'file:///data/data/org.nativescript.ThreeSK/files/app/app.js', line: 2, column: 21
    Frame: function:'require', file:'', line: 1, column: 266


    at android.app.ActivityThread.handleBindApplication(ActivityThread.java:4824)
    at android.app.ActivityThread.access$1600(ActivityThread.java:157)
    at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1417)
    at android.os.Handler.dispatchMessage(Handler.java:102)
    at android.os.Looper.loop(Looper.java:148)
    at android.app.ActivityThread.main(ActivityThread.java:5551)
    at java.lang.reflect.Method.invoke(Native Method)
    at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:730)
    at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:620)
Caused by: com.tns.NativeScriptException: 

Error calling module function 

Error: com.tns.NativeScriptException: Failed to find module: "application", relative to: app/tns_modules/
    com.tns.Module.resolvePathHelper(Module.java:159)
    com.tns.Module.resolvePath(Module.java:60)
    com.tns.Runtime.runModule(Native Method)
    com.tns.Runtime.runModule(Runtime.java:580)
    com.tns.Runtime.run(Runtime.java:574)
    com.tns.NativeScriptApplication.onCreate(NativeScriptApplication.java:17)
    android.app.Instrumentation.callApplicationOnCreate(Instrumentation.java:1014)
    android.app.ActivityThread.handleBindApplication(ActivityThread.java:4821)
    android.app.ActivityThread.access$1600(ActivityThread.java:157)
    android.app.ActivityThread$H.handleMessage(ActivityThread.java:1417)
    android.os.Handler.dispatchMessage(Handler.java:102)
    android.os.Looper.loop(Looper.java:148)
    android.app.ActivityThread.main(ActivityThread.java:5551)
    java.lang.reflect.Method.invoke(Native Method)
    com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:730)
    com.android.internal.os.ZygoteInit.main(ZygoteInit.java:620)
File: "<unknown>, line: 1, column: 265

StackTrace: 
    Frame: function:'require', file:'', line: 1, column: 266
    Frame: function:'', file:'file:///data/data/org.nativescript.ThreeSK/files/app/app.js', line: 2, column: 21
    Frame: function:'require', file:'', line: 1, column: 266


Error: com.tns.NativeScriptException: Failed to find module: "application", relative to: app/tns_modules/
    com.tns.Module.resolvePathHelper(Module.java:159)
    com.tns.Module.resolvePath(Module.java:60)
    com.tns.Runtime.runModule(Native Method)
    com.tns.Runtime.runModule(Runtime.java:580)
    com.tns.Runtime.run(Runtime.java:574)
    com.tns.NativeScriptApplication.onCreate(NativeScriptApplication.java:17)
    android.app.Instrumentation.callApplicationOnCreate(Instrumentation.java:1014)
    android.app.ActivityThread.handleBindApplication(ActivityThread.java:4821)
    android.app.ActivityThread.access$1600(ActivityThread.java:157)
    android.app.ActivityThread$H.handleMessage(ActivityThread.java:1417)
    android.os.Handler.dispatchMessage(Handler.java:102)
    android.os.Looper.loop(Looper.java:148)
    android.app.ActivityThread.main(ActivityThread.java:5551)
    java.lang.reflect.Method.invoke(Native Method)
    com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:730)
    com.android.internal.os.ZygoteInit.main(ZygoteInit.java:620)
File: "<unknown>, line: 1, column: 265

StackTrace: 
    Frame: function:'require', file:'', line: 1, column: 266
    Frame: function:'', file:'file:///data/data/org.nativescript.ThreeSK/files/app/app.js', line: 2, column: 21
    Frame: function:'require', file:'', line: 1, column: 266


    at com.tns.Runtime.runModule(Native Method)
    at com.tns.Runtime.runModule(Runtime.java:580)
    at com.tns.Runtime.run(Runtime.java:574)
    at com.tns.NativeScriptApplication.onCreate(NativeScriptApplication.java:17)
    at android.app.Instrumentation.callApplicationOnCreate(Instrumentation.java:1014)
    at android.app.ActivityThread.handleBindApplication(ActivityThread.java:4821)
    ... 8 more
question

Most helpful comment

Hi @AhmedAzzabi,

Try to delete node_modules, platforms and hooks folders. You should also remove the app from the device or emulator.
Then rebuild your project with tns run android command.
If you still have an issue with building the app, please provide some more info about your environment(CLI, node versions);

All 7 comments

Hi @AhmedAzzabi,

Try to delete node_modules, platforms and hooks folders. You should also remove the app from the device or emulator.
Then rebuild your project with tns run android command.
If you still have an issue with building the app, please provide some more info about your environment(CLI, node versions);

Thank you that fixed the problem ! you rock guys !

@tsonevn Thank you! had the same issue and your solution works.

i tried @tsonevn what you asked. But it is not working for me

Hi @Mubashir-Mohamed,
Please provide more info about your problem. It would help if you send us the exact error, which you are facing as well as the steps, which you used while building the app.

Also provide an more info about your environment(CLI, tns-core-modules, tns-android versions).

I tried the same steps but still getting error Please help @tsonevn
Here is my repository link
https://github.com/usmanakram1996/conFusion_native

This thread has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

NickIliev picture NickIliev  路  3Comments

OscarLopezArnaiz picture OscarLopezArnaiz  路  3Comments

vtisnado picture vtisnado  路  3Comments

dhanalakshmitawwa picture dhanalakshmitawwa  路  3Comments

kn9ts picture kn9ts  路  3Comments