Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Flutter release apk not accepted by Google Play Console

I created a key and keystore and signed my apk, following the instructions step by step from the official flutter page.

But when I try to upload it to Google Play Console, I get this error:

"You uploaded an APK or Android App Bundle that was signed in debug mode. You need to sign your APK or Android App Bundle in release mode"

A similar question is asked before, but it did not solve my issue.

Here is the relevant part of my app/build.gradle:

android {
compileSdkVersion 28

lintOptions {
    disable 'InvalidPackage'
}

defaultConfig {
    // TODO: Specify your own unique Application ID (https://developer.android.com/studio/build/application-id.html).
    applicationId "my.package.name"
    minSdkVersion 16
    targetSdkVersion 28
    versionCode flutterVersionCode.toInteger()
    versionName flutterVersionName
    //testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
}

signingConfigs {
    release {
        keyAlias keystoreProperties['keyAlias']
        keyPassword keystoreProperties['keyPassword']
        storeFile file(keystoreProperties['storeFile'])
        storePassword keystoreProperties['storePassword']
    }
}

buildTypes {
    release {
        signingConfig signingConfigs.release

        minifyEnabled true
        useProguard true

        proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
    }
}

Here is the screenshot of my Android Studio versions (Android SDK being red is not relevant.):

Screenshot of Android Studio showing the used versions.

My output.json file:

[
  {
    "outputType": {
      "type": "APK"
    },
    "apkInfo": {
      "type": "MAIN",
      "splits": [
        
      ],
      "versionCode": 1,
      "versionName": "1.0.0",
      "enabled": true,
      "outputFile": "app-release.apk",
      "fullName": "release",
      "baseName": "release"
    },
    "path": "app-release.apk",
    "properties": {
      
    }
  }
]
like image 401
Melih Durmaz Avatar asked Feb 24 '19 08:02

Melih Durmaz


People also ask

How do I add flutter app to Google Play console?

Add app icon, splash screen, app name:: To set up an app icon you need an icon image: Make an assets folder inside your project and store the app icon inside it. Go to your pubspec. yaml file and add this code.

Can I upload APK to Google Play console?

Upload the App's APK File to Google PlayIn your browser, go to the address , click Developer Console and log in with your Android Developer account credentials. Click the Add New Application button to begin adding your app to Google Play. Select the language and the name of your app. Press the Upload APK button.


1 Answers

No suggestions seemed to be working. Then, a

flutter clean

and all issues were solved. I could create an apk either through Android Studio or the command line. Thanks to VikaS and Harsha pulikollu

like image 130
Melih Durmaz Avatar answered Oct 19 '22 14:10

Melih Durmaz