【发布时间】:2022-07-29 20:09:17
【问题描述】:
我正在用 Flutter 开发一个应用程序。它曾经工作正常,我一直在安装它,在手机上使用它 2 个月。今天突然,当我运行这个命令flutter run时出现以下错误。
adb: failed to install D: \Flutter BLE May 2022\ SW_Mobile_Platform\ build\ app\ outputs\ flutter - apk\ app.apk: Failure[INSTALL_PARSE_FAILED_MANIFEST_MALFORMED:
Failed parse during installPackageLI: /data/app / vmdl116305539.tmp / base.apk(at Binary XML file line #187):
org.altbeacon.beacon.startup.StartupBroadcastReceiver: Targeting S+ (version 31 and above) requires that an explicit value for android:exported be defined when
intent filters are present]
我已经在我的活动清单中添加了android:exported="true"。这是我的Manifest 文件:
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.example.ble_app_flutter">
<uses-permission android:name="android.permission.BLUETOOTH" />
<uses-permission android:name="android.permission.BLUETOOTH_ADMIN" />
<uses-permission android:name="android.permission.ACCESS_FINE_LOCATION" />
<uses-permission android:name="android.permission.ACCESS_COARSE_LOCATION" />
<uses-permission android:name="android.permission.BLUETOOTH_CONNECT" />
<uses-permission android:name="android.permission.BLUETOOTH_SCAN" />
<uses-permission android:name="android.permission.BLUETOOTH_SCAN" />
<uses-permission android:name="android.permission.INTERNET" />
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
<uses-permission android:name="android.permission.ACCESS_WIFI_STATE" />
<uses-permission android:name="android.permission.CHANGE_WIFI_STATE" />
<uses-permission android:name="android.permission.BLUETOOTH_ADVERTISE" />
<uses-permission android:name="android.permission.FOREGROUND_SERVICE" />
<uses-permission android:name="android.permission.ACCESS_BACKGROUND_LOCATION" />
<uses-feature
android:name="android.hardware.bluetooth.le"
android:required="true" />
<application
android:name="${applicationName}"
android:icon="@mipmap/ic_launcher"
android:label="ble_app_flutter"
android:usesCleartextTraffic="true">
<activity
android:name=".BLEActivity"
android:configChanges="orientation|keyboardHidden|keyboard|screenSize|smallestScreenSize|locale|layoutDirection|fontScale|screenLayout|density|uiMode"
android:exported="true"
android:hardwareAccelerated="true"
android:launchMode="singleTop"
android:theme="@style/LaunchTheme"
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" />
<meta-data
android:name="io.flutter.embedding.android.SplashScreenDrawable"
android:resource="@drawable/launch_background" />
<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>
【问题讨论】: