본문 바로가기

Flutter

[flutter 에러] A problem occurred configuring project ':flutter_inappwebview'.> Could not create an instance of type com.android.build.api.variant.impl.LibraryVariantBuilderImpl.

반응형

Flutter에서 크롬으로 디버깅시는 정상 작동 하는데 실제 안드로이드 폰으로 디버깅 하려고 실행하니 아래 에러 나면서 실행인 안됨

 

플러터 안드로이드 디버깅 안됨

 

 

반응형

 

 

크로드로 소스 만들어서 작업중

 

Launching lib\main.dart on SM G996N in debug mode...
Running Gradle task 'assembleDebug'...

FAILURE: Build completed with 2 failures.

1: Task failed with an exception.
-----------
* What went wrong:
A problem occurred configuring project ':flutter_inappwebview'.
> 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.

* 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.
==============================================================================

2: Task failed with an exception.
-----------
* What went wrong:
Failed to query the value of property 'buildFlowServiceProperty'.
> Could not isolate value org.jetbrains.kotlin.gradle.plugin.statistics.BuildFlowService$Parameters_Decorated@4acbc175 of type BuildFlowService.Parameters
   > A problem occurred configuring project ':flutter_inappwebview'.
      > 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.

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

 

 

아무리 아래 명령어로 해도 안됨.

flutter clean

flutter pub get

flutter run

 

해결책 힌트 : https://brain-nim.tistory.com/146

 

나와 비슷한 문제가 있었던거 같다.

나는 flutter_inappwebview 패키지가 문제인듯 했다.

 

나도 똑같이 위 방법처럼 따라가 2곳 수정후 정상 작동함

 

1) AndroidManifest.xml에서 패키지명 확인

위치: C:\Users\{사용자명}\AppData\Local\Pub\Cache\hosted\pub.dev\{패키지명}\android\src.main.AndroidManifest.xml

AndroidManifest.xml에서 기존 namespace 확인

 

다음과 같이 수정함 : 패키지명 주석 처리함

AndroidManifest.xml에서 패키지명 주석처리

 

 

2) build.gradle에 namespace 추가

위치: C:\Users\{사용자명}\AppData\Local\Pub\Cache\hosted\pub.dev\{패키지명}\android\build.gradle

 

build.gradle에 namespace 존재 확인

 

android -> namespce 위에서 복사한것 추가함

build.gradle에 namespace 추가

 

 

다음 명령어 이후

flutter clean

flutter pub get

flutter run

 

실제 안드로이드 폰에서 정상 작동함

 

 

정상 컴파일 및 작동

반응형