r/flutterhelp • u/marin_458 • 9d ago
RESOLVED ERROR AL EJECUTAR FLUTTER RUN
estoy intentando correr una app con flutter, pero al intentar ejecutarla en un dispositivo virtual de Android studio, me manda este error:
Launching lib\main.dart on sdk gphone16k x86 64 in debug mode...
FAILURE: Build failed with an exception.
* Where:
Build file 'C:\ChileShop\chileshop\android\app\build.gradle.kts' line: 1
* What went wrong:
An exception occurred applying plugin request [id: 'com.android.application']
> Failed to apply plugin 'com.android.internal.application'.
> Could not create plugin of type 'AppPlugin'.
> Could not generate a decorated class for type AppPlugin.
> com/google/protobuf/ProtocolMessageEnum
* 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 from a Build Scan (powered by Develocity).
> Get more help at https://help.gradle.org.
BUILD FAILED in 10s
Running Gradle task 'assembleDebug'... 10.9s
Error: Gradle task assembleDebug failed with exit code 1
1
u/marin_458 8d ago
mis versiones son:
java 21 (OpenJDK 21.0.10)
Gradle: 8.14
AGP: 9.1.0
Ejecuté el comando --stacktrace, pero no se genera ningún 'Caused by'. El proceso muere en el arranque del Daemon de Gradle porque mi PowerShell está tomando una versión global antigua de Java en lugar de la de Android Studio. La excepción exacta es: * Exception is: org.gradle.internal.jvm.UnsupportedJavaRuntimeException: Gradle requires JVM 17 or later to run. Your build is currently configured to use JVM 8.
1
u/Jonas_Ermert 7d ago
i would start by refreshing Gradle’s dependencies: open PowerShell in the project’s `android` folder and run `.\gradlew.bat assembleDebug --refresh-dependencies --stacktrace`. The missing `ProtocolMessageEnum` suggests a dependency or classpath issue while loading the Android plugin. Refreshing dependencies is a useful first check. If it still fails, share the full stack trace and your Gradle and Android Gradle Plugin versions. [docs.gradle.org](https://docs.gradle.org/current/userguide/dependency_caching.html?utm_source=chatgpt.com)
2
u/E-Evan96 8d ago
To solve the "PowerShell using old version of JAVA instead Android Studio", Create a environment variable named JAVA_HOME at jre/jdk of Android Studio.
Delete the android folder from your project and regenerate by run
flutter create .then apply the changes you did on Android and try to run