I'm having trouble launching the app in the Android emulator

Sorry if I ask a stupid question, but I’ve been trying for a while now and can’t figure it out. I have used so many solutions and it just doesn’t work, The app itself has no bugs and is just fine and the error message:

‘‘Build file ‘C:\Users\User\StudioProjects\workbridges\android\build.gradle’ line: 28’’

is also without bugs in the file and it doesn’t cause a problem… This is what I get when I want to open the app with Android emulator:

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

FAILURE: Build failed with an exception.

* Where:
Build file 'C:\Users\Gebruiker\StudioProjects\workbridges\android\build.gradle' line: 28

* What went wrong:
A problem occurred evaluating root project 'android'.
> Build completed with 1 failures.
   > com.google.common.util.concurrent.ExecutionError: java.lang.NoClassDefFoundError: com/android/build/api/extension/AndroidComponentsExtension

* 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 920ms
Exception: Gradle task assembleDebug failed with exit code 1''

I would really appreciate it if someone could help me.

This sounds less like a Gradle question, but more like an Android question.
I recommend you ask in some Android community.
You might have better chances for help with this there.

I came here to ask for help because the error code says, ‘’> Get more help at https://help.gradle.org.‘’ I will also look at an Android community, thanks for your answer anyway.

Yes, unfortunately every failed Gradle execution gives that non-sense advice, even if you for example have a compilation error because you wrote invalid syntax in your programming language.

So the help you get from me is a redirect to a better place for the question. :slight_smile:
You can of course also wait for someone else having a better answer that solves your problem.
I just recommended to ask at a place where the probability for getting help is higher. :slight_smile:

1 Like

Yes, thanks for your advice!

1 Like

I finally solved it after 24 days. And you’ll never guess how… via gradle.org.

1 Like

Mind sharing how you solved it?
Someone else may have the same problem in the future and stumble over this thread then.

El conquistador, puede por favor compartir como ha solucionado el problema? tengo el mismo problema desde hace tiempo, lo he probado todo

@The_Conqueror como lo solucionaste?, tengo el mismo problema y ya creo haberlo intentado todo

Would you mind sticking to English please?
I doubt many people on this forum are savvy in Spanish.

I have the same error, I would appreciate your help to know how you solved it, greetings.

No, I can’t, sorry but this is an Android question. So I think it would be better to answer it on the Android platform and not here. This was your answer so I don’t understand why you are asking me to explain it now?

I did not ask now.
I asked back then right after you said you solved it:

Another user with the same problem asked how you solved it 2 days ago which is why I back then asked you whether you could share your solution in case this happens. :wink:

Hi, I already solved it, I updated Android Studio and Gradle to their latest version, then I created a Flutter project from scratch so that it would create the Android folder with the latest updates, then I transferred the folders of my project to the new one that I created, except for the Android folder, updated the packages in the pubspec.yaml file and it worked. I hope it can be useful to you.

1 Like