1. Anuncie Aqui ! Entre em contato fdantas@4each.com.br

[Flutter] Can't launch a flutter application in android emulator

Discussão em 'Mobile' iniciado por Stack, Outubro 9, 2024 às 17:32.

  1. Stack

    Stack Membro Participativo

    I am working on a Windows 11 laptop. Through visual code editor, I created a new flutter application from scratch (I pressed Ctrl + Shift + P and chose "Flutter: New Project" command). The project was created successfully. The "flutter run" command is running without any errors when I attach the debug process to a web browser. However, when I try to attach it to an Android emulator (which is already running) I get an error in terminal(The android emulators I use are created with Android studio). I also get the same error when I try to set an android emulator as a build target through Android studio (latest version).

    The error I get is the following in all cases.

    Launching lib\main.dart on sdk gphone64 x86 64 in debug mode...
    Running Gradle task 'assembleDebug'...

    FAILURE: Build failed with an exception.

    * What went wrong:
    Execution failed for task ':flutter_plugin_android_lifecycle:compileDebugJavaWithJavac'.
    > Could not resolve all files for configuration ':flutter_plugin_android_lifecycle:androidJdkImage'.
    > Failed to transform core-for-system-modules.jar to match attributes {artifactType=_internal_android_jdk_image, org.gradle.libraryelements=jar, org.gradle.usage=java-runtime}.
    > Execution failed for JdkImageTransform: %USERPROFILE%\AppData\Local\Android\sdk\platforms\android-34\core-for-system-modules.jar.
    > Error while executing process C:\Program Files\Android\Android Studio\jbr\bin\jlink.exe with arguments {--module-path %USERPROFILE%\.gradle\caches\transforms-3\4a46fc89ed5f9adfe3afebf74eb8bfeb\transformed\output\temp\jmod --add-modules java.base --output %USERPROFILE%\.gradle\caches\transforms-3\4a46fc89ed5f9adfe3afebf74eb8bfeb\transformed\output\jdkImage --disable-plugin system-modules}

    * Try:
    > Run with --stacktrace option to get the stack trace.
    > Run with --info or --debug option to get more log output.
    > Run with --scan to get full insights.
    > Get more help at https://help.gradle.org.

    BUILD FAILED in 12s
    Error: Gradle task assembleDebug failed with exit code 1


    I have tried to solve (unsuccessfully) this problem by following the suggestions I found in these posts:


    I have also tried to run this command which was included in the previous error message:

    ./jlink.exe --module-path %USERPROFILE%\.gradle\caches\transforms-3\4a46fc89ed5f9adfe3afebf74eb8bfeb\transformed\output\temp\jmod --add-modules java.base --output %USERPROFILE%\.gradle\caches\transforms-3\4a46fc89ed5f9adfe3afebf74eb8bfeb\transformed\output\jdkImage --disable-plugin system-modules


    but it returns this message (can't figure out what it means):

    Error: jdk.tools.jlink.plugin.PluginException: ModuleTarget is malformed: platformString missing delimiter: android


    I have also followed these docs to install dart and flutter:


    Is there any solution to this problem? It would be really helpful to be able to debug my app inside an Android emulator.

    Continue reading...

Compartilhe esta Página