英文:
INSTALL_PARSE_FAILED_MANIFEST_MALFORMED error on android 13 using xamarin.forms
问题
I am using Xamarin Forms for my project to develop an Android application. I got the error below when I updated the android:targetSdkVersion
from 30 to 33.
My AndroidManifest.xml code:
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android" android:installLocation="internalOnly" package="com.myapplication.app" android:versionName="2.6.1" android:versionCode="16">
<uses-sdk android:minSdkVersion="24" android:targetSdkVersion="33" />
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
<uses-permission android:name="android.permission.ACCESS_WIFI_STATE" />
<uses-permission android:name="android.permission.INTERNET" />
<uses-permission android:name="android.permission.ACCESS_COARSE_LOCATION" />
<uses-permission android:name="android.permission.ACCESS_FINE_LOCATION" />
<uses-permission android:name="android.permission.ACCESS_LOCATION_EXTRA_COMMANDS" />
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />
<uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE" />
<uses-permission android:name="android.permission.WAKE_LOCK" />
<uses-feature android:name="android.hardware.telephony" android:required="false" />
<uses-feature android:name="android.hardware.location" android:required="false" />
<uses-feature android:name="android.hardware.location.gps" android:required="false" />
<uses-feature android:name="android.hardware.camera" android:required="false" />
<uses-feature android:name="android.hardware.location.network" android:required="false" />
<!--<uses-permission android:name="android.permission.ACCESS_LOCATION_EXTRA_COMMANDS" />
<uses-permission android:name="android.permission.ACCESS_MOCK_LOCATION" />-->
<uses-permission android:name="android.permission.CALL_PHONE" android:required="false" />
<application android:allowBackup="true" android:requestLegacyExternalStorage="true" android:label="FieldDirect" android:largeHeap="true" android:theme="@style/MyTheme">
<uses-library android:name="org.apache.http.legacy" android:required="false" />
<meta-data android:name="com.google.firebase.messaging.default_notification_icon" android:resource="@drawable/icon_transparent" />
<meta-data android:name="com.google.firebase.messaging.default_notification_color" android:resource="@color/brown" />
<meta-data android:name="com.google.android.geo.API_KEY" android:value="MyKey" />
<receiver android:name="com.google.firebase.iid.FirebaseInstanceIdInternalReceiver" android:exported="false" />
<receiver android:name="com.google.firebase.iid.FirebaseInstanceIdReceiver" android:exported="true" android:permission="com.google.android.c2dm.permission.SEND">
<intent-filter>
<action android:name="com.google.android.c2dm.intent.RECEIVE" />
<action android:name="com.google.android.c2dm.intent.REGISTRATION" />
<category android:name="${applicationId}" />
</intent-filter>
</receiver>
<provider android:name="android.support.v4.content.FileProvider" android:authorities="com.myapplication.app.fileprovider" android:exported="false" android:grantUriPermissions="true">
<meta-data android:name="android.support.FILE_PROVIDER_PATHS" android:resource="@xml/file_paths" />
</provider>
</application>
</manifest>
Please anyone help to resolve this issue.
英文:
I am using xamarin forms for my project to develop android application. I got the error below when i udate the android:targetSdkVersion from 30 to 33.
> Severity Code Description Project File Line Suppression State Error
> ADB0010: Mono.AndroidTools.InstallFailedException: Unexpected install
> output: Failure [INSTALL_PARSE_FAILED_MANIFEST_MALFORMED: Failed parse
> during installPackageLI: /data/app/vmdl417360231.tmp/base.apk (at
> Binary XML file line #50): crc64bf328679f9896e0c.MyFirebaseIIDService:
> Targeting S+ (version 31 and above) requires that an explicit value
> for android:exported be defined when intent filters are present]
>
> at
> Mono.AndroidTools.Internal.AdbOutputParsing.CheckInstallSuccess(String
> output, String packageName) in
> /Users/runner/work/1/s/xamarin-android/external/monodroid/tools/msbuild/external/androidtools/Mono.AndroidTools/Internal/AdbOutputParsing.cs:line
> 357 at System.Threading.Tasks.Task.Execute()
> --- End of stack trace from previous location where exception was thrown --- at
> System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw() at
> System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task
> task) at
> AndroidDeviceExtensions.<PushAndInstallPackageAsync>d__12.MoveNext()
> in
> /Users/runner/work/1/s/xamarin-android/external/monodroid/tools/msbuild/external/androidtools/Xamarin.AndroidTools/Devices/AndroidDeviceExtensions.cs:line
> 208
> --- End of stack trace from previous location where exception was thrown --- at
> System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw() at
> AndroidDeviceExtensions.<PushAndInstallPackageAsync>d__12.MoveNext()
> in
> /Users/runner/work/1/s/xamarin-android/external/monodroid/tools/msbuild/external/androidtools/Xamarin.AndroidTools/Devices/AndroidDeviceExtensions.cs:line
> 225
> --- End of stack trace from previous location where exception was thrown --- at
> System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw() at
> System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task
> task) at
> Xamarin.Android.Tasks.FastDeploy.<InstallPackage>d__106.MoveNext() in
> /Users/runner/work/1/s/xamarin-android/external/monodroid/tools/msbuild/Tasks/FastDeploy.cs:line
> 351
> --- End of stack trace from previous location where exception was thrown --- at
> System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw() at
> Xamarin.Android.Tasks.FastDeploy.<InstallPackage>d__106.MoveNext() in
> /Users/runner/work/1/s/xamarin-android/external/monodroid/tools/msbuild/Tasks/FastDeploy.cs:line
> 368
> --- End of stack trace from previous location where exception was thrown --- at
> System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw() at
> System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task
> task) at
> Xamarin.Android.Tasks.FastDeploy.<RunTaskAsync>d__100.MoveNext() in
> /Users/runner/work/1/s/xamarin-android/external/monodroid/tools/msbuild/Tasks/FastDeploy.cs:line
> 216 0
My AndroidManifest.xml code:
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android" android:installLocation="internalOnly" package="com.myapplication.app" android:versionName="2.6.1" android:versionCode="16">
<uses-sdk android:minSdkVersion="24" android:targetSdkVersion="33" />
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
<uses-permission android:name="android.permission.ACCESS_WIFI_STATE" />
<uses-permission android:name="android.permission.INTERNET" />
<uses-permission android:name="android.permission.ACCESS_COARSE_LOCATION" />
<uses-permission android:name="android.permission.ACCESS_FINE_LOCATION" />
<uses-permission android:name="android.permission.ACCESS_LOCATION_EXTRA_COMMANDS" />
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />
<uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE" />
<uses-permission android:name="android.permission.WAKE_LOCK" />
<uses-feature android:name="android.hardware.telephony" android:required="false" />
<uses-feature android:name="android.hardware.location" android:required="false" />
<uses-feature android:name="android.hardware.location.gps" android:required="false" />
<uses-feature android:name="android.hardware.camera" android:required="false" />
<uses-feature android:name="android.hardware.location.network" android:required="false" />
<!--<uses-permission android:name="android.permission.ACCESS_LOCATION_EXTRA_COMMANDS" />
<uses-permission android:name="android.permission.ACCESS_MOCK_LOCATION" />-->
<uses-permission android:name="android.permission.CALL_PHONE" android:required="false" />
<application android:allowBackup="true" android:requestLegacyExternalStorage="true" android:label="FieldDirect" android:largeHeap="true" android:theme="@style/MyTheme">
<uses-library android:name="org.apache.http.legacy" android:required="false" />
<meta-data android:name="com.google.firebase.messaging.default_notification_icon" android:resource="@drawable/icon_transparent" />
<meta-data android:name="com.google.firebase.messaging.default_notification_color" android:resource="@color/brown" />
<meta-data android:name="com.google.android.geo.API_KEY" android:value="MyKey" />
<receiver android:name="com.google.firebase.iid.FirebaseInstanceIdInternalReceiver" android:exported="false" />
<receiver android:name="com.google.firebase.iid.FirebaseInstanceIdReceiver" android:exported="true" android:permission="com.google.android.c2dm.permission.SEND">
<intent-filter>
<action android:name="com.google.android.c2dm.intent.RECEIVE" />
<action android:name="com.google.android.c2dm.intent.REGISTRATION" />
<category android:name="${applicationId}" />
</intent-filter>
</receiver>
<provider android:name="android.support.v4.content.FileProvider" android:authorities="com.myapplication.app.fileprovider" android:exported="false" android:grantUriPermissions="true">
<meta-data android:name="android.support.FILE_PROVIDER_PATHS" android:resource="@xml/file_paths" />
</provider>
</application>
</manifest>
Please anyone help to resolve this issue.
答案1
得分: 1
[INSTALL_PARSE_FAILED_MANIFEST_MALFORMED: Failed parse during
installPackageLI: /data/app/vmdl417360231.tmp/base.apk (at Binary XML
file line #50): crc64bf328679f9896e0c.MyFirebaseIIDService: Targeting
S+ (version 31 and above) requires that an explicit value for
android:exported be defined when intent filters are present]
From document Safer component exporting,we could find that
If your app targets Android 12 or higher and contains activities,
services, or broadcast receivers that use intent filters, you must
explicitly declare theandroid:exported
attribute for these app
components.
and we can notice the warning as follows:
Warning: If an activity, service, or broadcast receiver uses intent
filters and doesn't have an explicitly-declared value for
android:exported
, your app can't be installed on a device that runs
Android 12 or higher.
From the error log you posted above, you can recheck if you have added android:exported
to MyFirebaseIIDService.cs
For example:
[Service(Exported=true, Name="com.xamarin.example.DemoService")]
public class MyFirebaseIIDService : Service
{
}
英文:
> [INSTALL_PARSE_FAILED_MANIFEST_MALFORMED: Failed parse during
> installPackageLI: /data/app/vmdl417360231.tmp/base.apk (at Binary XML
> file line #50): crc64bf328679f9896e0c.MyFirebaseIIDService: Targeting
> S+ (version 31 and above) requires that an explicit value for
> android:exported be defined when intent filters are present]
From document Safer component exporting,we could find that
> If your app targets Android 12 or higher and contains activities,
> services, or broadcast receivers that use intent filters, you must
> explicitly declare the android:exported
attribute for these app
> components.
and we can notice the warning as follows:
> Warning: If an activity, service, or broadcast receiver uses intent
> filters and doesn't have an explicitly-declared value for
> android:exported
, your app can't be installed on a device that runs
> Android 12 or higher.
From the error log you posted above, you can recheck if you have added android:exported
to MyFirebaseIIDService.cs
For example:
[Service(Exported=true, Name="com.xamarin.example.DemoService")]
public class MyFirebaseIIDService : Service
{
}
通过集体智慧和协作来改善编程学习和解决问题的方式。致力于成为全球开发者共同参与的知识库,让每个人都能够通过互相帮助和分享经验来进步。
评论