Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Unable to Run flutter application in Android Virtual Device on Ubuntu Linux #82411

Closed
SubhanRaj opened this issue May 13, 2021 · 5 comments
Closed
Labels
r: invalid Issue is closed as not valid

Comments

@SubhanRaj
Copy link

SubhanRaj commented May 13, 2021

Unable to Run flutter application in Android Virtual Device on Ubuntu Linux

Screenshot from 2021-05-13 09-24-07

1.Unable to Run flutter application in Android Virtual Device on Ubuntu Linux
2. AVD is working fine
3. Debugging in Chrome Browser is working correctly
4. I have installed Android Studio via Jet brains Toolbox, so flutter doesn't recognise that, but I don't have any issues with it as I use VS Code for Code Editing

@FlutterIssues

Logs

flutter doctor -v
Launching lib/main.dart on sdk gphone x86 in debug mode...
lib/main.dart:1

Exception in thread "main" java.util.zip.ZipException: zip file is empty
	at java.base/java.util.zip.ZipFile$Source.zerror(ZipFile.java:1502)
	at java.base/java.util.zip.ZipFile$Source.findEND(ZipFile.java:1310)
	at java.base/java.util.zip.ZipFile$Source.initCEN(ZipFile.java:1404)
	at java.base/java.util.zip.ZipFile$Source.<init>(ZipFile.java:1209)
	at java.base/java.util.zip.ZipFile$Source.get(ZipFile.java:1172)
	at java.base/java.util.zip.ZipFile$CleanableResource.<init>(ZipFile.java:717)
	at java.base/java.util.zip.ZipFile.<init>(ZipFile.java:237)
	at java.base/java.util.zip.ZipFile.<init>(ZipFile.java:167)
	at java.base/java.util.zip.ZipFile.<init>(ZipFile.java:181)
	at org.gradle.wrapper.Install.unzip(Install.java:214)
	at org.gradle.wrapper.Install.access$600(Install.java:27)
	at org.gradle.wrapper.Install$1.call(Install.java:74)
	at org.gradle.wrapper.Install$1.call(Install.java:48)
	at org.gradle.wrapper.ExclusiveFileAccessManager.access(ExclusiveFileAccessManager.java:65)
	at org.gradle.wrapper.Install.createDist(Install.java:48)
	at org.gradle.wrapper.WrapperExecutor.execute(WrapperExecutor.java:128)
	at org.gradle.wrapper.GradleWrapperMain.main(GradleWrapperMain.java:61)
Exception: Gradle task assembleDebug failed with exit code 1
Exited (sigterm)

### The output of running `flutter doctor -v
[✓] Flutter (Channel beta, 2.0.1, on Linux, locale en_GB.UTF-8)
    • Flutter version 2.0.1 at /home/subhan/snap/flutter/common/flutter
    • Framework revision c5a4b4029c (2 months ago), 2021-03-04 09:47:48 -0800
    • Engine revision 40441def69
    • Dart version 2.12.0

[✓] Android toolchain - develop for Android devices (Android SDK version 30.0.3)
    • Android SDK at /home/subhan/Android/Sdk
    • Platform android-30, build-tools 30.0.3
    • Java binary at: /home/subhan/.local/share/JetBrains/Toolbox/apps/AndroidStudio/ch-0/201.7199119/jre/bin/java
    • Java version OpenJDK Runtime Environment (build 1.8.0_242-release-1644-b3-6222593)
    • All Android licenses accepted.

[✓] Chrome - develop for the web
    • Chrome at google-chrome

[✓] Android Studio
    • Android Studio at /home/subhan/.local/share/JetBrains/Toolbox/apps/AndroidStudio/ch-0/201.7199119
    • Flutter plugin can be installed from:
      🔨 https://plugins.jetbrains.com/plugin/9212-flutter
    • Dart plugin can be installed from:
      🔨 https://plugins.jetbrains.com/plugin/6351-dart
    • android-studio-dir = /home/subhan/.local/share/JetBrains/Toolbox/apps/AndroidStudio/ch-0/201.7199119
    • Java version OpenJDK Runtime Environment (build 1.8.0_242-release-1644-b3-6222593)

