You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository was archived by the owner on Aug 7, 2021. It is now read-only.
When starting the bundeled app (npm run ns-bundle --android --run-app) my extended Activity is not found (ClassNotFoundException):
An uncaught Exception occurred on "main" thread.
java.lang.RuntimeException: Unable to instantiate activity ComponentInfo{org.nativescript.ExtentedActivityTest/org.myApp.MainActivity}: java.lang.ClassNotFoundException: Didn't find class "org.myApp.MainActivity" on path: DexPathList[[zip file "/data/app/org.nativescript.ExtentedActivityTest-1/base.apk"],nativeLibraryDirectories=[/data/app/org.nativescript.ExtentedActivityTest-1/lib/arm, /data/app/org.nativescript.ExtentedActivityTest-1/base.apk!/lib/armeabi-v7a, /system/lib, /vendor/lib]] at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2853) at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:3049) at android.app.ActivityThread.-wrap14(ActivityThread.java) at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1646) at android.os.Handler.dispatchMessage(Handler.java:102) at android.os.Looper.loop(Looper.java:154) at android.app.ActivityThread.main(ActivityThread.java:6836) at java.lang.reflect.Method.invoke(Native Method) at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:1520) at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1410) Caused by: java.lang.ClassNotFoundException: Didn't find class "org.myApp.MainActivity" on path: DexPathList[[zip file "/data/app/org.nativescript.ExtentedActivityTest-1/base.apk"],nativeLibraryDirectories=[/data/app/org.nativescript.ExtentedActivityTest-1/lib/arm, /data/app/org.nativescript.ExtentedActivityTest-1/base.apk!/lib/armeabi-v7a, /system/lib, /vendor/lib]]
at dalvik.system.BaseDexClassLoader.findClass(BaseDexClassLoader.java:56)
at java.lang.ClassLoader.loadClass(ClassLoader.java:380)
at java.lang.ClassLoader.loadClass(ClassLoader.java:312)
at android.app.Instrumentation.newActivity(Instrumentation.java:1086)
at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2843)
... 9 more
When start the standard way (tns run android) the app is running as supossed.
Environment
All NativeScript components versions information
┌──────────────────┬─────────────────┬────────────────┬───────────────┐
│ Component │ Current version │ Latest version │ Information │
│ nativescript │ 3.1.2 │ 3.1.2 │ Up to date │
│ tns-core-modules │ 3.1.0 │ 3.1.0 │ Up to date │
│ tns-android │ 3.1.1 │ 3.1.1 │ Up to date │
│ tns-ios │ │ 3.1.0 │ Not installed │
└──────────────────┴─────────────────┴────────────────┴───────────────┘
Google/SO couldn't help any further
Test project
In the attachment you'll find a test project. The extended activity is located in app/MainActivity.android.ts. ExtentedActivityTest.zip
The text was updated successfully, but these errors were encountered:
Try adding MainActivity: './MainActivity', to the entry in webpack.config.js like this:
constentry={// Discover entry module from package.jsonbundle: `./${nsWebpack.getEntryModule()}`,// Vendor entry with third-party librariesvendor: `./vendor`,/// HEREMainActivity: './MainActivity',// Entry for stylesheet with global application styles[mainSheet]: `./${mainSheet}`,};
I have added the require to thevendor-platform.android.ts:
require("application");
if (!global["__snapshot"]) {
/*
In case snapshot generation is enabled these modules will get into the bundle but will not be required/evaluated.
The snapshot webpack plugin will add them to the tns-java-classes.js bundle file. This way, they will be evaluated on app start as early as possible.
*/
require("ui/frame");
require("ui/frame/activity");
}
require("./MainActivity.android.js");
My android app collects onKeyDown/onKeyUp events with an extented activity (based on https://docs.nativescript.org/runtimes/android/advanced-topics/extend-application-activity#extending-activity).
When starting the bundeled app (
npm run ns-bundle --android --run-app
) my extended Activity is not found (ClassNotFoundException):tns run android
) the app is running as supossed.Environment
Google/SO couldn't help any further
Test project
In the attachment you'll find a test project. The extended activity is located in app/MainActivity.android.ts.
ExtentedActivityTest.zip
The text was updated successfully, but these errors were encountered: