플러터 디버깅 오류 종류 별 대처 방법 정리

Build failed due to use of deprecated Android v1 embedding. 에러

오류내용
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
Warning
──────────────────────────────────────────────────────────────────────────────
Your Flutter application is created using an older version of the Android
embedding. It is being deprecated in favor of Android embedding v2. Follow the
steps at
https://flutter.dev/go/android-project-migration
to migrate your project. You may also pass the --ignore-deprecation flag to
ignore this check and continue with the deprecated v1 embedding. However,
the v1 Android embedding will be removed in future versions of Flutter.
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
The detected reason was:
  ~\android\app\src\main\AndroidManifest.xml uses `android:name="io.flutter.app.FutterApplication"`
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
Build failed due to use of deprecated Android v1 embedding.
Exited (1)

 

 

android\app\src\main\AndroidManifest.xml 파일에서 android:name 값을 변경

 

변경 전 
    <application
        android:name="io.flutter.app.FlutterApplication"
        android:label="httpexample"
        android:icon="@mipmap/ic_launcher">
        <activity
변경 후
    <application
        android:name="${applicationName}"
        android:label="httpexample"
        android:icon="@mipmap/ic_launcher">
        <activity

 

 

 

Execution failed for task ':app:compileDebugKotlin'. 에러

 

오류내용
* 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 9s
┌─ Flutter Fix ────────────────────────────────────────────────────────────────────────────────────┐
│ [!] Your project requires a newer version of the Kotlin Gradle plugin.                           │
│ Find the latest version on https://kotlinlang.org/docs/gradle.html#plugin-and-versions, then     │
│ update                                                                                           │
│ ~\android\build.gradle:                                                                          │
│ ext.kotlin_version = '<latest-version>'                                                          │
└──────────────────────────────────────────────────────────────────────────────────────────────────┘
Exception: Gradle task assembleDebug failed with exit code 1

 

 

android\build.gradle 파일에서 ext.kotlin_version 값을 변경

 

변경 전

buildscript {
    ext.kotlin_version = '1.3.50'
    repositories {
        google()
        jcenter()
    }

 

변경 후

buildscript {
    ext.kotlin_version = '1.6.10'
    repositories {
        google()
        jcenter()
    }

 

 

 

The current Gradle version 5.6.2 is not compatible with the Kotlin Gradle plugin.

오류내용
FAILURE: Build failed with an exception.

* Where:
Build file '~\android\app\build.gradle' line: 25

* What went wrong:
A problem occurred evaluating project ':app'.
> Failed to apply plugin [id 'kotlin-android']
   > The current Gradle version 5.6.2 is not compatible with the Kotlin Gradle plugin. Please use Gradle 6.1.1 or newer, or the previous version of the Kotlin plugin.

* 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 15s
Exception: Gradle task assembleDebug failed with exit code 1

 

 

android\gradle\wrapper\gradle-wrapper.properties 파일에서 distributionUrl 값을 변경

 

변경 전
distributionUrl=https\://services.gradle.org/distributions/gradle-5.6.2-all.zip

 

변경 후
distributionUrl=https\://services.gradle.org/distributions/gradle-6.1.1-all.zip

 

 

 

The plugin path_provider requires Android SDK version 29.

오류내용
Warning: The plugin path_provider requires Android SDK version 29.
One or more plugins require a higher Android SDK version.
Fix this issue by adding the following to ~\android\app\build.gradle:
android {
  compileSdkVersion 29
  ...
}

 

 

android\app\build.gradle 파일에서 compileSdkVersion 값을 변경

 

변경 전
android {
    compileSdkVersion 28

 

변경 후 (에러에서 알려주는 버전으로 값 변경)
android {
    compileSdkVersion 29

 

 

 

Image.network fails in VSCode

오류내용
════════ Exception caught by image resource service ════════════════════════════
Failed to load network image.
Image URL: https://~~~~
Trying to load an image from another domain? Find answers at:
https://flutter.dev/docs/development/platform-integration/web-images
════════════════════════════════════════════════════════════════════════════════

 

해결방법
  1. VSCode의 설정(Ctrl + ,)
  2. Flutter Web Render 옵션
  3. auto -> html