Place the unzipped Gradle file in the following location /Applications/Unity/Hub/Editor/2021.3.12f1/PlaybackEngines/AndroidPlayer/Tools/gradle/ Please note that 2021.3.12f1 is the editor version and should be replaced with your own environment.
Next, open Unity and change the Gradle to be used. From the top menu, select Unity > Preferences and open External Tools.
Uncheck the box marked "Gradle Installed with Unity (recommended)" and enter the path to the Gradle you just placed.
Now the Gradle used for building has been switched to a different version. If there are no problems with the version, you should now be able to build Android.
[Error] Error building Player: Exception: OBSOLETE - Providing Android resources in Assets/Plugins/Android/assets was removed, please move your resources to an AAR or an Android Library. See ""AAR plug-ins and Android Libraries"" section of the Manual for more details.
- 관련 에러 위치 찾아가서 Team Id를 선택하면 잘되긴 하는데, 빌드때마다 수동으로 하기는 애매해서 찾아보니 PodFile에 아래 내용을 추가하면 된다고 한다.
post_install do |installer|
installer.pods_project.targets.each do |target|
if target.respond_to?(:product_type) and target.product_type == "com.apple.product-type.bundle"
target.build_configurations.each do |config|
config.build_settings['CODE_SIGN_IDENTITY'] = ""
#prevent resource bundle from reading image nil
config.build_settings.delete('PRODUCT_BUNDLE_IDENTIFIER')
end
end
end
end
- iOS 빌드해서 PodFile 수작업을 계속할 수는 없는지라 Unity의 Xcode PostProcessBuild에서 자동으로 추가하도록 함.
(Define을 봐서는 Unity2019.3 이상에서만 가능한 것 같다)
#if UNITY_2019_3_OR_NEWER
// FixPodFile 사용법 참조
// https://github.com/googlesamples/unity-jar-resolver/issues/405 : Str4tos 댓글
[PostProcessBuild(45)]//must be between 40 and 50 to ensure that it's not overriden by Podfile generation (40) and that it's added before "pod install" (50)
private static void FixPodFile(BuildTarget buildTarget, string buildPath)
{
/// Stop processing if target is NOT iOS
if (buildTarget != BuildTarget.iOS)
return;
using (StreamWriter sw = File.AppendText(buildPath + "/Podfile"))
{
// [Error 대응] (Xcode 14): Signing for "GoogleSignIn-GoogleSignIn" requires a development team.
// [해결방법 참조] https://github.com/CocoaPods/CocoaPods/issues/11402 : JosephPoplar 댓글
sw.WriteLine("\npost_install do |installer|\n installer.pods_project.targets.each do |target|\n if target.respond_to?(:product_type) and target.product_type == \"com.apple.product-type.bundle\"\n target.build_configurations.each do |config|\n config.build_settings['CODE_SIGN_IDENTITY'] = \"\"\n #prevent resource bundle from reading image nil\n config.build_settings.delete('PRODUCT_BUNDLE_IDENTIFIER')\n end\n end\n end\nend");
/// ex
//sw.WriteLine("\ntarget 'Unity-iPhone' do\nend");
}
}
#endif