flutter hello_world项目:任务':app:compileDebugKotlin'执行失败

时间:2020-03-11 13:36:17

标签: android macos flutter dart

我尝试从android虚拟设备上的flutter create运行hello_world flutter应用程序,但它引发了错误。怎么了?

步骤:

  • 颤抖地创建hello_world
  • cd hello_world
  • 颤动
    > 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...
    e: /Users/kernelpanic/Desktop/hello_world/android/app/src/main/kotlin/com/example/hello_world/MainActivity.kt: (4, 19): Unresolved reference: embedding
    e: /Users/kernelpanic/Desktop/hello_world/android/app/src/main/kotlin/com/example/hello_world/MainActivity.kt: (5, 19): Unresolved reference: embedding
    e: /Users/kernelpanic/Desktop/hello_world/android/app/src/main/kotlin/com/example/hello_world/MainActivity.kt: (8, 21): Unresolved reference: FlutterActivity
    e: /Users/kernelpanic/Desktop/hello_world/android/app/src/main/kotlin/com/example/hello_world/MainActivity.kt: (9, 5): 'configureFlutterEngine' overrides nothing
    e: /Users/kernelpanic/Desktop/hello_world/android/app/src/main/kotlin/com/example/hello_world/MainActivity.kt: (9, 65): Unresolved reference: FlutterEngine
    e: /Users/kernelpanic/Desktop/hello_world/android/app/src/main/kotlin/com/example/hello_world/MainActivity.kt: (10, 35): Cannot access class 'FlutterEngine'. Check your module classpath for missing or conflicting dependencies

    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 1s                                                      
    Running Gradle task 'assembleDebug'...                                  
    Running Gradle task 'assembleDebug'... Done                         2,4s
    Gradle task assembleDebug failed with exit code 1

颤抖的医生:

    > flutter doctor
    Doctor summary (to see all details, run flutter doctor -v):
    [✓] Flutter (Channel stable, v1.12.13+hotfix.8, on Mac OS X 10.14.6 18G103, locale it-IT)

    [✓] Android toolchain - develop for Android devices (Android SDK version 28.0.3)
    [✓] Xcode - develop for iOS and macOS (Xcode 11.3.1)
    [✓] Android Studio (version 3.5)
    [✓] IntelliJ IDEA Community Edition (version 2019.3.1)
    [✓] VS Code (version 1.43.0)
    [✓] Connected device (1 available)

    • No issues found!

1 个答案:

答案 0 :(得分:0)

解决方案

清理gradle缓存,一切开始工作