Deployment error when Targeting to Android 12
🐛 Bug Report
Deployment error when Targeting to Android 12.
/Library/Frameworks/Mono.framework/External/xbuild/Xamarin/Android/Xamarin.Android.Common.Debugging.targets(604,5): error ADB0010: Mono.AndroidTools.InstallFailedException: Unexpected install output: Failure [INSTALL_PARSE_FAILED_MANIFEST_MALFORMED: Failed parse during installPackageLI: /data/app/vmdl2068875903.tmp/base.apk (at Binary XML file line #73): crc6494e14b9856016c30.PNFirebaseMessagingService: Targeting S+ (version 31 and above) requires that an explicit value for android:exported be defined when intent filters are present]
/Library/Frameworks/Mono.framework/External/xbuild/Xamarin/Android/Xamarin.Android.Common.Debugging.targets(604,5): error ADB0010:
/Library/Frameworks/Mono.framework/External/xbuild/Xamarin/Android/Xamarin.Android.Common.Debugging.targets(604,5): error ADB0010: at Mono.AndroidTools.Internal.AdbOutputParsing.CheckInstallSuccess (System.String output, System.String packageName) [0x0018a] in /Users/builder/azdo/_work/1/s/xamarin-android/external/monodroid/tools/msbuild/external/androidtools/Mono.AndroidTools/Internal/AdbOutputParsing.cs:350
/Library/Frameworks/Mono.framework/External/xbuild/Xamarin/Android/Xamarin.Android.Common.Debugging.targets(604,5): error ADB0010: at Mono.AndroidTools.AndroidDevice+<>c__DisplayClass100_0.<InstallPackage>b__0 (System.Threading.Tasks.Task1[TResult] t) [0x00016] in /Users/builder/azdo/_work/1/s/xamarin-android/external/monodroid/tools/msbuild/external/androidtools/Mono.AndroidTools/AndroidDevice.cs:803 /Library/Frameworks/Mono.framework/External/xbuild/Xamarin/Android/Xamarin.Android.Common.Debugging.targets(604,5): error ADB0010: at System.Threading.Tasks.ContinuationTaskFromResultTask1[TAntecedentResult].InnerInvoke () [0x00024] in
Expected behavior
Reproduction steps
Configuration
Version: 1.x
Platform:
- [ ] :robot: Android
Main issue identified from the log
crc6494e14b9856016c30.PNFirebaseMessagingService: Targeting S+ (version 31 and above) requires that an explicit value for android:exported be defined when intent filters are present]
Same issue with version 2.3.6 when Targeting Android 12.
Same issue on 3.4.1, any solution?
Will the bug be fixed in the near future? Should be really simple:
[Service**(Exported = false)**] [IntentFilter(new[] {"com.google.firebase.MESSAGING_EVENT"})] public class PNFirebaseMessagingService: FirebaseMessagingService
Until the library is updated, you only need to add this to your AndroidManifest.xml under application key:
<receiver android:name="crc6494e14b9856016c30.PNFirebaseMessagingService" android:exported="false">
<intent-filter>
<action android:name="com.google.firebase.MESSAGING_EVENT" />
</intent-filter>
</receiver>
Edit: solution found here
<receiver android:name="crc6494e14b9856016c30.PNFirebaseMessagingService" android:exported="false"> <intent-filter> <action android:name="com.google.firebase.MESSAGING_EVENT" /> </intent-filter> </receiver>
This configuration brokes receiving notifications
[Service(Exported = false)]
[IntentFilter(new[] { "com.google.firebase.MESSAGING_EVENT" })]
public class PNFirebaseMessagingServiceEx : PNFirebaseMessagingService
{
}
Until the library is updated, you only need to add this to your AndroidManifest.xml under
applicationkey:<receiver android:name="crc6494e14b9856016c30.PNFirebaseMessagingService" android:exported="false"> <intent-filter> <action android:name="com.google.firebase.MESSAGING_EVENT" /> </intent-filter> </receiver>Edit: solution found here
This solved my issue. Thank you.