native-activity crashes on startup
henke96 opened this issue · 7 comments
henke96 commented
The native-activity sample crashes on startup for me:
01-29 13:21:53.692 19506 19506 D AndroidRuntime: Shutting down VM
01-29 13:21:53.693 19506 19506 E AndroidRuntime: FATAL EXCEPTION: main
01-29 13:21:53.693 19506 19506 E AndroidRuntime: Process: com.example.native_activity, PID: 19506
01-29 13:21:53.693 19506 19506 E AndroidRuntime: java.lang.RuntimeException: Unable to get provider androidx.startup.InitializationProvider: java.lang.ClassNotFoundException: Didn't find class "androidx.startup.InitializationProvider" on path: DexPathList[[],nativeLibraryDirectories=[/data/app/~~4YAeCpMLzSkqGKIKZ4d1ng==/com.example.native_activity-dtqDfrF_hud_ev66GpcWfw==/lib/arm64, /data/app/~~4YAeCpMLzSkqGKIKZ4d1ng==/com.example.native_activity-dtqDfrF_hud_ev66GpcWfw==/base.apk!/lib/arm64-v8a, /system/lib64, /system_ext/lib64]]
01-29 13:21:53.693 19506 19506 E AndroidRuntime: at android.app.ActivityThread.installProvider(ActivityThread.java:7478)
01-29 13:21:53.693 19506 19506 E AndroidRuntime: at android.app.ActivityThread.installContentProviders(ActivityThread.java:6990)
01-29 13:21:53.693 19506 19506 E AndroidRuntime: at android.app.ActivityThread.handleBindApplication(ActivityThread.java:6739)
01-29 13:21:53.693 19506 19506 E AndroidRuntime: at android.app.ActivityThread.access$1500(ActivityThread.java:252)
01-29 13:21:53.693 19506 19506 E AndroidRuntime: at android.app.ActivityThread$H.handleMessage(ActivityThread.java:2058)
01-29 13:21:53.693 19506 19506 E AndroidRuntime: at android.os.Handler.dispatchMessage(Handler.java:106)
01-29 13:21:53.693 19506 19506 E AndroidRuntime: at android.os.Looper.loopOnce(Looper.java:346)
01-29 13:21:53.693 19506 19506 E AndroidRuntime: at android.os.Looper.loop(Looper.java:475)
01-29 13:21:53.693 19506 19506 E AndroidRuntime: at android.app.ActivityThread.main(ActivityThread.java:7890)
01-29 13:21:53.693 19506 19506 E AndroidRuntime: at java.lang.reflect.Method.invoke(Native Method)
01-29 13:21:53.693 19506 19506 E AndroidRuntime: at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:548)
01-29 13:21:53.693 19506 19506 E AndroidRuntime: at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1009)
01-29 13:21:53.693 19506 19506 E AndroidRuntime: Caused by: java.lang.ClassNotFoundException: Didn't find class "androidx.startup.InitializationProvider" on path: DexPathList[[],nativeLibraryDirectories=[/data/app/~~4YAeCpMLzSkqGKIKZ4d1ng==/com.example.native_activity-dtqDfrF_hud_ev66GpcWfw==/lib/arm64, /data/app/~~4YAeCpMLzSkqGKIKZ4d1ng==/com.example.native_activity-dtqDfrF_hud_ev66GpcWfw==/base.apk!/lib/arm64-v8a, /system/lib64, /system_ext/lib64]]
01-29 13:21:53.693 19506 19506 E AndroidRuntime: at dalvik.system.BaseDexClassLoader.findClass(BaseDexClassLoader.java:259)
01-29 13:21:53.693 19506 19506 E AndroidRuntime: at java.lang.ClassLoader.loadClass(ClassLoader.java:379)
01-29 13:21:53.693 19506 19506 E AndroidRuntime: at java.lang.ClassLoader.loadClass(ClassLoader.java:312)
01-29 13:21:53.693 19506 19506 E AndroidRuntime: at android.app.AppComponentFactory.instantiateProvider(AppComponentFactory.java:147)
01-29 13:21:53.693 19506 19506 E AndroidRuntime: at android.app.ActivityThread.installProvider(ActivityThread.java:7462)
01-29 13:21:53.693 19506 19506 E AndroidRuntime: ... 11 more
After some googling i managed to work around it by editing AndroidManifest.xml.
I changed the manifest
element to be:
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:versionCode="1"
android:versionName="1.0">
Then i inserted the following under the application
element:
<provider android:name="androidx.startup.InitializationProvider"
android:authorities="${applicationId}.androidx-startup"
tools:node="remove" />
william-ferguson-au commented
This fixes the issue, but I don't understand why configuring the InitializationProvider to remove all Initializers works, or is necessary. It seems like something is broken in the NativeActivity startup mechanism.
hybcloud commented
the same problem, the same solution, and the samely confused.
hybcloud commented