16
respostas

Erro no comando flutter run

DAR erro qdo exECUTO comando run. Glade task assembledebug Field With exit code

16 respostas

Antes de rodar o comando Flutter run,certifique-se que está dentro da pasta em que ele foi instalado.

Fiz isso mais dar o erro. um tela de erro.: C:\Users\Neidijane\Documents\flutter\bytebank>flutter run Using hardware rendering with device AOSP on IA Emulator. If you get graphics artifacts, consider enabling software rendering with "--enable-software-rendering". Launching lib\main.dart on AOSP on IA Emulator in debug mode... Checking the license for package Android SDK Build-Tools 26.0.2 in C:\Users\Neidijane\AppData\Local\Android\sdk\licensesWarning: License for package Android SDK Build-Tools 26.0.2 not accepted. Checking the license for package Android SDK Platform 28 in C:\Users\Neidijane\AppData\Local\Android\sdk\licenses Warning: License for package Android SDK Platform 28 not accepted.

FAILURE: Build failed with an exception.

  • Where: Build file 'C:\Users\Neidijane\Documents\flutter\bytebank\android\build.gradle' line: 26

  • What went wrong: A problem occurred evaluating root project 'android'.

    A problem occurred configuring project ':app'. You have not accepted the license agreements of the following SDK components: [Android SDK Platform 28, Android SDK Build-Tools 26.0.2]. Before building your project, you need to accept the license agreements and complete the installation of the missing components using the Android Studio SDK Manager. Alternatively, to learn how to transfer the license agreements from one workstation to another, go to http://d.android.com/r/studio-ui/export-licenses.html

  • 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 21s Running Gradle task 'assembleDebug'... Running Gradle task 'assembleDebug'... Done 23,8s

Sending crash report to Google. Crash report sent (report ID: 31f6dd3f32c843c3) Oops; flutter has exited unexpectedly. Crash report written to C:\Users\Neidijane\Documents\flutter\bytebank\flutter_03.log; please let us know at https://github.com/flutter/flutter/issues.

Tente isto:

flutter run --enable-software-rendering

agora deu esse erro:

C:\Users\Neidijane\Documents\flutter\bytebank>flutter run --enable-software-rendering Using software rendering with device AOSP on IA Emulator. You may get better performance with hardware mode by configuring hardware rendering for your device. Launching lib\main.dart on AOSP on IA Emulator in debug mode... Checking the license for package Android SDK Build-Tools 26.0.2 in C:\Users\Neidijane\AppData\Local\Android\sdk\licenses Warning: License for package Android SDK Build-Tools 26.0.2 not accepted. Checking the license for package Android SDK Platform 28 in C:\Users\Neidijane\AppData\Local\Android\sdk\licenses Warning: License for package Android SDK Platform 28 not accepted.

FAILURE: Build failed with an exception.

  • Where: Build file 'C:\Users\Neidijane\Documents\flutter\bytebank\android\build.gradle' line: 26

  • What went wrong: A problem occurred evaluating root project 'android'.

    A problem occurred configuring project ':app'. You have not accepted the license agreements of the following SDK components: [Android SDK Platform 28, Android SDK Build-Tools 26.0.2]. Before building your project, you need to accept the license agreements and complete the installation of the missing components using the Android Studio SDK Manager. Alternatively, to learn how to transfer the license agreements from one workstation to another, go to http://d.android.com/r/studio-ui/export-licenses.html

  • 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 40s Running Gradle task 'assembleDebug'... Running Gradle task 'assembleDebug'... Done 43,3s

Sending crash report to Google. Crash report sent (report ID: 0852f03bd2a9493d) Oops; flutter has exited unexpectedly. Crash report written to C:\Users\Neidijane\Documents\flutter\bytebank\flutter_05.log; please let us know at https://github.com/flutter/flutter/issues.

Neidjane, seu problema está na instalação da IDE, verifique se você tem java instalado, recomendo que desinstale a IDE e reinstale novamente. Note que ele diz que você não aceitou os contratos de licença,por isso ao reinstalar atente-se em dar as permissões necessárias a IDE.

eu ja tinha o java instalado pois uso num projeto com eclipse. Por isso que achava não ser o caso. Você acha que se faz necessário?

desinstalei e instalei:

[!] Android toolchain - develop for Android devices (Android SDK version 29.0.3) • Android SDK at C:\Users\Neidijane\AppData\Local\Android\sdk • Android NDK location not configured (optional; useful for native profiling support) • Platform android-29, build-tools 29.0.3 • Java binary at: C:\Program Files\Android\Android Studio\jre\bin\java • Java version OpenJDK Runtime Environment (build 1.8.0_212-release-1586-b04) X Android license status unknown. Try re-installing or updating your Android SDK Manager. See https://developer.android.com/studio/#downloads or visit https://flutter.dev/setup/#android-setup for detailed instructions.

[!] Android Studio (version 3.6) • Android Studio at C:\Program Files\Android\Android Studio X Flutter plugin not installed; this adds Flutter specific functionality. • Dart plugin version 192.7761 • Java version OpenJDK Runtime Environment (build 1.8.0_212-release-1586-b04)

o comando RUN agora dar outro erro

C:\Users\Neidijane\Documents\flutter\bytebank>flutter run

