我的flutter应用程序没有安装在Android 12版本上。我尝试使用android:exported
,但没有任何效果。它显示了这种类型的错误-
✓ Built build/app/outputs/flutter-apk/app-debug.apk.
Installing build/app/outputs/flutter-apk/app.apk... 3.3s
Error: ADB exited with exit code 1
Performing Streamed Install
adb: failed to install /Users/abir/Documents/Office
Work/MediMate-App-Old-Version/build/app/outputs/flutter-apk/app.apk: Failure
[INSTALL_PARSE_FAILED_MANIFEST_MALFORMED: Failed parse during installPackageLI:
/data/app/vmdl489268217.tmp/base.apk (at Binary XML file line #125):
io.flutter.plugins.firebasemessaging.FlutterFirebaseMessagingService: Targeting S+ (version 31 and above)
requires that an explicit value for android:exported be defined when intent filters are present]
Error launching application on sdk gphone64 x86 64.
这是我的AndroidManifest.xml
文件
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="care.example.health">
<uses-permission android:name="android.permission.READ_PHONE_STATE"/>
<uses-permission android:name="android.permission.INTERNET" />
<uses-permission android:name="android.permission.RECORD_AUDIO" />
<uses-permission android:name="android.permission.CAMERA" />
<uses-permission android:name="android.permission.MODIFY_AUDIO_SETTINGS" />
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE"/>
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE"/>
<!-- The Agora SDK requires Bluetooth permissions in case users are using Bluetooth devices.-->
<uses-permission android:name="android.permission.BLUETOOTH" />
<uses-permission android:name="android.permission.RECEIVE_BOOT_COMPLETED"/>
<uses-permission android:name="android.permission.VIBRATE" />
<uses-permission android:name="android.permission.INTERNET" />
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
<uses-permission android:name="android.permission.ACCESS_FINE_LOCATION" />
<application
android:label="example"
android:name="${applicationName}"
android:icon="@mipmap/ic_launcher">
<activity
android:exported="true"
android:name=".MainActivity"
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
android:exported="false">
<action android:name="android.intent.action.MAIN"/>
<category android:name="android.intent.category.LAUNCHER"/>
</intent-filter>
<intent-filter
android:exported="false">
<action android:name="FLUTTER_NOTIFICATION_CLICK" />
<category android:name="android.intent.category.DEFAULT" />
</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>
我错过了什么?
5条答案
按热度按时间5vf7fwbs1#
如果你在android studio模拟器上运行flutter应用程序时收到此错误消息,这为我解决了问题!
1.找到您的androidManifest.xml文件
在您的项目文件所在的android studio的右角,请遵循以下路径:
“您的项目名称”
Image showing file path in android studio with yellow highelighter
2.在AndroidManifest.xml文件中,找到以下代码集:
Image showing the section between the two perpendicular red lines
3.将此行复制并粘贴到“〈activity”和下一个"〉“之间的某个位置。
安卓系统:导出=“true”Image showing the line pasted in between the yellow'<activity' and '<'
你的问题现在应该解决了!
如果问题仍然存在:
z5btuh9x2#
甚至我也面临着同样的问题。我能够通过直接在插件中添加特定服务的以下代码来克服它。
您可以在以下路径中找到插件代码
h79rfbju3#
根据您的问题,您的问题已经到达FlutterFirebaseMessagingService。如果您在日志中看到已经提到
你只需要从intent-filter中删除多余的android:exported=“false”。
如果插件没有更新,也更新它们
vwoqyblh4#
从Android 12开始,将此属性添加到需要为活动编写此属性,并且您的设备具有Android API级别31,即Android - 12
tp5buhyn5#
很简单添加这行代码
android:exported="true"
AndroidManifest.xml安卓系统/app/src/main/安卓系统清单. xml x1c 0d1x