[✓] VS Code (version 1.56.0)
    • VS Code at /usr/share/code
    • Flutter extension version 3.22.0

[✓] Connected device (2 available)
    • sdk gphone x86 (mobile) • emulator-5554 • android-x86    • Android 11 (API 30) (emulator)
    • Chrome (web)            • chrome        • web-javascript • Google Chrome 90.0.4430.212

• No issues found!
@TahaTesser TahaTesser added the in triage Presently being triaged by the triage team label May 13, 2021
@TahaTesser
Copy link
Member

Hi @SubhanRaj
This usually happens when you've unfinished Gradle download (common when Gradle download gets canceled due to network issues or canceled by user) or corrupted Gradle.

To fix the issue you need to first delete the existing Gradle cache and download it again
cd ~
rm -rf .gradle
then run your app, this will take sometime since this is downloading Gradle again, builds will be faster after this
Thank you

@TahaTesser TahaTesser added the waiting for customer response The Flutter team cannot make further progress on this issue until the original reporter responds label May 13, 2021
@no-response no-response bot removed the waiting for customer response The Flutter team cannot make further progress on this issue until the original reporter responds label May 14, 2021
@SubhanRaj
Copy link
Author

I used the official Gradle installation method given here https://gradle.org/install/

And then added it to path permanently using the following method

  • Run the command
    gedit ~/.profile
  • Add the line
    export PATH=$PATH:/opt/gradle/gradle-7.0.2/bin
    to the bottom and save
  • Log out and log in again

Now gradle -v gives the following output

------------------------------------------------------------ Gradle 7.0.2 ------------------------------------------------------------

Build time: 2021-05-14 12:02:31 UTC
Revision: 1ef1b260d39daacbf9357f9d8594a8a743e2152e

Kotlin: 1.4.31
Groovy: 3.0.7
Ant: Apache Ant(TM) version 1.10.9 compiled on September 27 2020
JVM: 14.0.2 (Private Build 14.0.2+12-Ubuntu-1)
OS: Linux 5.8.0-50-generic amd64

and after trying to run using F5 now it only shows

Exception in thread "main" java.lang.NullPointerException
at org.gradle.wrapper.BootstrapMainStarter.findLauncherJar(BootstrapMainStarter.java:34)
at org.gradle.wrapper.BootstrapMainStarter.start(BootstrapMainStarter.java:25)
at org.gradle.wrapper.WrapperExecutor.execute(WrapperExecutor.java:129)
at org.gradle.wrapper.GradleWrapperMain.main(GradleWrapperMain.java:61)
Exception: Gradle task assembleDebug failed with exit code 1
Exited (sigterm)

@TahaTesser
Copy link
Member

@SubhanRaj
Please use the supported Gradle version, you don't have to install it manually, clear your Gradle cache, simply run your app. Flutter will fetch supported Gradle.
If the issue persists with supported Gradle, please provide complete reproducible steps
Thank you

@TahaTesser TahaTesser added the waiting for customer response The Flutter team cannot make further progress on this issue until the original reporter responds label May 17, 2021
@SubhanRaj
Copy link
Author

It's working now, I removed manually installed Gradle, updated my JDK and then allowed Android studio to download the gradle itself, after that now it's running fine.

Thanks, @TahaTesser and @FlutterIssues

@TahaTesser TahaTesser added r: invalid Issue is closed as not valid and removed in triage Presently being triaged by the triage team waiting for customer response The Flutter team cannot make further progress on this issue until the original reporter responds labels May 20, 2021
@github-actions
Copy link

github-actions bot commented Aug 1, 2021

This thread has been automatically locked since there has not been any recent activity after it was closed. If you are still experiencing a similar issue, please open a new bug, including the output of flutter doctor -v and a minimal reproduction of the issue.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Aug 1, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
r: invalid Issue is closed as not valid
Projects
None yet
Development

No branches or pull requests

2 participants