1

On android 7 everything works perfectly, but on android 12 it shows this error(in title). I've tried multiple solutions. None of them works. Flutter doctor

Doctor summary (to see all details, run flutter doctor -v):
[√] Flutter (Channel stable, 3.7.0, on Microsoft Windows [Version 10.0.19045.2364], locale en-US)
[√] Windows Version (Installed version of Windows is version 10 or higher)
Checking Android licenses is taking an unexpectedly long time...[√] Android toolchain - develop for Android devices 
(Android SDK version 33.0.0)
[√] Chrome - develop for the web
[√] Visual Studio - develop for Windows (Visual Studio Community 2022 17.3.6)
[√] Android Studio (version 2021.3)
[√] IntelliJ IDEA Community Edition (version 2022.3)
[√] Connected device (4 available)
[√] HTTP Host Availability

• No issues found!

Tried solution 2 and updated my build.gradle file (did not work) still show error (in title) build.gradle file

def localProperties = new Properties()
def localPropertiesFile = rootProject.file('local.properties')
if (localPropertiesFile.exists()) {
    localPropertiesFile.withReader('UTF-8') { reader ->
        localProperties.load(reader)
    }
}

def flutterRoot = localProperties.getProperty('flutter.sdk')
if (flutterRoot == null) {
    throw new GradleException("Flutter SDK not found. Define location with flutter.sdk in the local.properties file.")
}

def flutterVersionCode = localProperties.getProperty('flutter.versionCode')
if (flutterVersionCode == null) {
    flutterVersionCode = '1'
}

def flutterVersionName = localProperties.getProperty('flutter.versionName')
if (flutterVersionName == null) {
    flutterVersionName = '1.0'
}

apply plugin: 'com.android.application'
apply plugin: 'kotlin-android'
apply from: "$flutterRoot/packages/flutter_tools/gradle/flutter.gradle"

android {
    // compileSdkVersion flutter.compileSdkVersion
    compileSdkVersion 33
    ndkVersion flutter.ndkVersion

    compileOptions {
        sourceCompatibility JavaVersion.VERSION_1_8
        targetCompatibility JavaVersion.VERSION_1_8
    }

    kotlinOptions {
        jvmTarget = '1.8'
    }

    sourceSets {
        main.java.srcDirs += 'src/main/kotlin'
    }

    defaultConfig {
        // TODO: Specify your own unique Application ID (https://developer.android.com/studio/build/application-id.html).
        applicationId "com.botwrite.botwrite"
        // You can update the following values to match your application needs.
        // For more information, see: https://docs.flutter.dev/deployment/android#reviewing-the-gradle-build-configuration.
        // default // minSdkVersion flutter.minSdkVersion
        minSdkVersion 26
        // targetSdkVersion flutter.targetSdkVersion
        targetSdkVersion 33
        versionCode flutterVersionCode.toInteger()
        versionName flutterVersionName
        multiDexEnabled true
    }

    buildTypes {
        release {
            // TODO: Add your own signing config for the release build.
            // Signing with the debug keys for now, so `flutter run --release` works.
            signingConfig signingConfigs.debug
        }
    }
}

flutter {
    source '../..'
}

dependencies {
    implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlin_version"
    implementation "androidx.multidex:multidex:2.0.1"
}

AndroidManifest.xml

<manifest xmlns:android="http://schemas.android.com/apk/res/android"
    package="com.botwrite.botwrite">
    <uses-permission android:name="android.permission.RECORD_AUDIO"/>
    <uses-permission android:name="android.permission.INTERNET"/>
    <uses-permission android:name="android.permission.BLUETOOTH"/>
    <uses-permission android:name="android.permission.BLUETOOTH_ADMIN"/>
    <uses-permission android:name="android.permission.BLUETOOTH_CONNECT"/>
    <uses-permission android:name="android.permission.ACCESS_INTERNET"/>

    <queries>
        <intent>
            <action android:name="android.speech.RecognitionService" />
            <action android:name="TextToSpeech.Engine.INTENT_ACTION_TTS_SERVICE" />
        </intent>
    </queries>
   <application
        android:label="botwrite"
        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>

My pubspec.yaml file

