Failed to look up symbolic reference at 0x10dc0191f - offset 796625 - symbol symbolic _____Sg 14MarketplaceKit14AppDistributorO in /private/var/folders/zh/ln0rqwm94499jwvk1x_hl5r00000gp/X/XXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXX/d/Wrapper/MyApp.app/Frameworks/UnityFramework.framework/UnityFramework
그런데 Unity 2021.3.41f1에서도 여전히 빌드에러가 나서 에러 메시지를 확인해보니 아래와 같은 부분이 있다.
stderr[
FAILURE: Build completed with 3 failures.
1: Task failed with an exception.
-----------
* What went wrong:
Execution failed for task ':launcher:checkReleaseDuplicateClasses'.
> Could not resolve all files for configuration ':launcher:releaseRuntimeClasspath'.
> Could not find com.google.firebase:firebase-analytics-unity:12.1.0.
Searched in the following locations:
- https://maven.google.com/com/google/firebase/firebase-analytics-unity/12.1.0/firebase-analytics-unity-12.1.0.pom
- file:////Assets/GeneratedLocalRepo/Firebase/m2repository/com/google/firebase/firebase-analytics-unity/12.1.0/firebase-analytics-unity-12.1.0.pom
file:////Assets/GeneratedLocalRepo/Firebase/m2repository/... 부분의 앞에 프로젝트의 Path가 있어야 되는데 제대로 들어가지 않고 있는 것 같다.
해당 부분은 settingsTemplate.gradle에서 절대경로를 넣으면 임시로 해결이 된다고 하는데,
Unity 2021에서는 Custom SettingsTemplate Gradle 파일 활성화 옵션이 없지만 파일 자체를 Plugins/Android 폴더에 넣으면 제대로 작동한다.
settingsTemplate.gradle 파일 안에 **DIR_UNITYPROJECT**를 넣으면 제대로 작동해야되는데 작동을 하지 않아서 IPostGenerateGradleAndroidProject를 사용해서 Path를 절대경로로 교체하는 방식 제안이 있어서 적용해 봤지만 제대로 여전히 빌드가 제대로 되지 않는다.
1) Unity 2021.3.41f1에서 많이 바껴서 baseProjectTemplate.gradle / gradleTemplate.properties / mainTemplate.gradle 등 gradle 관련 파일들을 삭제 후 새로 생성하자.
(특히 gradle 버전이 많이 올라가서 baseProjectTemplate.gradle은 새로 생성해줄 필요가 있다.)
2) Android Min API24 / Target API34로 변경
(Min API 23에서는 아래와 같은 에러 발생함)
stderr[
Note: Some input files use or override a deprecated API.
Note: Recompile with -Xlint:deprecation for details.
ERROR:D8: com.android.tools.r8.kotlin.H
ERROR:D8: com.android.tools.r8.kotlin.H
ERROR:D8: com.android.tools.r8.kotlin.H
3) 아래 settingsTemplate.gradle 파일을 ../Assets/Plugins/Android 폴더에 추가
4) 아래 BuildPreprocessor_settingsTemplateGradle.cs 파일을 Editor 폴더에 추가
[Error] Type specifier missing, defaults to 'int'; ISO C99 and later do not support implicit int [Warning] Incompatible pointer to integer conversion passing 'void *' to parameter of type 'int' ---- BOOL __swizzled_didReceiveRemoteNotification(idself, SEL_cmd, UIApplication* application, NSDictionary* userInfo,void (^UIBackgroundFetchResult)(void) ) { NSLog(@"swizzled didReceiveRemoteNotification");
> 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: