App throw exception in real device (help!)


#1

(UPD: what additional info needed to solve my problem?)

I have a phone:

and have a virtual device:
Nexus5, android 4.4.2 API 19

i setup a classic HelloWorld application.

so, on AVD work perfect, on Oneplus fails with this:

An uncaught Exception occurred on “main” thread.
java.lang.RuntimeException: Unable to instantiate activity ComponentInfo{org.nativescript.HW/org.nativescript.HW.NativeScriptActivity}: java.lang.ClassNotFoundException: Didn’t find class “org.nativescript.HW.NativeScriptActivity” on path: DexPathList[[zip file “/data/app/org.nativescript.HW-1.apk”],nativeLibraryDirectories=[/data/app-lib/org.nativescript.HW-1, /vendor/lib, /system/lib]]
at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2131)
at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2271)
at android.app.ActivityThread.access$800(ActivityThread.java:144)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1205)
at android.os.Handler.dispatchMessage(Handler.java:102)
at android.os.Looper.loop(Looper.java:136)
at android.app.ActivityThread.main(ActivityThread.java:5146)
at java.lang.reflect.Method.invokeNative(Native Method)
at java.lang.reflect.Method.invoke(Method.java:515)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:732)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:566)
at dalvik.system.NativeStart.main(Native Method)
Caused by: java.lang.ClassNotFoundException: Didn’t find class “org.nativescript.HW.NativeScriptActivity” on path: DexPathList[[zip file “/data/app/org.nativescript.HW-1.apk”],nativeLibraryDirectories=[/data/app-lib/org.nativescript.HW-1, /vendor/lib, /system/lib]]
at dalvik.system.BaseDexClassLoader.findClass(BaseDexClassLoader.java:56)
at java.lang.ClassLoader.loadClass(ClassLoader.java:497)
at java.lang.ClassLoader.loadClass(ClassLoader.java:457)
at android.app.Instrumentation.newActivity(Instrumentation.java:1061)
at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2122)
… 11 more

My versions of tns:

Component │ Current version │ Latest version │ Information │
│ nativescript │ 3.0.0-2017-02-16-8067 │ 2.5.1 │ Up to date │
│ tns-core-modules │ 2.5.0 │ 2.5.1 │ Update available │
│ tns-android │ 3.0.0-next-2017-02-15-1664 │ 2.5.0 │ Up to date │
│ tns-ios │ │ 2.5.0 │ Not installed │

My logcat on phone:

D/dalvikvm(18961): Late-enabling CheckJNI
D/ActivityThread(18961): handleBindApplication:org.nativescript.HW
D/ActivityThread(18961): setTargetHeapUtilization:0.75
D/ActivityThread(18961): setTargetHeapMinFree:8388608
D/dalvikvm(18961): Trying to load lib /data/app-lib/org.nativescript.HW-1/libNativeScript.so 0x41bfdfd0
D/dalvikvm(18961): Added shared lib /data/app-lib/org.nativescript.HW-1/libNativeScript.so 0x41bfdfd0
I/TNS.Native(18961): NativeScript Runtime Version 3.0.0-next-2017-02-15-1664, commit 570146a288a2fa0359ecaa5084a0fda4b68db03e
D/TNS.Native(18961): JNI_ONLoad
D/TNS.Native(18961): JNI_ONLoad END
D/TNS.Native(18961): Failed to load snapshot: dlopen failed: library “libsnapshot.so” not found
D/TNS.Native(18961): V8 version 5.5.372.32
D/TNS.Native(18961): lenNodes=60192, lenNames=683033, lenValues=774894
D/TNS.Native(18961): time=5
D/AndroidRuntime(18961): Shutting down VM
W/dalvikvm(18961): threadid=1: thread exiting with uncaught exception (group=0x41609ce0)
W/System.err(18961): java.lang.RuntimeException: Unable to instantiate activity ComponentInfo{org.nativescript.HW/org.nativescript.HW.NativeScriptActivity}: java.lang.ClassNotFoundException: Didn’t find class “org.nativescript.HW.NativeScriptActivity” on path: DexPathList[[zip file “/data/app/org.nativescript.HW-1.apk”],nativeLibraryDirectories=[/data/app-lib/org.nativescript.HW-1, /vendor/lib, /system/lib]]
W/System.err(18961): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2131)
W/System.err(18961): at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2271)
W/System.err(18961): at android.app.ActivityThread.access$800(ActivityThread.java:144)
W/System.err(18961): at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1205)
W/System.err(18961): at android.os.Handler.dispatchMessage(Handler.java:102)
W/System.err(18961): at android.os.Looper.loop(Looper.java:136)
W/System.err(18961): at android.app.ActivityThread.main(ActivityThread.java:5146)
W/System.err(18961): at java.lang.reflect.Method.invokeNative(Native Method)
W/System.err(18961): at java.lang.reflect.Method.invoke(Method.java:515)
W/System.err(18961): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:732)
W/System.err(18961): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:566)
W/System.err(18961): at dalvik.system.NativeStart.main(Native Method)
W/System.err(18961): Caused by: java.lang.ClassNotFoundException: Didn’t find class “org.nativescript.HW.NativeScriptActivity” on path: DexPathList[[zip file “/data/app/org.nativescript.HW-1.apk”],nativeLibraryDirectories=[/data/app-lib/org.nativescript.HW-1, /vendor/lib, /system/lib]]
W/System.err(18961): at dalvik.system.BaseDexClassLoader.findClass(BaseDexClassLoader.java:56)
W/System.err(18961): at java.lang.ClassLoader.loadClass(ClassLoader.java:497)
W/System.err(18961): at java.lang.ClassLoader.loadClass(ClassLoader.java:457)
W/System.err(18961): at android.app.Instrumentation.newActivity(Instrumentation.java:1061)
W/System.err(18961): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2122)
W/System.err(18961): … 11 more
I/Process (18961): Sending signal. PID: 18961 SIG: 9

What i need to do?
(yes i am read this forum and stackoverflow : 5 days along ))) )


#2

share your android manifest file


#3

Thanx for your attention. My manifest:

<?xml version="1.0" encoding="utf-8"?>

<supports-screens
	android:smallScreens="true"
	android:normalScreens="true"
	android:largeScreens="true"
	android:xlargeScreens="true"/>

<uses-sdk
	android:minSdkVersion="17"
	android:targetSdkVersion="20"/>

<uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE"/>
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE"/>
<uses-permission android:name="android.permission.INTERNET"/>

<application
	android:name="com.tns.NativeScriptApplication"
	android:allowBackup="true"
	android:icon="@drawable/icon"
	android:label="@string/app_name"
	android:theme="@style/AppTheme">

	<activity
		android:name=".NativeScriptActivity"
		android:label="@string/title_activity_kimera"
		android:configChanges="keyboardHidden|orientation|screenSize"
		android:theme="@style/LaunchScreenTheme">

		<meta-data android:name="SET_THEME_ON_LAUNCH" android:resource="@style/AppTheme" />

		<intent-filter>
			<action android:name="android.intent.action.MAIN" />
			<category android:name="android.intent.category.LAUNCHER" />
		</intent-filter>
	</activity>
	<activity android:name="com.tns.ErrorReportActivity"/>
</application>

#5

Thanx. Absolutely. I`ve been watch to this issue.


#6

What environment are you building on? A Mac OSX, Linux OS?

A complete log of the build output would also help big time. tns build/run android > buildoutput.txt

Edit: It seems that your problem isn’t really related to what I linked earlier. You seem to have replaced the activity entry in the Manifest, which resolves relatively to the application id, which isn’t valid for the default nativescript activity. So replace the activity android:name=... entry with activity android:name="com.tns.NativeScriptActivity"