Unable to create app when .apk is installed


#1

Hi!

I am making an app using Angular, and when I build the app with my device connected or with an emulator the app works perfect. But, when I copy the .apk to install it in another device it shows the next error after install it and try to open it:

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 calling module function

Error calling module function

Error calling module function

Error: com.tns.NativeScriptException: Failed to find module: “…/_services/api.service”, relative to: app/home/
com.tns.Module.resolvePathHelper(Module.java:146)
com.tns.Module.resolvePath(Module.java:55)
com.tns.Runtime.runModule(Native Method)
com.tns.Runtime.runModule(Runtime.java:530)
com.tns.Runtime.run(Runtime.java:522)
com.tns.NativeScriptApplication.onCreate(NativeScriptApplication.java:19)
android.app.Instrumentation.callApplicationOnCreate(Instrumentation.java:1024)
android.app.ActivityThread.handleBindApplication(ActivityThread.java:5503)
android.app.ActivityThread.-wrap2(ActivityThread.java)
android.app.ActivityThread$H.handleMessage(ActivityThread.java:1595)
android.os.Handler.dispatchMessage(Handler.java:110)
android.os.Looper.loop(Looper.java:203)
android.app.ActivityThread.main(ActivityThread.java:6251)
java.lang.reflect.Method.invoke(Native Method)
com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:1075)
com.android.internal.os.ZygoteInit.main(ZygoteInit.java:936)
File: ", line: 1, column: 265

StackTrace:
Frame: function:‘require’, file:’’, line: 1, column: 266
Frame: function:’’, file:‘file:///data/data/org.nativescript.ChupitosUser/files/app/home/home.component.js’, line: 5, column: 21
Frame: function:‘require’, file:’’, line: 1, column: 266
Frame: function:’’, file:‘file:///data/data/org.nativescript.ChupitosUser/files/app/app.routing.js’, line: 7, column: 24
Frame: function:‘require’, file:’’, line: 1, column: 266
Frame: function:’’, file:‘file:///data/data/org.nativescript.ChupitosUser/files/app/app.module.js’, line: 5, column: 21
Frame: function:‘require’, file:’’, line: 1, column: 266
Frame: function:’’, file:‘file:///data/data/org.nativescript.ChupitosUser/files/app/main.js’, line: 6, column: 20
Frame: function:‘require’, file:’’, line: 1, column: 266

Any help is appreciated!


#2

Need more info.
How are you building this apk?


#3

I build it with:

tns build android

It makes all the process successfully, and then when I want to test it I use:

tns run android

It works perfect with an emulator and with my device connected. The problem is when I copy the .apk and send it to another device. Please let me know if more information is needed


#4

Which is the “another device”?
Please specify android version and name of that device.


#5

Why are there three dots there?


#6

Found solution to your problem.
Rename _services to services, also update all relevant paths. that should solve the problem.