Using hardware rendering with device AOSP on IA Emulator. If you get graphics artifacts, consider enabling software rendering with "--enable-software-rendering". Launching lib\main.dart on AOSP on IA Emulator in debug mode... Checking the license for package Android SDK Build-Tools 26.0.2 in C:\Users\Neidijane\AppData\Local\Android\sdk\licensesLicense for package Android SDK Build-Tools 26.0.2 accepted. Preparing "Install Android SDK Build-Tools 26.0.2 (revision: 26.0.2)". "Install Android SDK Build-Tools 26.0.2 (revision: 26.0.2)" ready. Installing Android SDK Build-Tools 26.0.2 in C:\Users\Neidijane\AppData\Local\Android\sdk\build-tools\26.0.2 "Install Android SDK Build-Tools 26.0.2 (revision: 26.0.2)" complete. "Install Android SDK Build-Tools 26.0.2 (revision: 26.0.2)" finished. Checking the license for package Android SDK Platform 28 in C:\Users\Neidijane\AppData\Local\Android\sdk\licenses License for package Android SDK Platform 28 accepted. Preparing "Install Android SDK Platform 28 (revision: 6)". "Install Android SDK Platform 28 (revision: 6)" ready. Installing Android SDK Platform 28 in C:\Users\Neidijane\AppData\Local\Android\sdk\platforms\android-28 "Install Android SDK Platform 28 (revision: 6)" complete. "Install Android SDK Platform 28 (revision: 6)" finished. Running Gradle task 'assembleDebug'... e: C:\Users\Neidijane\Documents\flutter\bytebank\android\app\src\main\kotlin\com\example\bytebank\MainActivity.kt: (3, 28): Unresolved reference: NonNull e: C:\Users\Neidijane\Documents\flutter\bytebank\android\app\src\main\kotlin\com\example\bytebank\MainActivity.kt: (9, 42): Unresolved reference: NonNull

FAILURE: Build failed with an exception.

  • What went wrong: Execution failed for task ':app:compileDebugKotlin'.

    Compilation error. See log for more details

  • 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 2m 0s Running Gradle task 'assembleDebug'... Running Gradle task 'assembleDebug'... Done 121,4s (!) Gradle task assembleDebug failed with exit code 1

Roda esse comando e manda o resultado:

Flutter doctor

Ele vai indicar o que falta para o fluttet funcionar Sugestões:

  • Verificar se o plugins dart e flutter estão instalados no Android Studio
  • Usar o Intellij
  • Usar vsCode Me diga também vc está usando emulador? se sim tente executar no seu próprio aparelho.
C:\Users\Neidijane>flutter doctor
Doctor summary (to see all details, run flutter doctor -v):
[√] Flutter (Channel stable, v1.12.13+hotfix.8, on Microsoft Windows [versão 10.0.18362.778], locale pt-BR)
[!] Android toolchain - develop for Android devices (Android SDK version 29.0.3)
    X Android license status unknown.
      Try re-installing or updating your Android SDK Manager.
      See https://developer.android.com/studio/#downloads or visit https://flutter.dev/setup/#android-setup for detailed
      instructions.
[!] Android Studio (version 3.6)
    X Flutter plugin not installed; this adds Flutter specific functionality.
[√] VS Code (version 1.43.2)
[!] Connected device
    ! No devices available

! Doctor found issues in 3 categories.

C:\Users\Neidijane>

Vá para o SDK Manager no Android Studio e desinstale todos os sdk e pacotes relacionados nas ferramentas sdk, clique em aplicar e feche o Android Studio. Agora, reinstale todas as ferramentas sdk Agora, no prompt de comando, execute o

flutter doctor -v

e, se algumas licenças não forem aceitas, aceite-as executando o

flutter doctor --android-license.
C:\Users\Neidijane>flutter doctor --android-license.
Doctor summary (to see all details, run flutter doctor -v):
[√] Flutter (Channel stable, v1.12.13+hotfix.8, on Microsoft Windows [versão 10.0.18362.778], locale pt-BR)
[!] Android toolchain - develop for Android devices
    ! Android SDK contains licenses only.
      Your first build of an Android application will take longer than usual, while gradle downloads the missing
      components. This functionality will only work if the licenses in the licenses folder in ANDROID_HOME are valid.
      If the Android SDK has been installed to another location, set ANDROID_HOME to that location.
      You may also want to add it to your PATH environment variable.

      Certain features, such as `flutter emulators` and `flutter devices`, will not work without the currently missing
      SDK components.
[!] Android Studio (version 3.6)
    X Flutter plugin not installed; this adds Flutter specific functionality.
[√] VS Code (version 1.43.2)
[!] Connected device
    ! No devices available

! Doctor found issues in 3 categories.

C:\Users\Neidijane>

Agora que entendi q tem q ir em android sdk > sdk tools , marcar todas as caixas, aceitar. ta baixando. teria como me informar o q é realmente necessario instalar?

mais enfim ainda tem essa mensagem no prompt de comando:

[!] Android toolchain - develop for Android devices (Android SDK version 30.0.0-rc2)
    • Android SDK at C:\Users\Neidijane\AppData\Local\Android\sdk
    • Android NDK location not configured (optional; useful for native profiling support)
    • Platform android-28, build-tools 30.0.0-rc2
    • Java binary at: C:\Program Files\Android\Android Studio\jre\bin\java
    • Java version OpenJDK Runtime Environment (build 1.8.0_212-release-1586-b04)
    X Android license status unknown.
      Try re-installing or updating your Android SDK Manager.
      See https://developer.android.com/studio/#downloads or visit https://flutter.dev/setup/#android-setup for detailed
      instructions.

Como disse antes através do Flutter Doctor, dá pra ver tudo o que está faltando para o flutter funcionar, eu sugiro que teste outra IDE além do Android Studio como o Intellij por exemplo.

Precisaria de um tutorial de como usar o intellij no lugar do android studio. Vcs teriam?

No próprio Curso da Formação Flutter têm é no primeiro módulo.

Quer mergulhar em tecnologia e aprendizagem?

Receba a newsletter que o nosso CEO escreve pessoalmente, com insights do mercado de trabalho, ciência e desenvolvimento de software