Library version conflict?

I have big problems with my extension UrsMediaNotification on my new Motorola g15 with Android 15. Other android 15 devices have similar problems. The extension is used by many people, so I need to find a solution.

In my test program the extension is used in combination with the Taifunplayer. The TaifunPlayer alone works, as does the extension too. The app only hangs when the two are combined. There is also no meaningful error message, usually there is no message at all.

The extension uses the external library “androidx.media”, which I downloaded from the Maven repository. Depending on which version of this library I use, the program reacts differently. With some versions, for example, there is an error message that the ParcelUtils.putVersionedParcelable function is not available. The ParcelUtils class is provided by the App Inventor and does not in fact contain this function. If I include a different version of “androidx.media”, ParcelUtils.putVersionedParcelable is not required.

I suspect that there is a version conflict. My questions:

  1. How can I determine which versions are using App Inventor and which are using the extension?
  2. How does App Inventor recognize that I am using the version “androidx.media 1.7.0”, for example?

In the build.xml:

in the extension: @UsesLibraries(libraries = “androidx.media3.jar”)

I have looked at the .aix file, the external library is not included there. Or is it?

Translated with DeepL.com (free version)

Androidx media3 may require newer versions of other androidx libraries. It may also require additional dependencies. Which media3 module are you using? The pom file contains a list of dependencies with versions.

1 Like

Sorry, my fault. I don't use media 3. I use androidx.media. This ist the correct annotation: @UsesLibraries(libraries = “androidx.media.jar”)

Where do I find the pom file?

For building the extension I use https://github.com/mit-cml/appinventor-sources. I made a local copy at 2025-1-17.

Can you please post a sample project containing two extensions?

This is an example project:
Combined.aia (1.8 MB)

When the app is started for the first time, you can start the player, but not stop it.
The second time the app is started, only the splash screen is displayed. Nothing more.

The same is true if you use the AI2 build-in Player component.

Well, I tested your .aia on my Android 15 project and it just works fine. The player plays and I'm also able to stop it. (App also opens fine many times)

Also, I'm pretty sure the library error (you are facing) does not have anything to do with the Taifun Player.


Could you please attach an .aia file that uses your media notification error, to attempt a test a crash? I can help you debug.

1 Like

Same here (Pixel 7 Pro, Android 15).

2 Likes

Is this use of blocks correct? On my POCO with Android 15, not much works. The notification is displayed, but:

  • no progress on the bar
  • no duration displayed
  • no progress displayed
  • the notification can be removed despite setting the property to false

Generally, the problem is with the progress bar. But I don't see any errors due to class conflicts or missing classes. The ability to remove the notification is always there, they introduced it in Android 15, but media3 somehow copes with it.

1 Like

The code requires some modifications for newer Androids. I got a standard notification with which you can enter into interaction. I still need to add the ability to add custom buttons.

1 Like

Which Android version you are testing on?

15, but it's a POCO with Hyper OS, so it has the old notification look. That's how Xiaomi came up with it....

On my Samsung with Android 9 I get an error when starting the Service.

*** Uncaught remote exception! (Exceptions are not yet supported across processes.)
java.lang.RuntimeException: android.os.TransactionTooLargeException: data parcel size 742752 bytes
at android.os.Parcel.writeException(Parcel.java:1795)
at android.os.Binder.execTransact(Binder.java:754)

I think this is caused by passing the Notification object from the application to the Service, which is quite large, due to the size of the bitmap of the large icon. In my opinion, the notification should be created in the Service. In my opinion, this extension needs to be completely rebuilt.

1 Like

Yes, that's right, I noticed that too. Another reason is because in the newer Android versions, the services may run parallel to the app. So it's technically impossible to pass on objects b/w the foreground service and the app in some cases.

After some quick changes, it would be best to use this extension with the Itoo extension and let it manage the foreground service.

The class android.media.session.MediaSession for creating a media notification no longer works properly in the newer Android versions (from version 11). Therefore I want to use android/support/v4/media/session/MediaSessionCompat.

I compiled an empty project to see which classes App Inventor provides by default. Some of the android/support/v4 modules are available. Unfortunately, the media module is not:
AI2 supported classes

I have downloaded the module from the Maven repository and include it as an external library. Depending on which version of the module I use, there are different problems:

