Leonardo Mantovani
Leonardo Mantovani

Reputation: 181

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. 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.

I've looked for the solution to this on the internet and somewhere I read that it's because the APK wasn't signed. 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.

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.

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

EDIT: This is the output of 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.

Upvotes: 0

Views: 2083

Answers (1)

Aman Verma
Aman Verma

Reputation: 918

Add <uses-permission android:name="android.permission.INTERNET"/> in app/src/main/AndroidManifest.xml

Upvotes: 2

Related Questions