android - 上传可调试的 Flutter 应用程序时出现 Google Play 错误

标签 android flutter google-play-console

我使用 Google Play 应用签名、Flutter 和 VS Code 已经有一段时间了,但从昨天开始,我正在处理的每个 Flutter 项目的每个发布版本都不断遇到错误并报告我正在尝试上传调试版本。

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

即使是新应用也会遇到同样的问题

我已经清理了构建文件夹,我使用了 --release 标志,这两个选项都不起作用。

我想尝试的一件事是手动编译应用程序,手动签名然后上传,但不知道如何做到这一点。

有什么建议吗?扯掉头发,因为我想不出最近有什么变化会影响到这一点。

flutter 医生输出 - 唯一奇怪的是缺少 VS Code flutter 扩展 - 它不是:-/

✓] Flutter (Channel beta, v0.5.1, on Mac OS X 10.13.6 17G65, locale en-GB) • Flutter version 0.5.1 at /Users/kenwen/Dev Tools/flutter • Framework revision c7ea3ca377 (10 weeks ago), 2018-05-29 21:07:33 +0200 • Engine revision 1ed25ca7b7 • Dart version 2.0.0-dev.58.0.flutter-f981f09760

[✓] Android toolchain - develop for Android devices (Android SDK 28.0.1) • Android SDK at /Users/kenwen/Library/Android/sdk • Android NDK location not configured (optional; useful for native profiling support) • Platform android-28, build-tools 28.0.1 • Java binary at: /Applications/Android Studio.app/Contents/jre/jdk/Contents/Home/bin/java • Java version OpenJDK Runtime Environment (build 1.8.0_152-release-1024-b01) • All Android licenses accepted.

[✓] iOS toolchain - develop for iOS devices (Xcode 9.4.1) • Xcode at /Applications/Xcode.app/Contents/Developer • Xcode 9.4.1, Build version 9F2000 • ios-deploy 1.9.2 • CocoaPods version 1.5.2

[✓] Android Studio (version 3.1) • Android Studio at /Applications/Android Studio.app/Contents • Flutter plugin version 27.0.1 • Dart plugin version 173.4700 • Java version OpenJDK Runtime Environment (build 1.8.0_152-release-1024-b01)

[!] VS Code (version 1.25.1) • VS Code at /Applications/Visual Studio Code.app/Contents • Flutter extension not installed; install from https://marketplace.visualstudio.com/items?itemName=Dart-Code.flutter

[!] Connected devices ! No devices available

! Doctor found issues in 2 categories.

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 from: "$flutterRoot/packages/flutter_tools/gradle/flutter.gradle"

android {
    compileSdkVersion 27

    lintOptions {
        disable 'InvalidPackage'
    }

    defaultConfig {
        // TODO: Specify your own unique Application ID 
(https://developer.android.com/studio/build/application-id.html).
        applicationId "uk.co.kenliu.meanfitfoxes"
        minSdkVersion 21
        targetSdkVersion 27
        versionCode 21
        versionName "1.7.9"
        testInstrumentationRunner 
"android.support.test.runner.AndroidJUnitRunner"
    }

    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 {
    testImplementation 'junit:junit:4.12'
    androidTestImplementation 'com.android.support.test:runner:1.0.1'
    androidTestImplementation 'com.android.support.test.espresso:espresso-core:3.0.1'
    }

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

最佳答案

您必须为 Release模式创建签名配置,在您当前的文件中,您正在使用来自调试的签名配置。

 buildTypes {
    release {
        signingConfig signingConfigs.debug   //for this reason google doesn't allow you to upload the apk
    }
}

在你的 gradle 文件中创建一个签名配置:

        android {
            ...
            signingConfigs {
                release {
                    storeFile file("release.keystore")
                    storePassword "******"
                    keyAlias "******"
                    keyPassword "******"
                }
            }
            buildTypes {
                release {
                    signingConfig signingConfigs.release
                }
            }
        }

关于android - 上传可调试的 Flutter 应用程序时出现 Google Play 错误,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/51688791/

相关文章:

android - IntentService 的 onStartCommand(..) 方法线程安全吗?

flutter - 不从 flutter 中的 csv 查看表格布局

android - 从 Google Play 中删除过时的测试版

google-play-console - 无法在 Google Play Console 中发布应用的初始版本

ios - 如何在 flutter 中设置 CupertinoDatePicker 小部件的最短时间?

android - 如何在 Google Play 管理中心中设置 "Ads"设置

android - 只更新数据库内容

android - 在 Android 中测试 GPS

android - 从 Android 1.6 到 Android 2.2 的升级和应用程序不起作用

flutter 。 listview.builder 上方的小部件与其他内容一起滚动?