My flutter project can build and install in android 11 device,but cannot install in android 12.
I was fix my androidManifest.xml,
this is my androidManifest.xml,android:exported="true"
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools" package="com.rdap.Flutter_app">
<application tools:replace="android:label" android:name="${applicationName}" android:label="SAFER" android:icon="@mipmap/ic_launcher" android:usesCleartextTraffic="true" android:requestLegacyExternalStorage="true">
<meta-data android:name="com.google.android.geo.API_KEY" android:value="AIzaSyAVxdQ8qChnxcH989uPoVPmK6XBuzhapf0"/>
<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">
<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>
<intent-filter>
<action android:name="FLUTTER_NOTIFICATION_CLICK" />
<category android:name="android.intent.category.DEFAULT" />
</intent-filter>
</activity>
<!-- facebook login setting -->
<meta-data android:name="com.facebook.sdk.ApplicationId" android:value="@string/facebook_app_id"/>
<activity android:name="com.facebook.FacebookActivity" android:exported="true" android:configChanges=
"keyboard|keyboardHidden|screenLayout|screenSize|orientation" android:label="@string/app_name" />
<activity android:name="com.facebook.CustomTabActivity" android:exported="true">
<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="@string/fb_login_protocol_scheme" />
</intent-filter>
</activity>
<meta-data android:name="flutterEmbedding" android:value="2" />
<activity android:name="com.yalantis.ucrop.UCropActivity" android:exported="true" android:screenOrientation="portrait" android:theme="@style/Theme.AppCompat.Light.NoActionBar"/>
</application>
<!-- Flutter_Blue required permission, for bluetooth connection. -->
<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.ACCESS_BACKGROUND_LOCATION"/>
<uses-permission android:name="android.permission.FOREGROUND_SERVICE" />
<uses-permission android:name="android.permission.INTERNET"/>
<!-- <uses-permission android:name="android.permission.CAMERA"/> -->
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE"/>
<uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE"/>
</manifest>
this is my pubspec.yaml Can I find which packages are not support android 12?
name: Flutter_app
description: A new Flutter project.
# The following line prevents the package from being accidentally published to
# pub.dev using `pub publish`. This is preferred for private packages.
publish_to: 'none' # Remove this line if you wish to publish to pub.dev
# The following defines the version and build number for your application.
# A version number is three numbers separated by dots, like 1.2.43
# followed by an optional build number separated by a .
# Both the version and the builder number may be overridden in flutter
# build by specifying --build-name and --build-number, respectively.
# In Android, build-name is used as versionName while build-number used as versionCode.
# Read more about Android versioning at https://developer.android.com/studio/publish/versioning
# In iOS, build-name is used as CFBundleShortVersionString while build-number used as CFBundleVersion.
# Read more about iOS versioning at
# https://developer.apple.com/library/archive/documentation/General/Reference/InfoPlistKeyReference/Articles/CoreFoundationKeys.html
version: 1.2.0
environment:
sdk: ">=2.7.0 <3.0.0"
dependencies:
flutter:
sdk: flutter
google_sign_in: ^5.0.3
animated_splash_screen: ^1.3.0
auto_size_text: ^2.1.0
font_awesome_flutter: ^8.2.0
url_launcher: ^6.0.3
cupertino_icons: ^1.0.0
flutter_picker: ^1.1.5 #https://pub.dev/packages/flutter_picker
date_format: ^1.0.8 #https://pub.dev/packages/date_format
google_maps_flutter: ^2.0.3
dio: ^4.0.0
uni_links: ^0.4.0
geolocator: ^7.0.3
shake_animation_widget: ^2.0.0
shared_preferences: ^2.0.5
provider: ^4.0.4
sqflite: ^1.1.3
path: ^1.6.2
flutter_facebook_auth: ^3.5.5
image_picker: ^0.7.4
image_cropper: ^1.2.1
socket_io_client: ^0.9.2
laravel_echo: ^0.2.9
flutter_animarker: ^3.2.0
animator: ^3.0.0
animations: ^2.0.0
progress_state_button: ^1.0.3
flutter_map: 0.13.1
flutter_map_marker_cluster: ^0.3.4
circle_wheel_scroll: ^0.0.1 1
network_image_to_byte: ^0.0.1
flutter_staggered_animations: ^1.0.0
# background_locator: 1.5.0 1
path_provider: ^2.0.2
firebase_messaging: ^10.0.4
flutter_local_notifications: ^8.1.1 2
http: ^0.13.3
flutter_bluetooth_serial: ^0.4.0
#使用相機相册換頭貼
# camera: ^0.8.1 3
image_crop: ^0.4.0
workmanager: ^0.4.1
flutter_background_service: ^0.1.5
fluttertoast: ^8.0.8
timer_count_down: ^2.2.0
permission_handler: ^8.1.2
flutter_slidable: ^0.6.0
timer_controller: ^0.1.0
firebase_dynamic_links: ^2.0.7
numberpicker: ^2.1.1
# geocoder: ^0.2.1
maps_toolkit: ^2.0.0
# location: ^4.3.0
flutter_image_compress: ^1.1.0
custom_info_window: ^1.0.1
flutter_vlc_player: 6.0.4
device_apps: ^2.1.1
android_intent: ^2.0.2
external_app_launcher: ^2.0.2
# The following adds the Cupertino Icons font to your application.
# Use with the CupertinoIcons class for iOS style icons.
dev_dependencies:
flutter_test:
sdk: flutter
flutter_launcher_icons: ^0.7.3
dcdg: ^2.0.1
when I $flutter run
in pixel 4a android 12,get this error
Warning: Mapping new ns http://schemas.android.com/repository/android/common/02 to old ns http://schemas.android.com/repository/android/common/01
Warning: Mapping new ns http://schemas.android.com/repository/android/generic/02 to old ns http://schemas.android.com/repository/android/generic/01
Warning: Mapping new ns http://schemas.android.com/sdk/android/repo/addon2/02 to old ns http://schemas.android.com/sdk/android/repo/addon2/01
Warning: Mapping new ns http://schemas.android.com/sdk/android/repo/addon2/03 to old ns http://schemas.android.com/sdk/android/repo/addon2/01
Warning: Mapping new ns http://schemas.android.com/sdk/android/repo/repository2/02 to old ns http://schemas.android.com/sdk/android/repo/repository2/01
Warning: Mapping new ns http://schemas.android.com/sdk/android/repo/repository2/03 to old ns http://schemas.android.com/sdk/android/repo/repository2/01
Warning: Mapping new ns http://schemas.android.com/sdk/android/repo/sys-img2/03 to old ns http://schemas.android.com/sdk/android/repo/sys-img2/01
Warning: Mapping new ns http://schemas.android.com/sdk/android/repo/sys-img2/02 to old ns http://schemas.android.com/sdk/android/repo/sys-img2/01
Invalid depfile: /Users/xuziting/Desktop/r-dap/safer/Flutter_app/.dart_tool/flutter_build/a43daed7116dc29ff59eedcdb44b75c3/kernel_snapshot.d
Invalid depfile: /Users/xuziting/Desktop/r-dap/safer/Flutter_app/.dart_tool/flutter_build/a43daed7116dc29ff59eedcdb44b75c3/kernel_snapshot.d
Running Gradle task 'assembleDebug'... 20.7s
✓ Built build/app/outputs/flutter-apk/app-debug.apk.
Installing build/app/outputs/flutter-apk/app.apk... 89.8s
Error: ADB exited with exit code 1
Performing Streamed Install
adb: failed to install /Users/xuziting/Desktop/r-dap/safer/Flutter_app/build/app/outputs/flutter-apk/app.apk: Failure [INSTALL_PARSE_FAILED_MANIFEST_MALFORMED:
Failed parse during installPackageLI: /data/app/vmdl1393465418.tmp/base.apk (at Binary XML file line #194):
com.dexterous.flutterlocalnotifications.ScheduledNotificationBootReceiver: Targeting S (version 31 and above) requires that an explicit value for
android:exported be defined when intent filters are present]
How can I fix this problem?
CodePudding user response:
You can run
flutter pub outdated
This will display all packages that are outdated and its latest versions
https://dart.dev/tools/pub/cmd/pub-outdated
CodePudding user response:
This issue is because flutter_local_notifications package. Issue Fixed in flutter_local_notifications:9.0.0
You can upgrade flutter_local_notifications version to the latest to get worked in Android 12