[英]Why do I get gray screen after building APK of my Flutter App?
Some days ago I started learning Flutter with the Flutter for Beginners Tutorial by TheNetNinja and today I've finished the course.几天前,我开始通过 TheNetNinja的Flutter for Beginners Tutorial学习 Flutter,今天我已经完成了这门课程。 So, I wanted to build the app we made and install it on my phone and, after I did it from Android Studio Toolbar's Build>Flutter>Build APK and installed the given APK on my phone, it shows only a gray screen.
所以,我想构建我们制作的应用程序并将其安装在我的手机上,在我从 Android Studio 工具栏的Build>Flutter>Build APK 完成并在我的手机上安装给定的 APK 之后,它只显示一个灰色屏幕。
I've looked for the solution to this on the internet and somewhere I read that it's because the APK wasn't signed.我已经在互联网上寻找解决方案,我在某处读到这是因为 APK 没有签名。 So I tried opening the android folder in a separate window (using Tools>Flutter>Open Android Module in Android Studio ) and build a signed APK from there, but it still didn't work.
所以我尝试在单独的窗口中打开android文件夹(使用Tools>Flutter>Open Android Module in Android Studio )并从那里构建一个签名的 APK,但它仍然没有工作。
After that, I've read somewhere else that the gray screen I get is probably the equivalent of the Red error screen that appears when there are some errors in the code (testing the app using Android Studio's Play button and emulator), but the problem is that I don't get any red screen and with the "debug version" my app works fine.在那之后,我在其他地方读到我得到的灰色屏幕可能相当于代码中出现一些错误时出现的红色错误屏幕(使用 Android Studio 的播放按钮和模拟器测试应用程序),但问题是是我没有出现任何红屏,并且使用“调试版本”我的应用程序运行良好。
So now I'm here, asking for help and hoping to solve this thing quickly.所以现在我在这里,寻求帮助,希望能尽快解决这个问题。
PS: if you need, here's my code: https://github.com/LeonardoMantovani/flutter-tutorial PS:如果你需要,这是我的代码: https : //github.com/LeonardoMantovani/flutter-tutorial
EDIT: This is the output of flutter doctor -v :编辑:这是flutter doctor -v的输出:
[√] Flutter (Channel stable, 1.20.3, on Microsoft Windows [Versione 10.0.19041.508], locale it-IT)
• Flutter version 1.20.3 at C:\src\flutter
• Framework revision 216dee60c0 (11 days ago), 2020-09-01 12:24:47 -0700
• Engine revision d1bc06f032
• Dart version 2.9.2
[√] Android toolchain - develop for Android devices (Android SDK version 30.0.2)
• Android SDK at C:\Users\leona\AppData\Local\Android\Sdk
• Platform android-30, build-tools 30.0.2
• ANDROID_HOME = C:\Users\leona\AppData\Local\Android\Sdk
• Java binary at: C:\Program Files\JetBrains\Toolbox\apps\AndroidStudio\ch-0\193.6626763\jre\bin\java
• Java version OpenJDK Runtime Environment (build 1.8.0_242-release-1644-b01)
• All Android licenses accepted.
[√] Android Studio (version 4.0)
• Android Studio at C:\Program Files\JetBrains\Toolbox\apps\AndroidStudio\ch-0\193.6626763
• Flutter plugin version 48.1.2
• Dart plugin version 193.7547
• Java version OpenJDK Runtime Environment (build 1.8.0_242-release-1644-b01)
[!] VS Code, 64-bit edition (version 1.44.2)
• VS Code at C:\Program Files\Microsoft VS Code
X Flutter extension not installed; install from
https://marketplace.visualstudio.com/items?itemName=Dart-Code.flutter
[√] Connected device (1 available)
• Android SDK built for x86 64 (mobile) • emulator-5554 • android-x64 • Android 9 (API 28) (emulator)
! Doctor found issues in 1 category.
在 app/src/main/AndroidManifest.xml 中添加<uses-permission android:name="android.permission.INTERNET"/>
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.