Jump to content
Fabian1648

Problem with Android app migration from Delphi10.3 to Delphi 12.1

Recommended Posts

Hello,

 

I have a problem migrating an Android app from Delphi10.3 to Delphi12.1:


1. I had to modify the permissions management because the app was making errors at compilation

2. I had to reset the Manifest


And now on Android 10,11,12, it works, but on Android 14, the app launches, displays the splashscreen and then closes!


Does anyone have an idea how to solve this problem?

 

Thanks in advance

Share this post


Link to post
4 hours ago, Fabian1648 said:

Does anyone have an idea how to solve this problem?

Not sure why you would expect anyone to know without any detail whatsoever as to what your code is doing. You could use a logcat viewer to view what messages are coming from the device when the app attempts to start. See this link: 

 

https://github.com/DelphiWorlds/HowTo/tree/main/Solutions/LogViewers#android

  • Thanks 1

Share this post


Link to post

Hello,

 

1. I used logcat and only two error messages appear in 450 lines but the log continues after these errors:

Quote

2024-05-14 07:19:01.878 8521-8555/com.embarcadero.tcTestZ E/Adreno-AppProfiles: QSPM AIDL service doesn't exist
2024-05-14 07:19:02.120 8521-8521/com.embarcadero.tcTestZ E/dero.tcTestZ: Unable to open libpenguin.so: dlopen failed: library "libpenguin.so" not found.

 

 

2. The cause of the problem could be related to the following warnings:
 
Quote

2024-05-14 07:19:02.848 8619-8619/com.embarcadero.tcTestZ W/System.err: java.lang.SecurityException: com.embarcadero.tcTestZ: One of RECEIVER_EXPORTED or RECEIVER_NOT_EXPORTED should be specified when a receiver isn't being registered exclusively for system broadcasts
2024-05-14 07:19:02.848 8619-8619/com.embarcadero.tcTestZ W/System.err:     at android.os.Parcel.createExceptionOrNull(Parcel.java:3069)
2024-05-14 07:19:02.848 8619-8619/com.embarcadero.tcTestZ W/System.err:     at android.os.Parcel.createException(Parcel.java:3053)
2024-05-14 07:19:02.848 8619-8619/com.embarcadero.tcTestZ W/System.err:     at android.os.Parcel.readException(Parcel.java:3036)
2024-05-14 07:19:02.848 8619-8619/com.embarcadero.tcTestZ W/System.err:     at android.os.Parcel.readException(Parcel.java:2978)
2024-05-14 07:19:02.848 8619-8619/com.embarcadero.tcTestZ W/System.err:     at android.app.IActivityManager$Stub$Proxy.registerReceiverWithFeature(IActivityManager.java:6143)
2024-05-14 07:19:02.848 8619-8619/com.embarcadero.tcTestZ W/System.err:     at android.app.ContextImpl.registerReceiverInternal(ContextImpl.java:1913)
2024-05-14 07:19:02.848 8619-8619/com.embarcadero.tcTestZ W/System.err:     at android.app.ContextImpl.registerReceiver(ContextImpl.java:1853)
2024-05-14 07:19:02.848 8619-8619/com.embarcadero.tcTestZ W/System.err:     at android.app.ContextImpl.registerReceiver(ContextImpl.java:1841)
2024-05-14 07:19:02.848 8619-8619/com.embarcadero.tcTestZ W/System.err:     at android.content.ContextWrapper.registerReceiver(ContextWrapper.java:772)
2024-05-14 07:19:02.849 8619-8619/com.embarcadero.tcTestZ W/System.err:     at android.app.NativeActivity.onStartNative(Native Method)
2024-05-14 07:19:02.849 8619-8619/com.embarcadero.tcTestZ W/System.err:     at android.app.NativeActivity.onStart(NativeActivity.java:226)
2024-05-14 07:19:02.849 8619-8619/com.embarcadero.tcTestZ W/System.err:     at android.app.Instrumentation.callActivityOnStart(Instrumentation.java:1582)
2024-05-14 07:19:02.849 8619-8619/com.embarcadero.tcTestZ W/System.err:     at android.app.Activity.performStart(Activity.java:9008)
2024-05-14 07:19:02.849 8619-8619/com.embarcadero.tcTestZ W/System.err:     at android.app.ActivityThread.handleStartActivity(ActivityThread.java:4198)
2024-05-14 07:19:02.849 8619-8619/com.embarcadero.tcTestZ W/System.err:     at android.app.servertransaction.TransactionExecutor.performLifecycleSequence(TransactionExecutor.java:225)
2024-05-14 07:19:02.849 8619-8619/com.embarcadero.tcTestZ W/System.err:     at android.app.servertransaction.TransactionExecutor.cycleToPath(TransactionExecutor.java:205)
2024-05-14 07:19:02.849 8619-8619/com.embarcadero.tcTestZ W/System.err:     at android.app.servertransaction.TransactionExecutor.executeLifecycleState(TransactionExecutor.java:177)
2024-05-14 07:19:02.849 8619-8619/com.embarcadero.tcTestZ W/System.err:     at android.app.servertransaction.TransactionExecutor.execute(TransactionExecutor.java:98)
2024-05-14 07:19:02.849 8619-8619/com.embarcadero.tcTestZ W/System.err:     at android.app.ActivityThread$H.handleMessage(ActivityThread.java:2685)
2024-05-14 07:19:02.849 8619-8619/com.embarcadero.tcTestZ W/System.err:     at android.os.Handler.dispatchMessage(Handler.java:106)
2024-05-14 07:19:02.849 8619-8619/com.embarcadero.tcTestZ W/System.err:     at android.os.Looper.loopOnce(Looper.java:230)
2024-05-14 07:19:02.849 8619-8619/com.embarcadero.tcTestZ W/System.err:     at android.os.Looper.loop(Looper.java:319)
2024-05-14 07:19:02.849 8619-8619/com.embarcadero.tcTestZ W/System.err:     at android.app.ActivityThread.main(ActivityThread.java:8918)
2024-05-14 07:19:02.849 8619-8619/com.embarcadero.tcTestZ W/System.err:     at java.lang.reflect.Method.invoke(Native Method)
2024-05-14 07:19:02.849 8619-8619/com.embarcadero.tcTestZ W/System.err:     at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:608)
2024-05-14 07:19:02.849 8619-8619/com.embarcadero.tcTestZ W/System.err:     at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1103)
2024-05-14 07:19:02.933 2396-5678/? I/ActivityManager: Process com.embarcadero.tcTestZ (pid 8619) has died: fg  TOP (257,2016)
2024-05-14 07:19:02.934 2396-5678/? V/WindowManager: Collecting in transition 14490: ActivityRecord{69d4e67 u0 com.embarcadero.tcTestZ/com.embarcadero.firemonkey.FMXNativeActivity t350}, caller=com.android.server.wm.Transition.collectExistenceChange:921 com.android.server.wm.TransitionController.collectExistenceChange:940 com.android.server.wm.TransitionController.requestCloseTransitionIfNeeded:886 com.android.server.wm.ActivityRecord.handleAppDied:5103

 

 This RECEIVER_EXPORTED / RECEIVER_NOT_EXPORTED flag was introduced as part of Android 13 and seems to be now a requirement for apps running on Android 14 or higher.
 
 

