코딩공부/모바일앱 개발 공부

[Flutter] A problem occurred configuring project ':google_mobile_ads'. 에러 해결 방법

내일의기대 2024. 9. 16. 11:45

Flutter 개발 공부 도중 admob 플러그인(google_mobile_ads)을 추가하여 앱을 실행하였더니 다음과 같은 오류가 떨어졌다.

A problem occurred configuring project ':google_mobile_ads'.
> Could not create an instance of type com.android.build.api.variant.impl.LibraryVariantBuilderImpl.
   > Namespace not specified. Specify a namespace in the module's build file. See https://d.android.com/r/tools/upgrade-assistant/set-namespace for information about setting the namespace.

     If you've specified the package attribute in the source AndroidManifest.xml, you can use the AGP Upgrade Assistant to migrate to the namespace value in the build file. Refer to https://d.android.com/r/tools/upgrade-assistant/agp-upgrade-assistant for general information about using the AGP Upgrade Assistant.

처음에는 AndroidManifest.xml이 잘못됐나 한참을 확인하였지만 문제를 발견하지 못했다.

그러다가 혹시나 하는 마음에 google_mobile_ads 버전을 최신버전 (5.1.0)으로 올렸더니 아래와 같이 정상작동했다 😮
(참고로 사용 중인 flutter sdk 버전 3.5.3)

인터넷에서 단순히 depdency를 복사 붙여넣기 했더니 이런 현상이 일어났는데... 에러를 봐서는 버전 문제인지 도무지 알수가 없었다 😥