1

My existing Android App crashes on boot, only in Release mode. Using Delphi 11.0 Version 28.0.42600.6491

The Android Log shows this:

11-07 09:54:52.174: I/ack.SARTrackAp(7445): The ClassLoaderContext is a special shared library.
11-07 09:54:53.543: D/AndroidRuntime(7445): Shutting down VM
11-07 09:54:53.549: E/AndroidRuntime(7445): FATAL EXCEPTION: main
11-07 09:54:53.549: E/AndroidRuntime(7445): Process: nz.sartrack.SARTrackApp, PID: 7445
11-07 09:54:53.549: E/AndroidRuntime(7445): java.lang.RuntimeException: Unable to get provider androidx.core.content.FileProvider: java.lang.ClassNotFoundException: Didn't find class "androidx.core.content.FileProvider" on path: DexPathList[[zip file "/system/framework/org.apache.http.legacy.boot.jar", zip file "/data/app/nz.sartrack.SARTrackApp-mk-4dFA3yZ7ztvef8Arx_w==/base.apk"],nativeLibraryDirectories=[/data/app/nz.sartrack.SARTrackApp-mk-4dFA3yZ7ztvef8Arx_w==/lib/arm, /data/app/nz.sartrack.SARTrackApp-mk-4dFA3yZ7ztvef8Arx_w==/base.apk!/lib/armeabi-v7a, /system/lib, /system/vendor/lib]]
11-07 09:54:53.549: E/AndroidRuntime(7445):     at android.app.ActivityThread.installProvider(ActivityThread.java:6935)
11-07 09:54:53.549: E/AndroidRuntime(7445):     at android.app.ActivityThread.installContentProviders(ActivityThread.java:6477)
11-07 09:54:53.549: E/AndroidRuntime(7445):     at android.app.ActivityThread.handleBindApplication(ActivityThread.java:6381)
11-07 09:54:53.549: E/AndroidRuntime(7445):     at android.app.ActivityThread.access$1300(ActivityThread.java:248)
11-07 09:54:53.549: E/AndroidRuntime(7445):     at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1830)
11-07 09:54:53.549: E/AndroidRuntime(7445):     at android.os.Handler.dispatchMessage(Handler.java:106)
11-07 09:54:53.549: E/AndroidRuntime(7445):     at android.os.Looper.loop(Looper.java:216)
11-07 09:54:53.549: E/AndroidRuntime(7445):     at android.app.ActivityThread.main(ActivityThread.java:7266)
11-07 09:54:53.549: E/AndroidRuntime(7445):     at java.lang.reflect.Method.invoke(Native Method)
11-07 09:54:53.549: E/AndroidRuntime(7445):     at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:494)
11-07 09:54:53.549: E/AndroidRuntime(7445):     at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:975)
11-07 09:54:53.549: E/AndroidRuntime(7445): Caused by: java.lang.ClassNotFoundException: Didn't find class "androidx.core.content.FileProvider" on path: DexPathList[[zip file "/system/framework/org.apache.http.legacy.boot.jar", zip file "/data/app/nz.sartrack.SARTrackApp-mk-4dFA3yZ7ztvef8Arx_w==/base.apk"],nativeLibraryDirectories=[/data/app/nz.sartrack.SARTrackApp-mk-4dFA3yZ7ztvef8Arx_w==/lib/arm, /data/app/nz.sartrack.SARTrackApp-mk-4dFA3yZ7ztvef8Arx_w==/base.apk!/lib/armeabi-v7a, /system/lib, /system/vendor/lib]]
11-07 09:54:53.549: E/AndroidRuntime(7445):     at dalvik.system.BaseDexClassLoader.findClass(BaseDexClassLoader.java:134)
11-07 09:54:53.549: E/AndroidRuntime(7445):     at java.lang.ClassLoader.loadClass(ClassLoader.java:379)
11-07 09:54:53.549: E/AndroidRuntime(7445):     at java.lang.ClassLoader.loadClass(ClassLoader.java:312)
11-07 09:54:53.549: E/AndroidRuntime(7445):     at android.app.AppComponentFactory.instantiateProvider(AppComponentFactory.java:121)
11-07 09:54:53.549: E/AndroidRuntime(7445):     at android.app.ActivityThread.installProvider(ActivityThread.java:6919)
11-07 09:54:53.549: E/AndroidRuntime(7445):     ... 10 more
11-07 09:54:53.571: I/Process(7445): Sending signal. PID: 7445 SIG: 9

The problems seems to be this:

Unable to get provider androidx.core.content.FileProvider: java.lang.ClassNotFoundException: Didn't find class "androidx.core.content.FileProvider" on path: DexPathList[[zip file "/system/framework/org.apache.http.legacy.boot.jar", zip file "/data/app/nz.sartrack.SARTrackApp-mk-4dFA3yZ7ztvef8Arx_w==/base.apk"],nativeLibraryDirectories=[/data/app/nz.sartrack.SARTrackApp-mk-4dFA3yZ7ztvef8Arx_w==/lib/arm, /data/app/nz.sartrack.SARTrackApp-mk-4dFA3yZ7ztvef8Arx_w==/base.apk!/lib/armeabi-v7a, /system/lib, /system/vendor/lib]]

No idea what this is.

Any help appreciated.

Bart Kindt
  • 142
  • 13
  • See: answers for https://stackoverflow.com/questions/50446148/how-to-use-apache-http-on-android-p for some info. It would help if you mentioned the device and if it's a newer device. – Brian Nov 06 '21 at 22:17
  • 1
    "Didn't find class "androidx.core.content.FileProvider" could mean that you're using a project created with an older version of Delphi, and have not done the following: In Project Manager, under the Android target, right-click the Libraries node and click "Revert System Files To Default" – Dave Nottage Nov 06 '21 at 23:48
  • I did do the "Revert System Files To Default" when I upgraded the Delphi to verion 11. – Bart Kindt Nov 07 '21 at 17:00
  • In my manifest file, I do have this: The problem ONLY is in Release mode. I Debug mode it works fine. – Bart Kindt Nov 07 '21 at 17:02
  • The device used is Android 9. The App worked okay on the *same* phone, when I still used Delphi 10.3. After upgrading to 11.0, I had to make lots of changes to the J_NotificationCompat_Builder > Japp_NotificationCompat_Builder and the Permissions. Now I can no longer go back to 10.3. And I have this problem. – Bart Kindt Nov 07 '21 at 17:06
  • And the Android Manifest files for both Debug and Release are identical. – Bart Kindt Nov 07 '21 at 17:36
  • 1
    For one reason or another, the androidx.core.content.FileProvider class is not making it into your executable. Next step would be to delete everything in the folder specified in Output folder in Project Options, i.e. the folder(s) that contain classes.dex etc, to ensure they're regenerated, then do a Build. Also check Project | Deployment Manager to ensure that deployment isn't including another classes.dex that it should not be. You could use of the "Revert" button in Deployment Manager to ensure that it conforms to Delphi 11 requirements – Dave Nottage Nov 07 '21 at 20:14
  • Deleting the entire ..\Debug\ and ..\Release\ directory trees worked. This includes the 'App.classes' directory. Thanks Dave! – Bart Kindt Nov 09 '21 at 15:08

0 Answers0