3. The app compiled with Delphi 10 works perfectly on Android 10, 11, 12, 13 and 14  without this RECEIVER_EXPORTED / RECEIVER_NOT_EXPORTED flag !?!?
 

 

4. The app compiled with Delphi 12.1 works perfectly on Android 10, 11, 12, displays a wrong splashscreen on Android13 (icon of the app and not the splashscreen) but works perferctly and crashes at startup on Android 14!!!

 

5. I created a new project "Hello word" with Delphi12.1 and the app works on Android 14 withoud add a notion of RECEIVER_EXPORTED / RECEIVER_NOT_EXPORTED flag

 

6. I created a new project with Dephi12.1 and I imported the original project files of my app (unit1.pas, etc) and the app crashes on Android 14

 

 

Does anyone have any experience with Delphi, Android 14 and this notion of RECEIVER_EXPORTED / RECEIVER_NOT_EXPORTED flag?

Share this post


Link to post
3 hours ago, Fabian1648 said:

Does anyone have any experience with Delphi, Android 14 and this notion of RECEIVER_EXPORTED / RECEIVER_NOT_EXPORTED flag?

You might like to read this: https://developer.android.com/develop/background-work/background-tasks/broadcasts#context-registered-receivers

 

..and remember that I asked about what your code is doing. Presumably, part of it is registering a receiver at runtime, and it is not including RECEIVER_EXPORTED or RECEIVER_NOT_EXPORTED in the flags when calling registerReceiver.

  • Thanks 1

Share this post


Link to post
Posted (edited)

Hi,

 

I've solved my problem by changing a line in my TDataWedgeBroadcastListener.Create:

TAndroidHelper.Context.registerReceiver(FReceiver, LIntentFilter,2);

instead of

TAndroidHelper.Context.registerReceiver(FReceiver, LIntentFilter);

the value "2" corresponds to the Andoid flag RECEIVER_EXPORTED.

 

 

Thanks for the help

Edited by Fabian1648
  • Like 1

Share this post


Link to post

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

×