Flutter 仅颤振灰色屏幕在释放apk中可见
我想为我的应用程序构建release apk,并尝试运行此命令Flutter 仅颤振灰色屏幕在释放apk中可见,flutter,flutter-android,flutter-build,Flutter,Flutter Android,Flutter Build,我想为我的应用程序构建release apk,并尝试运行此命令 flutter build apk --target-platform android-arm,android-arm64,android-x64 --split-per-abi 然后,我运行了app-armeabi-v7a-release-apk,它只是一个灰色的屏幕 我还启用了清单中的所有权限 日志 android/app/build.gradle def localProperties = new Properties(
flutter build apk --target-platform android-arm,android-arm64,android-x64 --split-per-abi
然后,我运行了app-armeabi-v7a-release-apk,它只是一个灰色的屏幕
我还启用了清单中的所有权限
日志
android/app/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.")
}
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: 'com.google.gms.google-services'
apply plugin: 'kotlin-android'
apply from: "$flutterRoot/packages/flutter_tools/gradle/flutter.gradle"
android {
compileSdkVersion 30
sourceSets {
main.java.srcDirs += 'src/main/kotlin'
}
lintOptions {
disable 'InvalidPackage'
}
defaultConfig {
// TODO: Specify your own unique Application ID (https://developer.android.com/studio/build/application-id.html).
applicationId "com.maslow.learnwithyoutube_flutterapp"
minSdkVersion 21
targetSdkVersion 30
versionCode flutterVersionCode.toInteger()
versionName flutterVersionName
}
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 {
implementation platform('com.google.firebase:firebase-bom:26.5.0')
implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlin_version"
}
本地物业
sdk.dir=C:\\Users\\sanje\\AppData\\Local\\Android\\Sdk
flutter.sdk=C:\\flutter
flutter.buildMode=release
flutter.versionName=1.0.0
flutter.versionCode=1
忽略这一点:Lorem ipsum dolor sit amet,一位杰出的献身者,他是一位临时劳工和职业经理人。但是,在最低限度上,我们需要一个实验室来进行日常工作。两人或两人在一个无教区的房间里互相指责。除偶尔因疏忽而死亡外,不得因疏忽而导致动物死亡
颤振版本颤振1.22.6
提前谢谢 找了两个小时后,我找到了解决办法 这是因为在我的情况下,颤振_下载包 在main中添加try-catch bloc,如下所示:
void main() async {
try {
WidgetsFlutterBinding.ensureInitialized();
await FlutterDownloader.initialize(
debug: true // optional: set false to disable printing logs to console
);
await Firebase.initializeApp();
final Directory directory =
await path_provider.getApplicationDocumentsDirectory();
Hive.init(directory.path);
Hive.registerAdapter(ResponseTokenModelAdapter());
await Hive.openBox<ResponseTokenModel>(HiveBoxNames.token);
configureInjection(Environment.prod);
runApp(AppWidget());
} catch (e) {
runApp(MaterialApp(
home: Center(
child: Text(e.toString()),
),
));
}
}
void main()异步{
试一试{
WidgetsFlutterBinding.ensureInitialized();
等待下载。初始化(
debug:true//可选:设置false以禁用将日志打印到控制台
);
等待Firebase.initializeApp();
最终目录=
等待路径_provider.getApplicationDocumentsDirectory();
init(directory.path);
registerAdapter(ResponseTokenModelAdapter());
等待Hive.openBox(HiveBoxNames.token);
配置注入(Environment.prod);
runApp(AppWidget());
}捕获(e){
runApp(材料应用程序)(
首页:中(
子项:文本(例如toString()),
),
));
}
}
现在我只需要添加本机集成。你能分享你的
android/app/build.gradle
和android/local.properties
?错误是关于sdk.dir的。sdk.dir=/Users/username/Library/Android/sdk flift.sdk=/Users/username/Downloads/flift flift.buildMode=debug flift.versionName=1.0.0 flift.versionCode=1@Akif添加了。请尝试在“环境变量”中添加ANDROID_HOME变量,如C:\Users\sanje\AppData\Local\ANDROID\Sdk@Akif,感谢它的成功。GG;)@Akif但当我打开app-armeabi-v7a-release apk时,只有灰色屏幕可见,(发布中的灰色屏幕==调试中的红色屏幕?)
void main() async {
try {
WidgetsFlutterBinding.ensureInitialized();
await FlutterDownloader.initialize(
debug: true // optional: set false to disable printing logs to console
);
await Firebase.initializeApp();
final Directory directory =
await path_provider.getApplicationDocumentsDirectory();
Hive.init(directory.path);
Hive.registerAdapter(ResponseTokenModelAdapter());
await Hive.openBox<ResponseTokenModel>(HiveBoxNames.token);
configureInjection(Environment.prod);
runApp(AppWidget());
} catch (e) {
runApp(MaterialApp(
home: Center(
child: Text(e.toString()),
),
));
}
}