0

I want run a existing project. It's fully run on under Android 12 but when I going to run a samsung phone which version is Android 12. Then I get this type of error.

Error :

✓  Built build/app/outputs/flutter-apk/app-release.apk (104.1MB).
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/appName-App-Old-Version/build/app/outputs/flutter-apk/app.apk: Failure
[INSTALL_PARSE_FAILED_MANIFEST_MALFORMED: Failed parse during installPackageLI:
/data/app/vmdl2043233695.tmp/base.apk (at Binary XML file line #124):
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 running application on SM G781B.

Here is my AndroidManifest.xml file :

<manifest xmlns:android="http://schemas.android.com/apk/res/android"
    package="care.appname.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="appname"
        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>
            <intent-filter>
                <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>

I tried android:exported="true" true and false also. But nothing is worked. How can I solve this ?

Abir Ahsan
  • 2,649
  • 29
  • 51
  • have you added it in main/mainfest.xml file ? if yes then try to do flutter clean and rebuild again. are you using firebase _messaging latest one ? – Hardik Mehta Apr 20 '22 at 08:17
  • @HardikMehta I shared mainfest.xml on my question. tried to do flutter clean and rebuild but didn't work . I told that, it's an exiting project (before null safety), so is there any chance to use latest version of firebase _messaging ? – Abir Ahsan Apr 20 '22 at 08:58
  • you can try by using th version of firebase_messaging : ^11.1.0 and let me know – Hardik Mehta Apr 20 '22 at 09:34

1 Answers1

3

Add service to application, it's work for me.

<service android:name="io.flutter.plugins.firebasemessaging.FlutterFirebaseMessagingService" android:exported="true"/>
MKR KH
  • 31
  • 4