• 로그인
  • 장바구니에 상품이 없습니다.

home2 게시판 Flutter 게시판 gradle build 중 오류

gradle build 중 오류

  • 이 주제에는 11개 답변, 2명 참여가 있으며 CHUNGSIN6 월, 1 주 전에 전에 마지막으로 업데이트했습니다.
10 글 보임 - 1 에서 10 까지 (총 12 중에서)
  • 글쓴이
  • #133681

    CHUNGSIN
    참가자
    1. 아래 gradle build 오류 메시지로 검색 중
    * What went wrong:
    A problem occurred configuring project ':sqlite3_flutter_libs'.
    > Could not create an instance of type com.android.build.api.variant.impl.LibraryVariantBuilderImpl.
    
    앞서 문의 한 게시글을 확인하여 동일하게 따라갔습니다.(<a href="https://codingapple.com/forums/topic/namespace-agp-%ec%98%a4%eb%a5%98-%ec%a7%88%eb%ac%b8-%eb%93%9c%eb%a6%bd%eb%8b%88%eb%8b%a4/">링크</a>)
    2. build.gradle 내  추천해 주신 아래 문구를 추가 했더니 
    subprojects {
        afterEvaluate { project ->
            if (project.hasProperty('android')) {
                project.android {
                    if (namespace == null) {
                        namespace project.group
                    }
                }
            }
        }
    }
    
    
    다음과 같은 빌드 오류가 발생합니다. 
    * What went wrong:
    A problem occurred evaluating root project 'android'.
    > Cannot run Project.afterEvaluate(Closure) when the project is already evaluated.
    
    앞선 게시글에서 이후 조치 사항
    [ https://stackoverflow.com/a/71014094 에서 android/app/build.gradle 파일에 한줄 추가하라는것도 해봅시다 ] 에 따라 
    아래 플러그인을 적용하려 했으나 다음과 같은 오류가 발생합니다.
    apply plugin: 'com.onesignal.androidsdk.onesignal-gradle-plugin'
    
    * What went wrong:
    Plugin [id: 'com.onesignal.androidsdk.onesignal-gradle-plugin'] was not found in any of the following sources:
    - Gradle Core Plugins (plugin is not in 'org.gradle' namespace)
    - Plugin Repositories (plugin dependency must include a version number for this source)
    
    적용 내용은 아래와 같습니다.
    plugins {
        id "com.android.application"
        id "kotlin-android"
        // The Flutter Gradle Plugin must be applied after the Android and Kotlin Gradle plugins.
        id "dev.flutter.flutter-gradle-plugin"
        id "com.onesignal.androidsdk.onesignal-gradle-plugin"
    }
    
    
    
    
    
    
    • 이 게시글은 CHUNGSIN에 의해 6 월, 1 주 전에 수정됐습니다.
    #133687

    codingapple
    키 마스터
    어떤거 설치하다가 나온 에러입니까
    #133706

    CHUNGSIN
    참가자
    pubspec 내 dependencies로 sqlite3_flutter_libs: 0.5.10를 추가한 후에 발생한 오류입니다 
    
    #133711

    codingapple
    키 마스터
    그거 0.5.27 버전으로 설치해봅시다
    #133722

    CHUNGSIN
    참가자
    바쁘신 와중에 답변 감사합니다. 
    다만 버전을 변경해도 동일한 오류가 발생합니다 ㅠ
    
    * What went wrong:
    Plugin [id: 'com.onesignal.androidsdk.onesignal-gradle-plugin'] was not found in any of the following sources:
    - Gradle Core Plugins (plugin is not in 'org.gradle' namespace)
    - Plugin Repositories (plugin dependency must include a version number for this source)
    
    혹시나 해서 해당 플러그인을 제거하고 빌드 하니 아래와 같은 오류가 발생합니다.
    * What went wrong:
    A problem occurred evaluating root project 'android'.
    > Cannot run Project.afterEvaluate(Closure) when the project is already evaluated.
    
    도움 부탁드립니다 ㅠㅠ
    
    
    #133726

    CHUNGSIN
    참가자
    앞선 오류를 해결하기 위해 다음과 같이 진행해 보았습니다.
    
    1. android/app/build.gradle에서 id "com.onesignal.androidsdk.onesignal-gradle-plugin" 구문을 삭제하고,
     android/build.gradle에서 구문 순서를 다음과 같이 적용하였습니다.
    
    
    subprojects {
        project.buildDir = "${rootProject.buildDir}/${project.name}"
    }
    subprojects {
        afterEvaluate { project ->
            if (project.hasProperty('android')) {
                project.android {
                    if (namespace == null) {
                        namespace project.group
                    }
                }
            }
        }
    }
    subprojects {
        project.evaluationDependsOn(":app")
    }
    
    
    2. 이렇게 적용 후 빌드하니 다음과 같은 오류가 발생하였습니다.
    
    * What went wrong:
    Execution failed for task ':sqlite3_flutter_libs:processDebugManifest'.
    > A failure occurred while executing com.android.build.gradle.tasks.ProcessLibraryManifest$ProcessLibWorkAction
       > Incorrect package="com.example.sqlite3_flutter_libs" found in source AndroidManifest.xml: C:\Users\SAMSUNG\AppData\Local\Pub\Cache\hosted\pub.dev\sqlite3_flutter_libs-0.5.10\android\src\main\AndroidManifest.xml.
         Setting the namespace via the package attribute in the source AndroidManifest.xml is no longer supported.
         Recommendation: remove package="com.example.sqlite3_flutter_libs" from the source AndroidManifest.xml: C:\Users\SAMSUNG\AppData\Local\Pub\Cache\hosted\pub.dev\sqlite3_flutter_libs-0.5.10\android\src\main\AndroidManifest.xml.
    
    3. sqlite3_flutter_libs 버전 충돌인가 하여 기존 버전 0.5.10으로 적용후 다시빌드 했으나 다음과 같은 오류가 발생합니다.
    
    Warning: SDK processing. This version only understands SDK XML versions up to 3 but an SDK XML file of version 4 was encountered. This can happen if you use versions of Android Studio and the command-line tools that were released at different times.
    WARNING: We recommend using a newer Android Gradle plugin to use compileSdk = 34
    This Android Gradle plugin (8.1.0) was tested up to compileSdk = 33 (and compileSdkPreview = "UpsideDownCakePrivacySandbox").
    You are strongly encouraged to update your project to use a newer
    Android Gradle plugin that has been tested with compileSdk = 34.
    If you are already using the latest version of the Android Gradle plugin,
    you may need to wait until a newer version with support for compileSdk = 34 is available.
    To suppress this warning, add/update
        android.suppressUnsupportedCompileSdk=34
    to this project's gradle.properties.
    > Task :sqlite3_flutter_libs:processDebugManifest FAILED                                                                                                                                                                                                                                                            
    Incorrect package="com.example.sqlite3_flutter_libs" found in source AndroidManifest.xml: C:\Users\SAMSUNG\AppData\Local\Pub\Cache\hosted\pub.dev\sqlite3_flutter_libs-0.5.10\android\src\main\AndroidManifest.xml.                                                                                                 
    Setting the namespace via the package attribute in the source AndroidManifest.xml is no longer supported.
    Recommendation: remove package="com.example.sqlite3_flutter_libs" from the source AndroidManifest.xml: C:\Users\SAMSUNG\AppData\Local\Pub\Cache\hosted\pub.dev\sqlite3_flutter_libs-0.5.10\android\src\main\AndroidManifest.xml.
    FAILURE: Build failed with an exception.
    * What went wrong:
    Execution failed for task ':sqlite3_flutter_libs:processDebugManifest'.
    > A failure occurred while executing com.android.build.gradle.tasks.ProcessLibraryManifest$ProcessLibWorkAction
       > Incorrect package="com.example.sqlite3_flutter_libs" found in source AndroidManifest.xml: C:\Users\SAMSUNG\AppData\Local\Pub\Cache\hosted\pub.dev\sqlite3_flutter_libs-0.5.10\android\src\main\AndroidManifest.xml.
         Setting the namespace via the package attribute in the source AndroidManifest.xml is no longer supported.
         Recommendation: remove package="com.example.sqlite3_flutter_libs" from the source AndroidManifest.xml: C:\Users\SAMSUNG\AppData\Local\Pub\Cache\hosted\pub.dev\sqlite3_flutter_libs-0.5.10\android\src\main\AndroidManifest.xml.
    * 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.
    Deprecated Gradle features were used in this build, making it incompatible with Gradle 9.0.
    You can use '--warning-mode all' to show the individual deprecation warnings and determine if they come from your own scripts or plugins.
    For more on this, please refer to https://docs.gradle.org/8.3/userguide/command_line_interface.html#sec:command_line_warnings in the Gradle documentation.
    BUILD FAILED in 16s
    32 actionable tasks: 28 executed, 4 up-to-date
    
    어떻게 적용하는 것이 좋을지 의견 부탁드립니다 ㅠㅠ
    
    
    		
    	
    #133731

    codingapple
    키 마스터
    다른건 냅두고 패키지만 신버전으로 설치해서 써봅시다
    안되면 https://stackoverflow.com/a/72523134 이런 파일에서 gradle버전을 gradle-7.4-all.zip 이런걸로 낮춰봅시다
    #133733

    CHUNGSIN
    참가자
    우여곡절 끝에 terminal에서 ./gradlew clean build로는 성공했습니다. 
    에뮬레이터로 프로젝트를 실행하니 아래와 같은 오류가 발생합니다. ㅠ 이것도 gradle 버전을 낮추면 괜찮을까요?
    
    FAILURE: Build failed with an exception.
    * What went wrong:
    Execution failed for task ':app:compileDebugJavaWithJavac'.
    > Could not resolve all files for configuration ':app:androidJdkImage'.
       > Failed to transform core-for-system-modules.jar to match attributes {artifactType=_internal_android_jdk_image, org.gradle.libraryelements=jar, org.gradle.usage=java-runtime}.
          > Execution failed for JdkImageTransform: C:\Users\SAMSUNG\AppData\Local\Android\sdk\platforms\android-34\core-for-system-modules.jar.
             > Error while executing process C:\Program Files\Android\Android Studio\jbr\bin\jlink.exe with arguments {--module-path C:\Users\SAMSUNG\.gradle\caches\transforms-3a46fc89ed5f9adfe3afebf74eb8bfeb\transformed\output\temp\jmod --add-modules java.base --output C:\Users\SAMSUNG\.gradle\caches\transforms-3a46fc89ed5f9adfe3afebf74eb8bfeb\transformed\output\jdkImage --disable-plugin system-modules}
    
    #133753

    codingapple
    키 마스터
    https://stackoverflow.com/a/79191154 그것도 gradle 버전이나 자바 버전 바꾸면 된다는 소리가 있습니다
    #133811

    CHUNGSIN
    참가자
    여러가지 시도 끝에 빌드에 성공했습니다.
    다만 다른 라이브러리를 추가하면서 또다른 오류가 발생했습니다 ㅠ
    버전정보 
    - Gradle 8.3
    - Kotlin:       1.9.0
    - Groovy:       3.0.17
    - JVM:          17.0.13 (Oracle Corporation 17.0.13+10-LTS-268)
    
    추가 라이브러리 : pate_provider , 버전 : 2.0.11 or 2.1.2 두가지 모두 아래와 같은 오류가 발생합니다.
    * What went wrong:
    Execution failed for task ':path_provider_android:compileDebugJavaWithJavac'.
    > Could not resolve all files for configuration ':path_provider_android:androidJdkImage'.
    해결할 수 있는 방법이 있을까요? 도움 부탁드립니다 ㅠㅠ
10 글 보임 - 1 에서 10 까지 (총 12 중에서)
  • 답변은 로그인 후 가능합니다.

About

현재 월 700명 신규수강중입니다.

  (09:00~20:00) 빠른 상담은 카톡 플러스친구 코딩애플 (링크)
  admin@codingapple.com
  이용약관
ⓒ Codingapple, 강의 예제, 영상 복제 금지
top

© Codingapple, All rights reserved. 슈퍼로켓 에듀케이션 / 서울특별시 강동구 고덕로 19길 30 / 사업자등록번호 : 212-26-14752 온라인 교육학원업 / 통신판매업신고번호 : 제 2017-서울강동-0002 호 / 개인정보관리자 : 박종흠