세상사는 이야기 / 도움이 되었다면 배너 클릭 부탁드려요~ →→→

2021년 8월 23일 월요일

[Unity Android] Build - error: unexpected element found in

유니티에서 Plugin 추가 후 빌드 에러가 발생했다.

    유니티 버전 2019.4.29f1


증상

* What went wrong:
Execution failed for task ':launcher:processReleaseResources'.
> Android resource linking failed
C:\Work\DCubeClient\Temp\gradleOut\launcher\build\intermediates\merged_manifests\release\AndroidManifest.xml:42: AAPT: error: unexpected element <queries> found in <manifest>.



빌드된 merged_manifests 파일 확인

C:\Work\DCubeClient\Temp\gradleOut\launcher\build\intermediates\merged_manifests\release\AndroidManifest.xml


해결법

Gradle 버전이 낮아서 생기는 문제로 3.4.0 -> 3.4.3 변경한다.

    참고

    https://stackoverflow.com/questions/62969917/how-to-fix-unexpected-element-queries-found-in-manifest-error


1. BaseGradleTemplate 체크


2. Assets\Plugins\Android\baseProjectTemplate.gradle File 편집

gradle:3.4.0 -> gradle:3.4.3 으로 변경 후 저장

classpath 'com.android.tools.build:gradle:3.4.0' -> classpath 'com.android.tools.build:gradle:3.4.3' ->



baseProjectTemplate.gradle File

// GENERATED BY UNITY. REMOVE THIS COMMENT TO PREVENT OVERWRITING WHEN EXPORTING AGAIN
allprojects {
    buildscript {
        repositories {**ARTIFACTORYREPOSITORY**
            google()
            jcenter()
        }

        dependencies {
            // If you are changing the Android Gradle Plugin version, make sure it is compatible with the Gradle version preinstalled with Unity
            // See which Gradle version is preinstalled with Unity here https://docs.unity3d.com/Manual/android-gradle-overview.html
            // See official Gradle and Android Gradle Plugin compatibility table here https://developer.android.com/studio/releases/gradle-plugin#updating-gradle
            // To specify a custom Gradle version in Unity, go do "Preferences > External Tools", uncheck "Gradle Installed with Unity (recommended)" and specify a path to a custom Gradle version
            classpath 'com.android.tools.build:gradle:3.4.3'
            **BUILD_SCRIPT_DEPS**
        }
    }

    repositories {**ARTIFACTORYREPOSITORY**
        google()
        jcenter()
        flatDir {
            dirs "${project(':unityLibrary').projectDir}/libs"
        }
    }
}

task clean(type: Delete) {
    delete rootProject.buildDir
}


댓글 없음:

댓글 쓰기