Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Flutter app not compatible with Android 14 #137895

Closed
2 tasks done
zamargab opened this issue Nov 4, 2023 · 10 comments
Closed
2 tasks done

Flutter app not compatible with Android 14 #137895

zamargab opened this issue Nov 4, 2023 · 10 comments
Assignees
Labels
P1 High-priority issues at the top of the work list team-android Owned by Android platform team triaged-android Triaged by Android platform team

Comments

@zamargab
Copy link

zamargab commented Nov 4, 2023

Is there an existing issue for this?

Steps to reproduce

  1. Create a new flutter app
  2. without adding any package or making any changes, build the app
  3. Run on Android 14 Physical device

Expected results

The app should run perfectly with any compatibility warning.

Actual results

A user reported that my app showed a compatibility message on Android 14. (This app isn't compatible with the latest version of Android. Check for an update or contact the app's developer.) I decided to research ways to fix this issue but could not find any useful information.

I even created a fresh flutter project without adding packages or making changes, but the message still appears. I attached a screenshot of the message for reference.

Code sample

Code sample
[Paste your code here]

Screenshots or Video

Logs

Logs
[Paste your logs here]

Flutter Doctor output

Doctor output
Doctor summary (to see all details, run flutter doctor -v):
[✓] Flutter (Channel stable, 3.13.9, on macOS 13.3.1 22E261 darwin-x64, locale
    en-GB)
[!] Android toolchain - develop for Android devices (Android SDK version 34.0.0)
    ✗ cmdline-tools component is missing
      Run `path/to/sdkmanager --install "cmdline-tools;latest"`
      See https://developer.android.com/studio/command-line for more details.
    ✗ Android license status unknown.
      Run `flutter doctor --android-licenses` to accept the SDK licenses.
      See https://flutter.dev/docs/get-started/install/macos#android-setup for
      more details.
[✓] Xcode - develop for iOS and macOS (Xcode 14.3)
[✓] Chrome - develop for the web
[✓] Android Studio (version 2021.2)
[✓] VS Code (version 1.77.3)
[✓] Connected device (3 available)
[✓] Network resources
@huycozy huycozy added the in triage Presently being triaged by the triage team label Nov 6, 2023
@huycozy
Copy link
Member

huycozy commented Nov 6, 2023

Hi @zamargab
Does this issue only happen on a physical device? I checked this issue on emulator (same Android version) but can't reproduce it.

What happens after you click on OK button? Can you still use the app afterward?

Can you share this file content: /android/app/build.gradle?

@huycozy huycozy added the waiting for customer response The Flutter team cannot make further progress on this issue until the original reporter responds label Nov 6, 2023
@zamargab
Copy link
Author

zamargab commented Nov 6, 2023

It happens only on physical devices. For the version of my app in production, when the user clicks on the ok button, the message disappears but the app often crashes at intervals.

for my production app.

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 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: 'com.google.gms.google-services'
apply plugin: 'kotlin-android'
apply from: "$flutterRoot/packages/flutter_tools/gradle/flutter.gradle"

   def keystoreProperties = new Properties()
   def keystorePropertiesFile = rootProject.file('key.properties')
   if (keystorePropertiesFile.exists()) {
       keystoreProperties.load(new FileInputStream(keystorePropertiesFile))
   }
  
  
android {
    compileSdkVersion 34
    ndkVersion flutter.ndkVersion

    // compileOptions {
    //     sourceCompatibility JavaVersion.VERSION_1_1
    //     targetCompatibility JavaVersion.VERSION_1_1
    // }
  

    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.paysure.peppa"
        // You can update the following values to match your application needs.
        // For more information, see: https://docs.flutter.dev/deployment/android#reviewing-the-build-configuration.
        minSdkVersion 24
        targetSdkVersion 34
        versionCode flutterVersionCode.toInteger()
        versionName flutterVersionName
    }

   signingConfigs {
       release {
           keyAlias keystoreProperties['keyAlias']
           keyPassword keystoreProperties['keyPassword']
           storeFile keystoreProperties['storeFile'] ? file(keystoreProperties['storeFile']) : null
           storePassword keystoreProperties['storePassword']
       }
   }
   buildTypes {
       release {
            lintOptions {

                disable 'InvalidPackage'
                disable "Instantiatable"
                checkReleaseBuilds false
                abortOnError false

            }
           signingConfig signingConfigs.release
       }
   }


}

flutter {
    source '../..'
}

dependencies {
    implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlin_version"
    implementation 'com.android.installreferrer:installreferrer:2.2'
    testImplementation 'junit:junit:4.13'
    implementation 'com.google.android.gms:play-services-ads-identifier:18.0.1'
    implementation platform('com.google.firebase:firebase-bom:31.2.3')
    implementation 'com.google.firebase:firebase-analytics'
    implementation "com.clevertap.android:push-templates:1.0.5"
    //start
    implementation 'com.google.firebase:firebase-messaging:21.0.0'
    implementation 'androidx.appcompat:appcompat:1.3.1'
    implementation 'androidx.recyclerview:recyclerview:1.2.1'
    implementation 'androidx.viewpager:viewpager:1.0.0'
    implementation 'com.google.android.material:material:1.4.0'
    implementation 'com.github.bumptech.glide:glide:4.12.0'

    //end
    implementation 'androidx.core:core:1.3.0'
    implementation 'androidx.fragment:fragment:1.3.6'
    implementation 'com.facebook.android:facebook-android-sdk:latest.release'

    
}

apply plugin: 'com.google.gms.google-services'

for the fresh flutter app i created to try solve this issue. I did not make any changes or add any packages. I only created the app then built an apk

plugins {
    id "com.android.application"
    id "kotlin-android"
    id "dev.flutter.flutter-gradle-plugin"
}

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

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

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

android {
    namespace "com.example.control_peppa"
    compileSdkVersion flutter.compileSdkVersion
    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.example.control_peppa"
        // 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.
        minSdkVersion flutter.minSdkVersion
        targetSdkVersion flutter.targetSdkVersion
        versionCode flutterVersionCode.toInteger()
        versionName flutterVersionName
    }

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

@github-actions github-actions bot removed the waiting for customer response The Flutter team cannot make further progress on this issue until the original reporter responds label Nov 6, 2023
@DaveLomber
Copy link

We have same issue

Screenshot 2023-11-06 at 15 41 27

@mossmana mossmana added P1 High-priority issues at the top of the work list team-android Owned by Android platform team triaged-android Triaged by Android platform team and removed in triage Presently being triaged by the triage team labels Nov 6, 2023
@reidbaker
Copy link
Contributor

We are digging into this but currently do not know why your app is seeing this dialog.
This reddit post seems to indicate it is happening to pure android apps as well. https://beta.reddit.com/r/androidapps/comments/17bp21f/this_app_isnt_compatible_with_the_latest_version/?sort=confidence

The only thing I see in your build file that looks old is the version of java (1.8) but I think that was/is part of the flutter template and have no specific evidence that is the issue.

@reidbaker reidbaker self-assigned this Nov 6, 2023
@reidbaker
Copy link
Contributor

@reidbaker
Copy link
Contributor

@zamargab can you try to build with split abis and see if you use the 64 bit version the dialog goes away?
https://docs.flutter.dev/deployment/android#build-an-apk

Further digging into the android code shows that the dialog might only appear one time per package. https://cs.android.com/android/platform/superproject/main/+/main:frameworks/base/services/core/java/com/android/server/wm/DeprecatedAbiDialog.java;l=44?q=AppWarnings.FLAG_HIDE_DEPRECATED_ABI%20-f:strings.xml

@reidbaker reidbaker added the waiting for customer response The Flutter team cannot make further progress on this issue until the original reporter responds label Nov 6, 2023
@faaqi
Copy link

faaqi commented Nov 7, 2023

I built the release Android App bundle and shared it via internal testing. It works fine on other versions but shows black screen for Android 14. @reidbaker

@zamargab
Copy link
Author

zamargab commented Nov 8, 2023

I performed a split build, and we installed the 64-bit version of the app on an Android 14 device., the dialog did not appear. The issue of sporadically displaying a blank screen still persists. This problem is similar to what @faaqi also mentioned. This is only happening on Android 14 devices.

@github-actions github-actions bot removed the waiting for customer response The Flutter team cannot make further progress on this issue until the original reporter responds label Nov 8, 2023
@reidbaker
Copy link
Contributor

OK can one of yall file a different issue for the black screen on android 14 (with reproduction code). I am going to close this since I think we have confirmed the dialog is unrelated to android 14.

Copy link

This thread has been automatically locked since there has not been any recent activity after it was closed. If you are still experiencing a similar issue, please open a new bug, including the output of flutter doctor -v and a minimal reproduction of the issue.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Nov 22, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
P1 High-priority issues at the top of the work list team-android Owned by Android platform team triaged-android Triaged by Android platform team
Projects
None yet
Development

No branches or pull requests

6 participants