With version 1.4.1 and above I get the following error:
03-11 09:25:08.410 13539 13539 I Notifier: One button alert java.lang.NoSuchMethodError: No static method putVersionedParcelable(Landroid/os/Bundle;Ljava/lang/String;Landroidx/versionedparcelable/VersionedParcelable;)V in class Landroidx/versionedparcelable/ParcelUtils; or its super classes (declaration of 'androidx.versionedparcelable.ParcelUtils' appears in /data/app/~~WhDem8gqrljlBnmGMG-R8Q==/appinventor.ai_bienonline.UrsMediaNotification_3_X_148-Q2BqgqJKC2sqjVkaaXPhhQ==/base.apk!classes2.dex)

It says that Method Androidx/versionedparcelable/ParcelUtils.putVersionedParcelable is missing. Inspecting the apk of the empty projekt you can see, that this method is not present.
ParcelUtils
In the Maven repository you can find the package androidx.versionedparcelable. Newer versions of this package supply the missing function.

Conclusion: Version 1.4.1 of android/support/v4/media is to new for App Inventor.

With version 1.4.0 and below I get another error:

03-11 09:28:30.230 15570 15570 D MEDIA : Constructor: java.lang.IllegalArgumentException: appinventor.ai_bienonline.UrsMediaNotification_3_X_148: Targeting S+ (version 31 and above) requires that one of FLAG_IMMUTABLE or FLAG_MUTABLE be specified when creating a PendingIntent.
03-11 09:28:30.230 15570 15570 D MEDIA : Strongly consider using FLAG_IMMUTABLE, only use FLAG_MUTABLE if some functionality depends on the PendingIntent being mutable, e.g. if it needs to be used with inline replies or bubbles.
03-11 09:28:30.231 15570 15570 D MEDIA : java.lang.IllegalArgumentException: appinventor.ai_bienonline.UrsMediaNotification_3_X_148: Targeting S+ (version 31 and above) requires that one of FLAG_IMMUTABLE or FLAG_MUTABLE be specified when creating a PendingIntent.
03-11 09:28:30.231 15570 15570 D MEDIA : Strongly consider using FLAG_IMMUTABLE, only use FLAG_MUTABLE if some functionality depends on the PendingIntent being mutable, e.g. if it needs to be used with inline replies or bubbles.
03-11 09:28:30.231 15570 15570 D MEDIA : at android.app.PendingIntent.checkPendingIntent(PendingIntent.java:458)
03-11 09:28:30.231 15570 15570 D MEDIA : at android.app.PendingIntent.getBroadcastAsUser(PendingIntent.java:761)
03-11 09:28:30.231 15570 15570 D MEDIA : at android.app.PendingIntent.getBroadcast(PendingIntent.java:748)
03-11 09:28:30.231 15570 15570 D MEDIA : at android.support.v4.media.session.MediaSessionCompat.(MediaSessionCompat.java:568)
03-11 09:28:30.231 15570 15570 D MEDIA : at android.support.v4.media.session.MediaSessionCompat.(MediaSessionCompat.java:538)

That says Version 1.4.0 of android/support/v4/media is to old for the device.

Finally, I used version 1.3.1 and provided the constructor of the MediaSessionCompat instance with a self-created PendingIntent which is identical to the one from the class but has been provided with FLAG_MUTABLE. Now the MediaNotification is created and also displayed.
But if you call it, this error appears again: Method Androidx/versionedparcelable/ParcelUtils.putVersionedParcelableis missing

I hope that the errors will disappear if I can include a newer version of androidx.versionedparcelable.ParcelUtils. I already tried that, but then I couldn't compile the project anymore.

Is there an option to include a newer version of androidx.versionedparcelable.ParcelUtils?

If you are going to build an extension, it is best to use the Media3 library. You need to add Versionedparcelable in version 1.2 and the rest of the required androidx libraries. You need to use proguard to repack these libraries into another package and to reduce the size of the extension.

1 Like

Does Media3 require other Androidx dependencies, such as androidx.media, androidx.lifecycle, …?

Not directly, but eventually everything will have to be added to the extension. versionedparcelable will require other dependencies, and those dependencies will require other dependencies... and eventually the list will get long.

Why don't you use androidx lib? :thinking:

Now we have Sunny, Patryk, Xoma and Ulli, the crème de la crème of power users and extension developers on board for this problem and we should actually be able to find a solution… :joy: :pray: