其他分享
首页 > 其他分享> > android – 上传Flutter app debuggable时出现Google Play错误

android – 上传Flutter app debuggable时出现Google Play错误

作者:互联网

我一直在使用谷歌播放应用程序签名,Flutter和VS代码一段时间没有问题,但从昨天开始,我正在处理的每个Flutter项目的每个版本都会出现错误并报告我正在尝试上传调试版本.

“您上传了以调试模式签名的APK或Android App Bundle.您需要在发布模式下签署您的APK或Android App Bundle”

即使是新的应用程序也存在同样的问题

我已经清理了构建文件夹,我使用了–release标志,这两个选项都没有用.

我想尝试的一件事是手动编译应用程序,手动签名然后上传,但无法解决如何执行此操作.

有什么建议么?撕掉头发,因为我无法想到最近可能会影响这种情况的任何变化.

颤动的医生输出 – 只有一点奇怪的是VS Code flutter扩展缺失 – 它不是: – /

✓] Flutter(频道测试版,v0.5.1,在Mac OS X 10.13.6 17G65上,locale en-GB)
    •Flutter版本0.5.1 at / Users / kenwen / Dev Tools / flutter
    •框架修订版c7ea3ca377(10周前),2018-05-29 21:07:33 0200
    •发动机修订版1ed25ca7b7
    •Dart版本2.0.0-dev.58.0.flutter-f981f09760

[✓] Android工具链 – 针对Android设备开发(Android SDK 28.0.1)
    •位于/ Users / kenwen / Library / Android / sdk的Android SDK
    •未配置Android NDK位置(可选;对本机分析支持很有用)
    •平台android-28,构建工具28.0.1
    •Java二进制文件:/ Applications / Android Studio.app/Contents/jre/jdk/Contents/Home/bin/java
    •Java版OpenJDK运行时环境(版本1.8.0_152-release-1024-b01)
    •接受所有Android许可.

[✓] iOS工具链 – 为iOS设备开发(Xcode 9.4.1)
    •Xcode位于/Applications/Xcode.app/Contents/Developer
    •Xcode 9.4.1,Build版本9F2000
    •ios-deploy 1.9.2
    •CocoaPods 1.5.2版

[✓] Android Studio(3.1版)
    •Android Studio / Applications / Android Studio.app/Contents
    •Flutter插件版本27.0.1
    •Dart插件版本173.4700
    •Java版OpenJDK运行时环境(版本1.8.0_152-release-1024-b01)

[!] VS Code(版本1.25.1)
    •VS / Code / Visual Studio Code.app/Contents上的VS代码
    •未安装颤振扩展;安装自
      https://marketplace.visualstudio.com/items?itemName=Dart-Code.flutter

[!]已连接的设备
    !没有可用的设备

!医生发现了2个类别的问题.

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

解决方法:

您必须为发布模式创建签名配置,在当前文件中,您正在使用来自debug的签名配置.

 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-console
来源: https://codeday.me/bug/20191008/1871946.html