Android-runtime: Android app crashing on startup

Created on 14 Feb 2017  路  5Comments  路  Source: NativeScript/android-runtime

Here is the catlog

02-14 12:08:58.779 19105 19105 E AndroidRuntime: Process: au.com.dac.ret, PID: 19105
02-14 12:08:58.779 19105 19105 E AndroidRuntime: java.lang.RuntimeException: Unable to instantiate application au.com.dac.ret: java.lang.ClassNotFoundException: Didn't find class "au.com.dac.ret" on path: DexPathList[[zip file "/data/app/au.com.dac.ret-1/base.apk"],nativeLibraryDirectories=[/data/app/au.com.dac.ret-1/lib/arm, /data/app/au.com.dac.ret-1/base.apk!/lib/armeabi-v7a, /vendor/lib, /system/lib]]
02-14 12:08:58.779 19105 19105 E AndroidRuntime: at android.app.LoadedApk.makeApplication(LoadedApk.java:676)
02-14 12:08:58.779 19105 19105 E AndroidRuntime: at android.app.ActivityThread.handleBindApplication(ActivityThread.java:6294)
02-14 12:08:58.779 19105 19105 E AndroidRuntime: at android.app.ActivityThread.access$1800(ActivityThread.java:222)
02-14 12:08:58.779 19105 19105 E AndroidRuntime: at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1861)
02-14 12:08:58.779 19105 19105 E AndroidRuntime: at android.os.Handler.dispatchMessage(Handler.java:102)
02-14 12:08:58.779 19105 19105 E AndroidRuntime: at android.os.Looper.loop(Looper.java:158)
02-14 12:08:58.779 19105 19105 E AndroidRuntime: at android.app.ActivityThread.main(ActivityThread.java:7229)
02-14 12:08:58.779 19105 19105 E AndroidRuntime: at java.lang.reflect.Method.invoke(Native Method)
02-14 12:08:58.779 19105 19105 E AndroidRuntime: at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:1230)
02-14 12:08:58.779 19105 19105 E AndroidRuntime: at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1120)
02-14 12:08:58.779 19105 19105 E AndroidRuntime: Caused by: java.lang.ClassNotFoundException: Didn't find class "au.com.dac.ret" on path: DexPathList[[zip file "/data/app/au.com.dac.ret-1/base.apk"],nativeLibraryDirectories=[/data/app/au.com.dac.ret-1/lib/arm, /data/app/au.com.dac.ret-1/base.apk!/lib/armeabi-v7a, /vendor/lib, /system/lib]]
02-14 12:08:58.779 19105 19105 E AndroidRuntime: at dalvik.system.BaseDexClassLoader.findClass(BaseDexClassLoader.java:56)
02-14 12:08:58.779 19105 19105 E AndroidRuntime: at java.lang.ClassLoader.loadClass(ClassLoader.java:511)
02-14 12:08:58.779 19105 19105 E AndroidRuntime: at java.lang.ClassLoader.loadClass(ClassLoader.java:469)
02-14 12:08:58.779 19105 19105 E AndroidRuntime: at android.app.Instrumentation.newApplication(Instrumentation.java:1004)
02-14 12:08:58.779 19105 19105 E AndroidRuntime: at android.app.LoadedApk.makeApplication(LoadedApk.java:666)
02-14 12:08:58.779 19105 19105 E AndroidRuntime: ... 9 more
02-14 12:08:58.779 19105 19105 E AndroidRuntime: Suppressed: java.lang.ClassNotFoundException: au.com.dac.ret
02-14 12:08:58.779 19105 19105 E AndroidRuntime: at java.lang.Class.classForName(Native Method)
02-14 12:08:58.779 19105 19105 E AndroidRuntime: at java.lang.BootClassLoader.findClass(ClassLoader.java:781)
02-14 12:08:58.779 19105 19105 E AndroidRuntime: at java.lang.BootClassLoader.loadClass(ClassLoader.java:841)
02-14 12:08:58.779 19105 19105 E AndroidRuntime: at java.lang.ClassLoader.loadClass(ClassLoader.java:504)
02-14 12:08:58.779 19105 19105 E AndroidRuntime: ... 12 more
02-14 12:08:58.779 19105 19105 E AndroidRuntime: Caused by: java.lang.NoClassDefFoundError: Class not found using the boot class loader; no stack trace available

  • CLI: 2.5.0
  • Cross-platform modules: 2.5.0
  • Runtime(s): 2.5.0

Below is my package.json

{
"description": "NativeScript Application",
"license": "SEE LICENSE IN ",
"readme": "NativeScript Application",
"repository": "",
"nativescript": {
"id": "au.com.dac.ret",
"tns-ios": {
"version": "2.5.0"
},
"tns-android": {
"version": "2.5.0"
}
},
"dependencies": {
"@angular/common": "2.2.1",
"@angular/compiler": "2.2.1",
"@angular/core": "2.2.1",
"@angular/forms": "2.2.1",
"@angular/http": "2.2.1",
"@angular/platform-browser": "2.2.1",
"@angular/platform-browser-dynamic": "2.2.1",
"@angular/router": "3.2.1",
"nativescript-angular": "1.2.0",
"nativescript-dom": "^1.0.8",
"nativescript-drop-down": "^1.5.1",
"nativescript-iqkeyboardmanager": "^1.0.1",
"nativescript-pulltorefresh": "^1.1.10",
"nativescript-telerik-ui": "^1.6.0",
"nativescript-theme-core": "^0.2.1",
"nativescript-xmlobjects": "^1.1.4",
"reflect-metadata": "~0.1.8",
"rxjs": "5.0.0-beta.12",
"tns-core-modules": "^2.5.0",
"tns-platform-declarations": "^2.5.0"
},
"devDependencies": {
"babel-traverse": "6.21.0",
"babel-types": "6.21.0",
"babylon": "6.14.1",
"lazy": "1.0.11",
"nativescript-dev-android-snapshot": "0.0.5",
"nativescript-dev-typescript": "^0.3.2",
"tns-platform-declarations": "^2.5.0",
"typescript": "~2.0.10",
"zone.js": "~0.6.21"
}
}

Most helpful comment

The issue was in android manifest file. While editing the file I made a mistake of editing wrong line
This line

android:name="com.tns.NativeScriptApplication"

was changed to

android:name="au.com.example.rac"

All 5 comments

Hi @zahid-dapperapps,
Could you provide steps to reproduce or a small repo that easily reproduces the problem. Further more what version of cli are you using, as well as platform and tns-module versions. What operating system are you working on? Did the issue happen on a device, emulator or simulator? Are there any special dependencies you used?

I have provided above versions that I am using and also package.json

CLI: 2.5.0
Cross-platform modules: 2.5.0
Runtime(s): 2.5.0

this is happening on device S7 and I am developing on OSX EL Capitan 10.11.5. I hope this helps. I will try to setup a repo meanwhile

When running via tns run android I also get this warning in yellow color

The system failed to delete the package for an unspecified reason.

The issue was in android manifest file. While editing the file I made a mistake of editing wrong line
This line

android:name="com.tns.NativeScriptApplication"

was changed to

android:name="au.com.example.rac"

Wow, I am SO glad I found this comment. Thank you, @zahid-dapperapps.

I assumed I could change com.tns.* in AndroidManifest.xml to actually reflect the name of the app and spent way too long trying to figure out why the app wouldn't launch.

Why is this the case?

Was this page helpful?
0 / 5 - 0 ratings