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
다음과 같이 수정함 : 패키지명 주석 처리함
2) build.gradle에 namespace 추가
위치: C:\Users\{사용자명}\AppData\Local\Pub\Cache\hosted\pub.dev\{패키지명}\android\build.gradle
android -> namespce 위에서 복사한것 추가함
다음 명령어 이후
flutter clean
flutter pub get
flutter run
실제 안드로이드 폰에서 정상 작동함
'Flutter' 카테고리의 다른 글
flutter 윈도우 작업 소스 맥북에서 빌드하기 (1) | 2025.03.11 |
---|---|
flutter, XCode, CocoaPods 관계 알아보기 (0) | 2025.03.11 |
apk 빌드시 에러 : ERROR: Missing classes detected while running R8. Please add the missing classes or apply additional keep rules that are generated in (0) | 2025.02.14 |
플러터 앱 실제 안드로이드폰 에서 디버깅시 에러 발생 [shared_preferences_android:compileDebugJavaWithJavac] (0) | 2025.01.31 |
[Flutter] 플러터 설치 방법 (0) | 2025.01.16 |