AndroidX
AndroidX copied to clipboard
Xamarin.AndroidX.Core
Android application type
Android for .NET (net6.0-android, etc.)
Affected platform version
.net 6.0.302
Description
On some devices when xamarin.androidx.core is updated from 1.8.0.1 to 1.9.0. Application fails to install on device due to:
Caused by: com.android.ddmlib.InstallException: Failed to commit install session 1384392458 with command pm install-commit 1384392458. Error: INSTALL_PARSE_FAILED_MANIFEST_MALFORMED: Failed parse during installPackageLI: /data/app/vmdl1384392458.tmp/base.apk (at Binary XML file line #27): Bad class name My.App.development.DYNAMIC_RECEIVER_NOT_EXPORTED_PERMISSION in package My.App.developmentl.
this is caused by using application id that has upper case letters. When application id is changed to my.app.development, issue disappear.
Steps to Reproduce
Create new xamarin android application .net6.0-android Set name to My.App.development Add Xamarin.AndroidX.Core 1.9.0
Deploy to specific device (for me it's point mobile pm80). Similar issue was reported here https://github.com/xamarin/xamarin-android/issues/1335 for Huawei devices.
Did you find any workaround?
No response
Relevant log output
No response
Looks like in androidx.core:core
version 1.9.0
the following was added to the included AndroidManifest.xml
:
<permission
android:name="${applicationId}.DYNAMIC_RECEIVER_NOT_EXPORTED_PERMISSION"
android:protectionLevel="signature" />
<uses-permission android:name="${applicationId}.DYNAMIC_RECEIVER_NOT_EXPORTED_PERMISSION" />
(Source)
If that doesn't allow an upper case application id then I'm not sure there's anything we can do.
Yes, it's imported from androidx.core. I have found a hacky solution if anyone will have similar issue. It's enough to add following to csproj:
<PropertyGroup>
<AndroidManifestMerger>manifestmerger.jar</AndroidManifestMerger>
</PropertyGroup>
and then add following in AndroidManifest.xml file:
<permission tools:node="remove"
android:name="My.App.development.DYNAMIC_RECEIVER_NOT_EXPORTED_PERMISSION"
android:protectionLevel="signature"/>
<uses-permission tools:node="remove"
android:name="My.App.development.DYNAMIC_RECEIVER_NOT_EXPORTED_PERMISSION"/>