kurt estacion
kurt estacion

Reputation: 507

Nativescript tns run android (application is not running on device)

When i do tns run ios, all is fine but tns run android just gives me error like this. I tried both device and emulator but the same result.


i have done:


error code:

Installing on device 2744b499...
Successfully installed on device with identifier '2744b499'.
Application org.nativescript.fagck_app is not running on device 2744b499.
This issue may be caused by:
        * crash at startup (try `tns debug android --debug-brk` to check why it crashes)
        * different application identifier in your package.json and in your gradle files (check your identifier in `package.json` and in all *.gradle files in your App_Resources directory)
        * device is locked
        * manual closing of the application
Unable to apply changes on device: 2744b499. Error is: Application org.nativescript.fagck_app is not running.

Upvotes: 8

Views: 3912

Answers (10)

Alex-1999
Alex-1999

Reputation: 37

answer from https://stackoverflow.com/users/11142390/silver-daymon is cool, but this is only small parts of truth, because name "com.tns.NativeScriptApplication" hardcoded in gradle scripts and more other places

  \platforms\android\app\build\intermediates\assets\debug\app\vendor.js
  \node_modules\@nativescript\core\application\application.android.js

You can not define name in Manifest you want without changing the same name in other places

hardcoded name

Upvotes: 0

Praveen Kumar
Praveen Kumar

Reputation: 91

  • Check if Application id is same in package.json and androidMenifest.xml
  • If looks good then open android studio : Tools > AVD Manager > Wipe Data of existing device.
  • Restart the application : tns run android.

Upvotes: 0

Ricky Levi
Ricky Levi

Reputation: 7987

In my case, I ran out of disk space on my phone ... tns showed it connected to my phone and starting to install it, but then crashed with the same msg as above.

So I've started to remove apps and pictures, and it's just worked.

Because that error appeared on a brand new project (w/o any changes) and also to an app that was already done and I know it was working as it was installed already on my phone ...

Upvotes: 0

Krzysiek
Krzysiek

Reputation: 8375

I faced the same problem:

>>> ns run android
(...)
Project successfully built.
The build result is located at: /Users/krzysztof/dev/surfcloud-mobile-apps/bizApp/platforms/android/app/build/outputs/apk/debug/app-debug.apk
Installing on device ce12171cd1a920bd0d...
Successfully installed on device with identifier 'ce12171cd1a920bd0d'.
Application app.surfcloud.bizApp is not running on device ce12171cd1a920bd0d.
This issue may be caused by:
    * crash at startup (try `tns debug android --debug-brk` to check why it crashes)
    * different application identifier in your package.json and in your gradle files (check your identifier in `package.json` and in all *.gradle files in your App_Resources directory)
    * device is locked
    * manual closing of the application
Unable to apply changes on device: ce12171cd1a920bd0d. Error is: Application app.surfcloud.bizApp is not running.

In my case the solution was to change:

<activity android:exported="false" (...)/>

to:

<activity android:exported="true" (...)/>

in AndroidManifest.xml. After setting exported to true the app launches normally.

Upvotes: 1

bwobbones
bwobbones

Reputation: 2578

For me, it was just that I had a previous version of the app already installed on the device. Uninstalling that fixed the problem.

Upvotes: 0

Aden Kurmanov
Aden Kurmanov

Reputation: 107

in my case, this did not work due to an overflow of the device's memory. Clean memory and try install again

Upvotes: 1

silver daymon
silver daymon

Reputation: 177

The problem for me was that the Application id was different in both:

package.json

}
  ...
    "nativescript": {
    "id": "org.nativescript.myApp"
  }
}

And nativescript.config.ts

export default {
  id: 'org.nativescript.myApp',
  appResourcesPath: 'App_Resources',
  android: {
    v8Flags: '--expose_gc',
    markingMode: 'none'
  }
} as NativeScriptConfig;

It must be the same. After that, it works just fine.

Upvotes: 9

saeed asalisaf
saeed asalisaf

Reputation: 93

Try this commands while your cable is connected to your phone:

  1. adb kill-server
  2. sudo adb start-server
  3. sudo adb reconnect

then retry running NativeScript command.

Upvotes: 3

kurt estacion
kurt estacion

Reputation: 507

In may case, i have installed a software in my mac that also runs adb. The main prob really was its conflicting with the android adb. uninstall that software solved the problem

Upvotes: 1

Robertino Vasilescu
Robertino Vasilescu

Reputation: 1078

try with changing the application ID to "com.example.myapp" where example is your domain name.

Upvotes: 1

Related Questions