본문 바로가기
카테고리 없음

A problem occurred configuring project ':flutter_inappwebview'.

by 또또도전 2025. 2. 1.
반응형

* What went wrong:
A problem occurred configuring project ':flutter_inappwebview'.
> Could not create an instance of type cohttp://m.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 3s
Error: Gradle task assembleDebug failed with exit code 1

 

 

chatGPT의 해결책

 

 

아니, com.example.myapp으로 바꿀 필요는 없어.

네 프로젝트의 네임스페이스와 applicationId는 이미 **com.fortieschungi.lollipaps**로 설정되어 있으니까 그대로 두면 돼.

하지만 아래 두 가지를 확인해 봐:

✅ 1. flutter_inappwebview 패키지 최신 버전으로 업데이트

이 오류는 주로 flutter_inappwebview가 최신 Gradle과 호환되지 않을 때 발생하는데, 최신 버전으로 업데이트하면 해결될 가능성이 높아.
터미널에서 아래 명령어를 실행해:

sh
복사편집
flutter pub upgrade flutter_inappwebview

그리고 다시 빌드해 봐:

sh
복사편집
flutter build apk

 


✅ 2. flutter.gradle이 최신 버전인지 확인

Flutter Gradle 플러그인이 오래된 버전일 수도 있어.
아래 파일을 확인해 봐:

📌 android/build.gradle에서 최신 Gradle 버전으로 업데이트

gradle
복사편집
dependencies { classpath "com.android.tools.build:gradle:8.1.2" // 최신 버전 확인 필요 }

📌 android/gradle/wrapper/gradle-wrapper.properties에서 최신 Gradle 배포 URL 확인

properties
복사편집
distributionUrl=https\://services.gradle.org/distributions/gradle-8.2-bin.zip

버전을 수정했다면, 아래 명령어를 실행해서 Gradle을 다시 로드해 봐:

sh
복사편집
flutter clean flutter pub get flutter build apk

이 방법으로도 해결되지 않으면 다시 오류 메시지를 보내줘. 🚀

 

 

역시나 되지 않는다~!!!

android/build.gradle 파일에 subjects에 

subprojects {
   afterEvaluate { project ->
       if (project.hasProperty('android')) {
           project.android {
               if (namespace == null) {
                   namespace project.group
               }
           }
       }
   }
}

 

이렇게 추가해 보라고 해서 도대체 어떻게 하라는 건지 몰라 아래와 같이 넣었더니 해결이 되었다. 고 하기에는 또 다른 문제가 발생한다.ㅜ.ㅜ

 

 

앱은 만들어졌으나 작동을 하지 않는다. 그리고 경고 문구의 뜻은 제미니와 딥식이의 답변으로는 app/build.gradle에서 자바 버전을 올리란다. 딥식이는 11을 제미니는 11, 17, 19가 있는데, 그중에 17을 권장한단다.

일단, 17로 바꿔 보고 다시 build해 보자.

 

역시나 빨간줄이다. 고마워~~

 

이번에는 자바 어쩌고다. 

 

 

 

buildscript {
    ext.kotlin_version = '1.9.0' // Kotlin 버전도 함께 업데이트
    repositories {
        google()
        mavenCentral()
    }
    dependencies {
        classpath 'com.android.tools.build:gradle:8.2.1' // AGP 버전 업그레이드
        classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
    }
}

 

또다시 원점인가? inaapwebview를 최신 버전으로 그리고, namespace를 추가하라고? 이미 다 끝낸 녀석들이잖아~!

ERROR: Missing classes detected while running R8. Please add the missing classes or apply additional keep rules that are generated in C:\Users\User\StudioProjects\lollipaps\build\flutter_inappwebview\outputs\mapping\release\missing_rules.txt. ERROR: R8: Missing class android.window.BackEvent (referenced from: void io.flutter.view.FlutterView.startBackGesture(android.window.BackEvent) and 1 other context) FAILURE: Build failed with an exception. * What went wrong: Execution failed for task ':flutter_inappwebview:minifyReleaseWithR8'. > A failure occurred while executing com.android.build.gradle.internal.tasks.R8Task$R8Runnable > Compilation failed to complete * 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.

 

chatGPT의 해결책

딥식이의 해결책

 

재미니의 해결책

 

지난 번에도 설치해 둔 거 같은데.. JDK 17을 받아서 다시 설치해 본다.

환경 변수 추가하기

Path도 추가

C:\Program Files\Java\jdk-17

 

설치 완료 되었는지 cmd에서 확인해 보라고 해서 확인함. 명령어는 ' java -version '

 

그리고 최종적으로 플러터에 적용하란다.

 

나에겐 이렇게 되어 있는데..

챗 GPT가 그냥 아래 한 줄 집어넣으란다.

 

 

오늘 정리는 여기까지.. 그러고 나서 flutter clean, flutter pub get, flutter build apk --release를 해 보란다.

 

음..역시.. 고마워~~

 

지친다.. 내일 보자~~!!!

반응형