플러터 안드로이드 에뮬레이터 실행 불가 해결

황고은·2023년 11월 14일
0

flutter doctor -v 를 실행했을 때 나온 결과. Android toolchain에 문제가 있다고 나온다. sdk 파일을 찾을 수 없다는 문구.

[!] Android toolchain - develop for Android devices (Android SDK version 34.0.0)
• Android SDK at /Users/goeun/Library/Android/sdk
• Platform android-33, build-tools 34.0.0
× Android SDK file not found:
/Users/goeun/Library/Android/sdk/platforms/android-33/android.jar.
• Try re-installing or updating your Android SDK, visit https://flutter.dev/docs/get-started/install/macos#android-setup for
detailed instructions.

이슈를 올렸더니 다음과 같은 명령어를 실행해보라고 했다.
$ flutter config --android-sdk <path-to-your-android-sdk-path>
$ flutter config --android-studio-dir=<path-to-your-android-sdk-path>

근데 이렇게 했더니

이러면 flutter doctor -v를 했을 때 아무런 문제도 뜨지 않지만 에뮬레이터를 실행했을 때 vscode에서 오류 발생

FAILURE: Build failed with an exception.

* What went wrong:
A problem was found with the configuration of task ':app:processDebugResources' (type 'LinkApplicationAndroidResourcesTask').
  - In plugin 'com.android.internal.version-check' type 'com.android.build.gradle.internal.res.LinkApplicationAndroidResourcesTask' property 'androidJarInput.androidJar' specifies file '/Users/goeun/Library/Android/sdk/platforms/android-33/android.jar' which doesn't exist.

    Reason: An input file was expected to be present but it doesn't exist.

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

이런 오류인데,

/Users/{user_name}/Library/Android/sdk/platforms/android-34 경로에 가면 있던 android.jar 파일이 /Users/{user_name}/Library/Android/sdk/platforms/android-33 경로에는 존재하지 않는 것을 확인했다.

cp /Users/{user_name}/Library/Android/sdk/platforms/android-34/android.jar /Users/{user_name}/Library/Android/sdk/platforms/android-33/android.jar

을 통해 해결!

며칠을 고생했는데 드디어 해결해서 속이 뻥 뚫린다,,, 후,,,
드디어 앱 개발을 할 수 있겠다!

profile
Snow Roller : 영차영차 눈을 굴려보아요 ⛄🚎

0개의 댓글