WARNING:/Users/{UserAccount}/.gradle/caches/transforms-2/files-2.1/ea30c3c071cd48c926311878c13eb08b/jetified-unity-classes.jar: D8: Expected stack map table for method with non-linear control flow.
그래서 아래 위치의 gradle cache 하위 있는 것들을 모두 삭제하고 새로 빌드를 실행해서 잘 돌아가는 것을 확인했다.
WARNING:/Users/{UserAccount}/.gradle/caches/transforms-2/files-2.1/ea30c3c071cd48c926311878c13eb08b/jetified-unity-classes.jar: D8: Expected stack map table for method with non-linear control flow.
그래서 아래 위치의 gradle cache 하위 있는 것들을 모두 삭제하고 새로 빌드를 실행해서 잘 돌아가는 것을 확인했다.
> Configure project :unityLibrary Build was configured to prefer settings repositories over project repositories but repository 'maven' was added by build file 'unityLibrary\build.gradle'
...
[빌드에러 #2]
Execution failed for task ':launcher:checkReleaseDuplicateClasses'. > Could not resolve all files for configuration ':launcher:releaseRuntimeClasspath'.
Also, there is another workaround that keeps the Gradle version (in case some android lib requires it). For that workaround, you will need to copy a file from/Applications/Unity/Hub/Editor/2022.2.3f1/PlaybackEngines/AndroidPlayer/Tools/GradleTemplates/settingsTemplate.gradletoAssets/Plugins/Android/settingsTemplate.gradle. That way Unity will use your template inAssets/Plugins/Android. (It's weird that Unity doesn't has a checkbox for that) For my version of unity, it looks like that:
The conflicting part isRepositoriesMode.PREFER_SETTINGS. But you can safely delete the wholedependencyResolutionManagementblock from here. Since the android project still needs to know about local dependencies, copy therepositoriesblock, you will need it later. NowsettingsTemplate.gradleshould look like this:
* What went wrong: Execution failed for task ':launcher:dexBuilderRelease'. > java.lang.UnsupportedOperationException: This feature requires ASM7
...
[해결]
gradle 버전이 낮아서 생기는 문제라고 한다.
Android 11이슈로 쓰던 gradle 버전이 com.android.tools.build:gradle:3.4.3 이었는데,
Unity 2021.3.16f1 기준 기본 버전이 com.android.tools.build:gradle:4.0.1 이어서 해당 버전을 사용하니 빌드가 잘된다.
다시 해보니 Unity 2021.3.16f1 기본 버전인 com.android.tools.build:gradle:4.0.1 이 빌드가 제대로 안돼서,
com.android.tools.build:gradle:4.0.1+로 수정하고 나서 제대로 되는 걸 확인했다.
(GoogleMobileAds 7.4.0이 gradle 4.0.1에서 에러나는걸로 봐서는 상위 버전 뭔가를 쓰는 것 같은데 무슨 버전을 쓰는지 모르겠어서 +를 붙였음)
[주의]
gradle 버전을 해당 Unity 엔진이 가지고 있는 버전보다 높게 올리면 아래와 같은 에러를 보게 된다.
지정한 gradle 버전을 사용하려면 맞는 gradle 플러그인 버전을 받아서 해당 위치에 넣어주거나,
현재 Unity 엔진이 가지고 있는 버전에 맞추거나 하자.
(난 받기 귀찮기도 하고, 협업을 하려면 다른 곳도 설치해줘야 되는 문제들로 인해서
현재 Unity 버전이 지원하는(gradle 4.0.1) 걸로 셋팅 함)
FAILURE: Build failed with an exception.
* Where:
Build file 'C:\Project\git\GuitarGirl\Library\Bee\Android\Prj\IL2CPP\Gradle\launcher\build.gradle' line: 1
* What went wrong:
A problem occurred evaluating project ':launcher'.
> Failed to apply plugin [id 'com.android.internal.version-check']
> Minimum supported Gradle version is 6.5. Current version is 6.1.1. If using the gradle wrapper, try editing the distributionUrl in C:\Project\git\GuitarGirl\Library\Bee\Android\Prj\IL2CPP\Gradle\gradle\wrapper\gradle-wrapper.properties to gradle-6.5-all.zip