name: botwrite
description: A new Flutter project.

publish_to: 'none'

version: 1.0.0+1

environment:
  sdk: '>=2.19.0 <3.0.0'

dependencies:
  build_runner: ^2.3.3
  carousel_slider: ^4.2.1
  cloud_firestore: ^4.3.1
  connectivity_plus: ^3.0.2
  cupertino_icons: ^1.0.5
  dropdown_button2: ^1.9.2
  email_validator: ^2.1.17
  firebase_auth: ^4.2.5
  firebase_core: ^2.4.1 
  flutter:
    sdk: flutter
  # flutter_launcher_icons: ^0.11.0
  flutter_native_splash: ^2.2.17
  flutter_riverpod: ^2.1.3
  flutter_spinkit: ^5.1.0
  flutter_svg: ^1.1.6
  flutter_tts: ^3.6.3
  go_router: ^6.0.1
  google_fonts: ^3.0.1
  http: ^0.13.5
  isar: ^3.0.5
  isar_flutter_libs: ^3.0.5
  isar_generator: ^3.0.5
  path_provider: ^2.0.12
  permission_handler: ^10.2.0
  salomon_bottom_bar: ^3.3.1
  string_validator: ^0.3.0

dev_dependencies:
  change_app_package_name: ^1.1.0
  flutter_lints: ^2.0.0
  flutter_test:
    sdk: flutter

flutter:
  uses-material-design: true
  assets:
    - assets/
    - assets/images/
    - assets/images/homepagecarouselimages/
    - assets/images/testimonials/profile/
    - assets/avatars/
    - assets/icons/
    - assets/logo/
  


# this is for the launcher icon
flutter_icons:
  android: true
  image_path: "assets/logo/botlogo.png"
  min_sdk_android: 21 # android min sdk min:16, default 21

flutter_native_splash:
  color: "#ffffff"
  image: assets/splash.png
  # run this command if splash doesn't work on android 12
  # flutter pub run flutter_native_splash:create
  android_12:
    color: "#ffffff"
    image: assets/splash.png

full debug console error

Launching lib\main.dart on V2061 in debug mode...
lib\main.dart:1
√  Built build\app\outputs\flutter-apk\app-debug.apk.
Error: ADB exited with exit code 1
Performing Streamed Install

adb: failed to install D:\projects\flutter_projects\MVCs\botwrite\build\app\outputs\flutter-apk\app-debug.apk: Failure [INSTALL_PARSE_FAILED_MANIFEST_MALFORMED: Failed parse during installPackageLI: /data/app/vmdl2112444397.tmp/base.apk (at Binary XML file line #23): intent tag may have at most one action.]
Error launching application on V2061.

Solutions I've tried

  1. https://stackoverflow.com/a/67916122/20302196 (android:exported="true" is already there) (most of the solutions say this)
  2. https://stackoverflow.com/a/75055556/20302196
  3. https://github.com/firebase/flutterfire/issues/8254#issue-1165223518 (see pubspec file for packages info)
  4. https://stackoverflow.com/a/48628738/20302196 (I've double checked names none of them are capital)
  5. https://github.com/firebase/flutterfire/issues/8254#issuecomment-1065104827 (see pubspec)

Google play says to not use package name like this "com.example.appname" so I updated my app's package name to this "com.botwrite.botwrite" using change_app_package_name from pub.dev and then it changed it in different files i.e AndroidManifest, MainActivity, and some other places. I'm mentioning this as some solutions say changing package names sometimes cause this problem. https://pub.dev/packages/change_app_package_name

I'll be grateful if you'll explain what causes this problem, so that I can address this specifically.

1 Answers1

0

You are getting error because of two action tags inside an intent tag.

    <queries>
        <intent>
            <action android:name="android.speech.RecognitionService" />
            <action android:name="TextToSpeech.Engine.INTENT_ACTION_TTS_SERVICE" />
        </intent>
    </queries>

Official Android documentation says that inside intent tag,

You must include exactly one <action> element.

Read more,

https://developer.android.com/training/package-visibility/declaring#intent-filter-signature

rrttrr
  • 1,393
  • 1
  • 6
  • 10