android - Flutter Release Apk(未安装应用程序)错误
问题描述
我要使用 release 命令安装发布应用程序版本,
flutter build apk --release
但是当我尝试安装该 apk 时,它显示未安装应用程序。请帮我解决这个问题。此外,我曾尝试按 abi 构建 apk,但问题仍然存在。我正在使用 fvm 来构建 apk 和 Flutter 2.2.2 版。
应用程序/build.gradle
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 FileNotFoundException("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: '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'
}
lintOptions {
disable 'InvalidPackage'
}
defaultConfig {
applicationId "package_name"
minSdkVersion 20
targetSdkVersion 30
versionCode flutterVersionCode.toInteger()
versionName flutterVersionName
multiDexEnabled true
}
signingConfigs {
release {
keyAlias keystoreProperties['keyAlias']
keyPassword keystoreProperties['keyPassword']
storeFile keystoreProperties['storeFile'] ? file(keystoreProperties['storeFile']) : null
storePassword keystoreProperties['storePassword']
}
}
buildTypes {
release {
minifyEnabled true
useProguard true
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
compileOptions {
targetCompatibility JavaVersion.VERSION_1_8
sourceCompatibility JavaVersion.VERSION_1_8
}
}
flutter {
source '../..'
}
dependencies {
implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlin_version"
implementation "org.jetbrains.kotlin:kotlin-reflect:1.3.50"
implementation platform('com.google.firebase:firebase-bom:26.4.0')
implementation "androidx.browser:browser:1.3.0"
implementation 'com.google.firebase:firebase-analytics'
implementation 'com.google.firebase:firebase-auth'
implementation 'com.google.firebase:firebase-messaging'
}
还尝试为 apk 生成新的密钥库,但同样的问题。我尝试过签名和未签名的 apk。
解决方案
我按照此链接( https://docs.testfairy.com/FAQ/App_Not_Installed_Android_10.html )上的提示解决了这个问题,在我的情况下,第一个选项解决了我的问题,在卸载应用程序并重新启动手机后我玩了apk pro 设备,它工作。
推荐阅读
- c++ - ifstream 只打印数组中的第一行
- r - R - 根据数据框名称中的模式在列表中绑定多个数据框
- c# - 如何将 C++ 非托管 DLL 转换为 C#
- python-3.x - 使用 Beautifulsoup 将带有 HTML 标签的字符串解析为嵌套列表
- javascript - 从内容脚本模拟放置事件时,放置事件 dataTransfer 未定义
- docker - 特使中的重定向
- ios - 如何修复自定义按钮在 SwiftUI(IOS) 中的交互?
- c# - 如何将参数从 c# 传递给 python 脚本构造函数?
- python-3.x - 不支持使用 ODBC 和 Apache Ignite 的 Python 字符串到 varchar 映射
- sql - 添加列以确保复合键是唯一的