Can not install app from PlayStore for Android 12 targetSDK 31

Issue

Recently User can download the app but after download, app is not getting install

I’ve added android:exported"true" in manifest but still facing the issue, If there is anything that I’m missing the please help me to solve it.

build.gradle

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.")
}

apply plugin: 'com.android.application'
apply plugin: 'kotlin-android'
apply from: "$flutterRoot/packages/flutter_tools/gradle/flutter.gradle"
apply plugin: 'com.google.gms.google-services'
apply plugin: 'com.google.firebase.crashlytics'

android {
    compileSdkVersion 31

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

    defaultConfig {
        applicationId "packagename"
        minSdkVersion 24
        targetSdkVersion 31
        versionCode 27
        versionName "2.14"
        multiDexEnabled true
    }

    buildTypes {
        release {
            signingConfig signingConfigs.debug
            minifyEnabled true
            proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
        }
    }
}

flutter {
    source '../..'
}

dependencies {
    implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlin_version"
    implementation platform('com.google.firebase:firebase-bom:28.3.1')
    implementation 'com.google.firebase:firebase-crashlytics'
    implementation 'com.google.firebase:firebase-analytics'
    implementation 'com.android.support:multidex:1.0.3'
}

AndroidManifest

<manifest xmlns:android"http://schemas.android.com/apk/res/android"
    package"---">

    <application
        android:icon"@mipmap/ic_launcher"
        android:label"AppName"
        android:usesCleartextTraffic"true"
        android:requestLegacyExternalStorage"true">

        <activity
            android:name".MainActivity"
            android:configChanges"orientation|keyboardHidden|keyboard|screenSize|smallestScreenSize|locale|layoutDirection|fontScale|screenLayout|density|uiMode"
            android:hardwareAccelerated"true"
            android:exported"true"
            android:launchMode"singleTop"
            android:theme"@style/LaunchTheme"
            android:showWhenLocked"true"
            android:turnScreenOn"true"
            android:windowSoftInputMode"adjustResize">

            <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>

            <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:host"appdomain.ca"
                    android:pathPrefix"/user"
                    android:scheme"https" />
                <data
                    android:host"appdomain.ca"
                    android:pathPrefix"/post"
                    android:scheme"https" />
                <data
                    android:host"appdomain.ca"
                    android:pathPrefix"/business"
                    android:scheme"https" />
            </intent-filter>

            <meta-data
                android:name"io.flutter.embedding.android.SplashScreenDrawable"
                android:resource"@drawable/launch_background" />
            <meta-data
                android:name"io.flutter.embedding.android.NormalTheme"
                android:resource"@style/NormalTheme" />
        </activity>

        <activity
            android:name"com.yalantis.ucrop.UCropActivity"
            android:screenOrientation"portrait"
            android:theme"@style/Theme.AppCompat.Light.NoActionBar" />
        <meta-data
            android:name"com.google.firebase.messaging.default_notification_icon"
            android:resource"@mipmap/ic_notification" />
        <meta-data
            android:name"com.google.firebase.messaging.default_notification_color"
            android:resource"@color/colorPrimary" />
        <meta-data
            android:name"com.google.firebase.messaging.default_notification_channel_id"
            android:value"high_importance_channel" />
        <!-- 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>
    <queries>
        <intent>
            <action android:name"android.intent.action.VIEW" />
            <data android:scheme"https" />
        </intent>
        <intent>
            <action android:name"android.intent.action.DIAL" />
            <data android:scheme"tel" />
        </intent>
        <intent>
            <action android:name"android.intent.action.SEND" />
            <data android:mimeType"*/*" />
        </intent>
    </queries>

    <uses-permission android:name"android.permission.READ_EXTERNAL_STORAGE" />
    <uses-permission android:name"android.permission.ACCESS_NETWORK_STATE" />

    <uses-permission android:name"android.permission.INTERNET" />

    <uses-permission android:name"android.permission.CAMERA" />
    <uses-permission android:name"android.permission.WAKE_LOCK"/>
    <uses-permission android:name"android.permission.FOREGROUND_SERVICE"/>
    <uses-permission android:name"android.permission.WRITE_EXTERNAL_STORAGE" />
</manifest>

Solution

The issue was with the old version of flutter_local_notifications. So if anyone facing the same issue then first update your all dependencies then move ahead.

Answered By – Priyesh

Leave a Comment