관리 메뉴

막내의 막무가내 프로그래밍 & 일상

[Flutter] 플러터 빌드 버전 에러 Build failed due to use of deprecated Android v1 embedding. 본문

플러터(Flutter) & Dart

[Flutter] 플러터 빌드 버전 에러 Build failed due to use of deprecated Android v1 embedding.

막무가내막내 2022. 7. 10. 14:08
728x90

 

 

 

 

 

[에러]

플러터에서 실행을 누르니깐 다음과 같은 에러가 발생했습니다.

에러메시지 그대로 현재 플러터가 안드로이드의 너무 오래된 버전인 v1 사용으로 인한 버전 충돌 문제였습니다.

━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
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:

  D:\Git\udemy-flutter-practice\flash-chat-flutter\android\app\src\main\AndroidManifest.xml uses `android:name="io.flutter.app.FlutterApplication"`
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━

Build failed due to use of deprecated Android v1 embedding.

 

 

[해결방법]

https://stackoverflow.com/questions/71492645/flutter-build-failed-due-to-use-of-deprecated-android-v1-embedding

 

Flutter build failed due to use of deprecated Android v1 embedding

I have an error in the flutter project that I cloned from GitHub. I tried this method but it didn't work <application android:name="io.flutter.app.FlutterApplication" To: <

stackoverflow.com

 

 

- 변경전

<application
    android:name="io.flutter.app.FlutterApplication"

- 변경후

android:name 수정 및 meta-data 추가

<application
    android:name="${applicationName}"
    android:label="flash_chat"
    android:icon="@mipmap/ic_launcher">
<meta-data
    android:name="flutterEmbedding"
    android:value="2" />

 

 

[변경 코드]

<manifest xmlns:android="http://schemas.android.com/apk/res/android"
    package="co.appbrewery.flash_chat">

    <!-- io.flutter.app.FlutterApplication is an android.app.Application that
         calls FlutterMain.startInitialization(this); in its onCreate method.
         In most cases you can leave this as-is, but you if you want to provide
         additional functionality it is fine to subclass or reimplement
         FlutterApplication and put your custom class here. -->
    <application
        android:name="${applicationName}"
        android:label="flash_chat"
        android:icon="@mipmap/ic_launcher">
        <activity
            android:name=".MainActivity"
            android:launchMode="singleTop"
            android:theme="@style/LaunchTheme"
            android:configChanges="orientation|keyboardHidden|keyboard|screenSize|locale|layoutDirection|fontScale|screenLayout|density|uiMode"
            android:hardwareAccelerated="true"
            android:windowSoftInputMode="adjustResize">
            <!-- This keeps the window background of the activity showing
                 until Flutter renders its first frame. It can be removed if
                 there is no splash screen (such as the default splash screen
                 defined in @style/LaunchTheme). -->
            <meta-data
                android:name="flutterEmbedding"
                android:value="2" />

            <meta-data
                android:name="io.flutter.app.android.SplashScreenUntilFirstFrame"
                android:value="true" />
            <intent-filter>
                <action android:name="android.intent.action.MAIN"/>
                <category android:name="android.intent.category.LAUNCHER"/>

            </intent-filter>
        </activity>
    </application>
</manifest>

 

 

 

728x90
Comments