我在 Play 商店发布时遇到问题。 在模拟器上效果很好 当我将它发布到 Play 商店的内部测试时,当我运行 APP 时,它返回白屏,没有任何行为。
这是我的 build.gradle
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'
def keystoreProperties = new Properties()
def keystorePropertiesFile = rootProject.file('key.properties')
if (keystorePropertiesFile.exists()) {
keystoreProperties.load(new FileInputStream(keystorePropertiesFile))
}
android {
compileSdkVersion 30
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 "xxxxxxxxxxxx"
minSdkVersion 22
targetSdkVersion 30
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 {
signingConfig signingConfigs.release
}
}
}
和gradle版本:
classpath 'com.android.tools.build:gradle:4.1.2'
在模拟器上它可以工作,如果我将 APK 安装到我的物理设备上,它可以工作,但是一旦我在 Ply 上发布,它就会卡在白屏上
答案 0 :(得分:2)
这很可能是因为“不允许明文 HTTP 流量”。它卡在白屏上,因为它正在尝试与您的服务器\后端通信,但默认情况下不允许 http 流量。
将从应用商店下载的应用连接到您的计算机。运行 adb catlog
并过滤您的应用程序包名称,然后观察输出。
看看这个post,并检查它是否适用于您。除此之外,将 <uses-permission android:name="android.permission.INTERNET"/>
添加到您的 AndroidManifest.xml
。并更新这些步骤的结果,这两件事是您最有可能导致问题的原因。