INSTALL_PARSE_FAILED_MANIFEST_MALFORMED: Failed parse during installPackageLI - android

Following error appearing while installing app on emulator.
'''Failed to commit install session 27757417 with command package install-commit 27757417. Error: INSTALL_PARSE_FAILED_MANIFEST_MALFORMED: Failed parse during installPackageLI: /data/app/vmdl27757417.tmp/base.apk (at Binary XML file line #57): com.nfs.mobility.myapp.activities.SplashActivity: Targeting S+ (version 31 and above) requires that an explicit value for android:exported be defined when intent filters are present''''

This error message "INSTALL_PARSE_FAILED_MANIFEST_MALFORMED: Failed parse during installPackageLI" appears when there is a problem with the AndroidManifest.xml file of the app.
In this particular case, the error message mentions that there is an issue with the com.nfs.mobility.myapp.activities.SplashActivity activity in the AndroidManifest.xml file, specifically that it is targeting Android 11 (S+) and above but doesn't have an explicit value for android:exported when intent filters are present.
Here are some of the solutions:
Check the AndroidManifest.xml file for errors such as missing tags,
incorrect formatting, or missing permissions
Make sure that the android:exported attribute is set to "true" for activities that should be accessible from other apps, or to "false" for activities that should not be.
Make sure that the activity's intent filters are correctly defined.
Try cleaning and rebuilding the project in Android Studio.
Try uninstalling the older version of the app from your device
before installing the new version.

Related

xamarin uploading app to play store with android 12 set eported=true issue

I am developing using Xamarin Forms and updated api to 31 and target framework to v12, uploading to the play store I am facing the error "You uploaded an APK or Android App Bundle which has an activity, activity alias, service or broadcast receiver with intent filter, but without 'android:exported' property set. This file can't be installed on Android 12 or higher. See: developer.android.com/about/versions/12/behavior-changes-12#exported".
But when I set android:exported=false or true in activity attribute above my activity then I am unable to get even local build with attribute duplication error. I am stuck on this issue and I am getting no idea what to do please guide.
I am developing using Xamarin Forms and updated api to 31 and target framework to v12, uploading to the play store I am facing the error "You uploaded an APK or Android App Bundle which has an activity, activity alias, service or broadcast receiver with intent filter, but without 'android:exported' property set. This file can't be installed on Android 12 or higher. See: developer.android.com/about/versions/12/behavior-changes-12#exported".
But when I set android:exported=false or true in activity attribute above my activity then I am unable to get even local build with the error "
Severity Code Description Project File Line Suppression State
Error System.InvalidOperationException: Duplicate attribute.
at System.Xml.Linq.XElement.AddAttributeSkipNotify(XAttribute a)
at System.Xml.Linq.XContainer.AddContentSkipNotify(Object content)
at System.Xml.Linq.XContainer.Add(Object content)
at Xamarin.Android.Tasks.ManifestDocument.AddLauncherIntentElements(XElement activity)
at Xamarin.Android.Tasks.ManifestDocument.<>c__DisplayClass99_0.<ActivityFromTypeDefinition>b__1(ActivityAttribute aa, XElement element)
at Xamarin.Android.Tasks.ManifestDocument.ToElement[TAttribute](TypeDefinition type, String name, Func`2 parser, Func`2 toElement, Action`2 update)
at Xamarin.Android.Tasks.ManifestDocument.ActivityFromTypeDefinition(TypeDefinition type, String name, Int32 targetSdkVersion)
at Xamarin.Android.Tasks.ManifestDocument.Merge(TaskLoggingHelper log, TypeDefinitionCache cache, List`1 subclasses, String applicationClass, Boolean embed, String bundledWearApplicationName, IEnumerable`1 mergedManifestDocuments)
at Xamarin.Android.Tasks.GenerateJavaStubs.Run(DirectoryAssemblyResolver res)
at Xamarin.Android.Tasks.GenerateJavaStubs.RunTask()
at Microsoft.Android.Build.Tasks.AndroidTask.Execute() in /Users/builder/azdo/_work/1/s/xamarin-android/external/xamarin-android-tools/src/Microsoft.Android.Build.BaseTasks/AndroidTask.cs:line 17 Infinity.Android"
. I am stuck on this issue and I am getting no idea what to do please guide.
and updated api to 31 and target framework to v12
After this, you can try to run your peoject on the Android 12 emulator or the physical device. And the visual studio logcat will show the error message to tell you which component does't declare the android:exported attribute and cause the issue.
There are two situations:
One is the component created by yourself didn't declare it. You can declare it just like Kelvyn Sinhorini said.
The other is the component is in the nuget packages you added in your project. You can update the nuget packages in your project to the last version to resolve it.

xamarin issue uploading app to play store with android 12 set eported=true

I am developing using Xamarin Forms and updated api to 31 and target framework to v12, uploading to the play store I am facing the error "You uploaded an APK or Android App Bundle which has an activity, activity alias, service or broadcast receiver with intent filter, but without 'android:exported' property set. This file can't be installed on Android 12 or higher. See: developer.android.com/about/versions/12/behavior-changes-12#exported". But when I set android:exported=false or true in activity attribute above my activity then I am unable to get even local build with the error "
At first, you can run your project with the visual studio. And the VS will show you which component doesn't declare the android:exported attribute and cause the problem.
And there are two possibilities.
One is the component was created by yourself, you can add the attribute in it such as [Service(Exported = false)].
Ther other is the component was created by the nuget packages you added in your project. Such as some libraries about firebase and google service. In this condition, you can update the packages in your project to the version which is compatible with the Android 12 or just update to the last version to resolve the problem.
In addition, you said:
But when I set android:exported=false or true in activity attribute above my activity then I am unable to get even local build with the error
You can try to run it on the device or the emulator with the Android 12.0 version. And just as the message you received said: Bundle which has an activity, activity alias, service or broadcast receiver with intent filter,. A component(activity, service, boardcast receiver) used the intent filter and didn't declare the android:exported attribute will show the message. Not all the activities need to declare this attribute.

Since update Xamarin.Android cannot build debug configuration without explicit manifest debug=true

I am in the process of upgrading a Xamarin Android application to SDK 31, monodroid 12 and the latest androidx packages.
Every thing is now up and running except if I do not add the android:debuggable=true attribute to the android manifest I can not create debug builds.
The issue does not happen for release builds
The output error is
Target _ManifestMerger:
/Library/Java/JavaVirtualMachines/microsoft-11.jdk/Contents/Home/bin/java -cp /Library/Frameworks/Xamarin.Android.framework/Libraries/xbuild/Xamarin/Android/manifestmerger.jar com.xamarin.manifestmerger.Main obj/Debug/android/manifestmerger.rsp
/Users/Projects/app/Droid/obj/Debug/AndroidManifest.xml:14:230-255 Error:
Attribute application#debuggable value=(true) from AndroidManifest.xml:14:230-255 is also present at AndroidManifest.xml:15:9-35 value=(false).
Suggestion: add 'tools:replace="android:debuggable"' to element at AndroidManifest.xml:14:3-56:17 to override.
/Library/Frameworks/Mono.framework/External/xbuild/Xamarin/Android/Xamarin.Android.Common.targets(1489,3): error MSB6006: "java" exited with code 1.
Done building target "_ManifestMerger" in project "Droid.csproj" -- FAILED.
To get this working I currently have applied the following to the application node in the AndroidManifest.xml
tools:replace="android:debuggable" android:debuggable="true"
I would really like to figure out what this is and get it removed for obvious reasons before release.

Unity android 12 with android:exported attribute issue

I would like to build the game in android 12. I know I need to add the android:exported="true" into activity tag which included intent-filter.
So I already added the android:exported="true" into activity tag in my AndroidManifest.xml. But I built on the android 12 device is still has error.
Installation failed due to: 'Failed to commit install session 1567366667 with command cmd package install-commit 1567366667. Error: INSTALL_PARSE_FAILED_MANIFEST_MALFORMED: Failed parse during installPackageLI: /data/app/vmdl1567366667.tmp/base.apk (at Binary XML file line #136): com.unity.purchasing.googleplay.VRPurchaseActivity: Targeting S+ (version 31 and above) requires that an explicit value for android:exported be defined when intent filters are present'
But I don't know what is VRPurchaseActivity and I don't add this activity to my AndroidManifest.xml.
So anyone know how to fix this issue. Thank a lots.
The activity comes from Unity but there is a way to override its attributes. Put this inside your manifest:
<activity android:name="com.unity.purchasing.googleplay.VRPurchaseActivity">
android:exported="false"
tools:node="merge" />

Resource error Xamarin.Forms (unexpected element & Ambiguity)

Suddenly having an error in my AndroidManifest
"APP.Android\obj\Debug\100\android\manifest\AndroidManifest.xml 19"
Also (Resolved - messed up with DevExpress)
Ambiguity between 'Resource.Layout' and 'Resource.Layout' "APP.Android\MainActivity.cs 25 Active"
It is working before and I didn't changed anything here:
TabLayoutResource = Resource.Layout.CustomTabbar;
Already delete the bin and obj folder and clean/rebuild the solution, but the error still exist.
Resource
AndroidManifest.xml
For the error (unexpected element queries found in manifest) in your
AndroidManifest.xml.
From document Query & Interact with Apps in Android 11 with Package Visibility, we could find that the queries element is a feature of Android 11, so you can try to update your nuget to the latest version and change your project Target Framework to Android 11 and try again.

Categories

Resources