CommunityToolkit / Maui

The .NET MAUI Community Toolkit is a community-created library that contains .NET MAUI Extensions, Advanced UI/UX Controls, and Behaviors to help make your life as a .NET MAUI developer easier

Home Page:https://learn.microsoft.com/dotnet/communitytoolkit/maui

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

[BUG] Unable to install APK with MediaElement on Android below 7.1

ricardommatias opened this issue · comments

Is there an existing issue for this?

  • I have searched the existing issues

Did you read the "Reporting a bug" section on Contributing file?

Current Behavior

When trying to install an APK with CommunityToolkit.Maui.MediaElement package on Android below 7.1, I get the following error during install:
Failure [INSTALL_PARSE_FAILED_MANIFEST_MALFORMED]

Exploring logcat, I find the following:

W/PackageManager( 1530): Failed parse during installPackageLI
W/PackageManager( 1530): android.content.pm.PackageParser$PackageParserException: /data/app/vmdl1876558975.tmp/base.apk (at Binary XML file line #17): does not have valid android:name
W/PackageManager( 1530): at android.content.pm.PackageParser.parseBaseApk(PackageParser.java:870)
W/PackageManager( 1530): at android.content.pm.PackageParser.parseClusterPackage(PackageParser.java:776)
W/PackageManager( 1530): at android.content.pm.PackageParser.parsePackage(PackageParser.java:740)
W/PackageManager( 1530): at com.android.server.pm.PackageManagerService.installPackageLI(PackageManagerService.java:10446)
W/PackageManager( 1530): at com.android.server.pm.PackageManagerService.access$2300(PackageManagerService.java:233)
W/PackageManager( 1530): at com.android.server.pm.PackageManagerService$6.run(PackageManagerService.java:8531)
W/PackageManager( 1530): at android.os.Handler.handleCallback(Handler.java:739)
W/PackageManager( 1530): at android.os.Handler.dispatchMessage(Handler.java:95)
W/PackageManager( 1530): at android.os.Looper.loop(Looper.java:135)
W/PackageManager( 1530): at android.os.HandlerThread.run(HandlerThread.java:61)
W/PackageManager( 1530): at com.android.server.ServiceThread.run(ServiceThread.java:46)

Line #17 of the AndroidManifest file:
<service android:name="CommunityToolkit.Maui.Media.Services" android:enabled="true" android:exported="false" android:foregroundServiceType="mediaPlayback" />

I believe this is due to the service name starting with an uppercase character which causes the instalation to fail on older Android versions. Starting with Android 7.1, this issue does not seem to be triggered on install.

Expected Behavior

Since Maui's minimum Android version is 5.0, the CommunityToolkit should also function properly on all Android versions equal or above this version.

Steps To Reproduce

  1. Create a new Maui application
  2. Add CommunityToolkit.Maui.MediaElement package
  3. Create an archive
  4. Install the archive on an Android version below 7.1 using adb install

Link to public reproduction project repository

https://github.com/ricardommatias/ReproductionProject

Environment

- .NET MAUI CommunityToolkit: 9.0.2
- OS: Android 5.0
- .NET MAUI: 8.0.70
- MediaElement: 4.0.1

Anything else?

No response

@vhugogarcia Can you mark this as confirmed? I verified using repo sample app.