我是一名 Flutter 开发者。 我用 Flutter 编写了一个应用程序。 当我在 Android 中运行我的应用程序时 <13 everything works fine. But when I try to run my app on Android 13 I got this error: INSTALL_PARSE_FAILED_MANIFEST_MALFORMED.
UPD:
最终的 Android Manifest 如下所示:
<?xml version="1.0" encoding="utf-8"?>
<manifest
xmlns:android="http://schemas.android.com/apk/res/android"
android:versionCode="1"
android:versionName="1.0.0"
android:compileSdkVersion="33"
android:compileSdkVersionCodename="13"
package="com.example.yulsun_app"
platformBuildVersionCode="33"
platformBuildVersionName="13">
<uses-sdk
android:minSdkVersion="21"
android:targetSdkVersion="33" />
<uses-permission
android:name="android.permission.INTERNET" />
<queries>
<intent>
<action
android:name="android.intent.action.VIEW" />
<category
android:name="android.intent.category.DEFAULT" />
<category
android:name="android.intent.category.BROWSABLE" />
<data
android:scheme="tel" />
<data
android:scheme="http" />
<data
android:scheme="https" />
</intent>
<intent>
<action
android:name="android.support.customtabs.action.CustomTabsService" />
</intent>
</queries>
<uses-permission
android:name="android.permission.FOREGROUND_SERVICE" />
<uses-permission
android:name="android.permission.ACCESS_BACKGROUND_LOCATION" />
<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_NETWORK_STATE" />
<permission
android:name="com.example.yulsun_app.DYNAMIC_RECEIVER_NOT_EXPORTED_PERMISSION"
android:protectionLevel="0x2" />
<uses-permission
android:name="com.example.yulsun_app.DYNAMIC_RECEIVER_NOT_EXPORTED_PERMISSION" />
<application
android:label="yulsun_app"
android:icon="@ref/0x7f0d0000"
android:name="android.app.Application"
android:debuggable="true"
android:testOnly="true"
android:appComponentFactory="androidx.core.app.CoreComponentFactory">
<activity
android:theme="@ref/0x7f1000a3"
android:name="com.example.yulsun_app.MainActivity"
android:exported="true"
android:launchMode="1"
android:configChanges="0x40003fb4"
android:windowSoftInputMode="0x10"
android:hardwareAccelerated="true">
<meta-data
android:name="io.flutter.embedding.android.NormalTheme"
android:resource="@ref/0x7f1000a4" />
<intent-filter>
<action
android:name="android.intent.action.MAIN" />
<category
android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
<meta-data
android:name="flutterEmbedding"
android:value="2" />
<service
android:name="com.google.firebase.components.ComponentDiscoveryService"
android:exported="false"
android:directBootAware="true">
<meta-data
android:name="com.google.firebase.components:io.flutter.plugins.firebase.auth.FlutterFirebaseAuthRegistrar"
android:value="com.google.firebase.components.ComponentRegistrar" />
<meta-data
android:name="com.google.firebase.components:io.flutter.plugins.firebase.core.FlutterFirebaseCoreRegistrar"
android:value="com.google.firebase.components.ComponentRegistrar" />
<meta-data
android:name="com.google.firebase.components:com.google.firebase.auth.FirebaseAuthRegistrar"
android:value="com.google.firebase.components.ComponentRegistrar" />
</service>
<activity
android:theme="@ref/0x7f100005"
android:name="com.pichillilorenzo.flutter_inappwebview.in_app_browser.InAppBrowserActivity"
android:exported="false"
android:configChanges="0x400035b4" />
<activity
android:theme="@ref/0x7f100117"
android:name="com.pichillilorenzo.flutter_inappwebview.chrome_custom_tabs.ChromeCustomTabsActivity"
android:exported="false" />
<activity
android:theme="@ref/0x7f100117"
android:name="com.pichillilorenzo.flutter_inappwebview.chrome_custom_tabs.TrustedWebActivity"
android:exported="false" />
<activity
android:theme="@ref/0x7f100117"
android:name="com.pichillilorenzo.flutter_inappwebview.chrome_custom_tabs.ChromeCustomTabsActivitySingleInstance"
android:exported="false"
android:launchMode="3" />
<activity
android:theme="@ref/0x7f100117"
android:name="com.pichillilorenzo.flutter_inappwebview.chrome_custom_tabs.TrustedWebActivitySingleInstance"
android:exported="false"
android:launchMode="3" />
<receiver
android:name="com.pichillilorenzo.flutter_inappwebview.chrome_custom_tabs.ActionBroadcastReceiver"
android:enabled="true"
android:exported="false" />
<meta-data
android:name="io.flutter.embedded_views_preview"
android:value="true" />
<activity
android:theme="@ref/0x01030007"
android:name="io.flutter.plugins.urllauncher.WebViewActivity"
android:exported="false" />
<service
android:name="com.lyokone.location.FlutterLocationService"
android:enabled="true"
android:exported="false"
android:foregroundServiceType="0x8" />
<uses-library
android:name="androidx.window.extensions"
android:required="false" />
<uses-library
android:name="androidx.window.sidecar"
android:required="false" />
<activity
android:theme="@ref/0x01030010"
android:name="com.google.firebase.auth.internal.GenericIdpActivity"
android:exported="true"
android:excludeFromRecents="true"
android:launchMode="2">
<intent-filter>
<action
android:name="android.intent.action.VIEW" />
<category
android:name="android.intent.category.DEFAULT" />
<category
android:name="android.intent.category.BROWSABLE" />
<data
android:scheme="genericidp"
android:host="firebase.auth"
android:path="/" />
</intent-filter>
</activity>
<activity
android:theme="@ref/0x01030010"
android:name="com.google.firebase.auth.internal.RecaptchaActivity"
android:exported="true"
android:excludeFromRecents="true"
android:launchMode="2">
<intent-filter>
<action
android:name="android.intent.action.VIEW" />
<category
android:name="android.intent.category.DEFAULT" />
<category
android:name="android.intent.category.BROWSABLE" />
<data
android:scheme="recaptcha"
android:host="firebase.auth"
android:path="/" />
</intent-filter>
</activity>
<activity
android:theme="@ref/0x01030010"
android:name="com.google.android.gms.common.api.GoogleApiActivity"
android:exported="false" />
<provider
android:name="com.google.firebase.provider.FirebaseInitProvider"
android:exported="false"
android:authorities="com.example.yulsun_app.firebaseinitprovider"
android:initOrder="100"
android:directBootAware="true" />
<meta-data
android:name="com.google.android.gms.version"
android:value="@ref/0x7f090004" />
<provider
android:name="androidx.startup.InitializationProvider"
android:exported="false"
android:authorities="com.example.yulsun_app.androidx-startup">
<meta-data
android:name="androidx.emoji2.text.EmojiCompatInitializer"
android:value="androidx.startup" />
<meta-data
android:name="androidx.lifecycle.ProcessLifecycleInitializer"
android:value="androidx.startup" />
</provider>
</application>
</manifest>
而且我发现了这个问题: 无法使用命令包 install-commit 242963872 提交安装会话 242963872。错误:INSTALL_PARSE_FAILED_MANIFEST_MALFORMED:installPackageLI 期间解析失败:/data/app/vmdl242963872.tmp/base.apk(在二进制 XML 文件第 #18 行):意图标记可能位于大多数数据方案。
正确的清单应该如下所示:
<manifest xmlns:android="http://schemas.android.com/apk/res/android">
<!-- Permissions -->
<uses-permission android:name="android.permission.FOREGROUND_SERVICE" />
<uses-permission android:name="android.permission.ACCESS_BACKGROUND_LOCATION"/>
<uses-permission android:name="android.permission.INTERNET"/>
<queries>
<!-- Query for tel scheme -->
<intent>
<action android:name="android.intent.action.VIEW" />
<category android:name="android.intent.category.DEFAULT" />
<category android:name="android.intent.category.BROWSABLE" />
<data android:scheme="tel" />
</intent>
<!-- Query for http scheme -->
<intent>
<action android:name="android.intent.action.VIEW" />
<category android:name="android.intent.category.DEFAULT" />
<category android:name="android.intent.category.BROWSABLE" />
<data android:scheme="http" />
</intent>
<!-- Query for https scheme -->
<intent>
<action android:name="android.intent.action.VIEW" />
<category android:name="android.intent.category.DEFAULT" />
<category android:name="android.intent.category.BROWSABLE" />
<data android:scheme="https" />
</intent>
</queries>
<application
android:label="yulsun_app"
android:name="${applicationName}"
android:icon="@mipmap/ic_launcher">
<activity
android:name=".MainActivity"
android:exported="true"
android:launchMode="singleTop"
android:theme="@style/LaunchTheme"
android:configChanges="orientation|keyboardHidden|keyboard|screenSize|smallestScreenSize|locale|layoutDirection|fontScale|screenLayout|density|uiMode"
android:hardwareAccelerated="true"
android:windowSoftInputMode="adjustResize">
<!-- Specifies an Android theme to apply to this Activity as soon as
the Android process has started. This theme is visible to the user
while the Flutter UI initializes. After that, this theme continues
to determine the Window background behind the Flutter UI. -->
<meta-data
android:name="io.flutter.embedding.android.NormalTheme"
android:resource="@style/NormalTheme"
/>
<intent-filter>
<action android:name="android.intent.action.MAIN"/>
<category android:name="android.intent.category.LAUNCHER"/>
</intent-filter>
</activity>
<!-- Don't delete the meta-data below.
This is used by the Flutter tool to generate GeneratedPluginRegistrant.java -->
<meta-data
android:name="flutterEmbedding"
android:value="2" />
</application>
</manifest>