* What went wrong: Execution failed for task ':packageRelease'. > 1 exception was raised by workers: java.io.UncheckedIOException:java.io.IOException: Failed to obtain compression information for entry
해결책은 아래와 같다.
Minify-Release/Debug가 기본 None인데, 업데이트 되면서 값을 넣어야 되나보다.
Proguard 이야기도 있긴한데, 우선 아래 보이는대로 Gradle (Experimental) 로 바꾸니 빌드가 잘 된다.
Someone inthe thread from unity forumfinally posted a working solution. I'm gonna share it here as well so hopefully everyone who lands on the question with this issue will not have to spend 30 hours blindfolded, resolving dex merging conflicts like I did.
Turns out that with new new version there is a few more options in thepublish settingsthat needs to be set!
quotingRealPpTheBests' answer
Go to player settings > Project Settings > Minify, in there, there will be an option of Release, set it to Gradle .
For some reason when choosing gradle build these two are not automatically toggled, and maybe in some cases they don't have to be. But setting minify toGrable (experimental)completely resolved all the build errors I was getting after updating unity.
EDIT: september-2019 - Solution above should still work, but:
I have lately been experimenting with choosingProguardinstead of the experimental Gradle minifier (can be selected in the dorpdown as well). When configured correctly proguard will also resolve your DEX limitation errors, and get rid of unused code and even compress your build size even more.
This posthas a quite throughly detailed guide on how to enable and configure it. Keep in mind though, that the configuration will be unique to which dependencies you are using, so you will have to read up and do some custom configuration here most likely.
Project Settings -> Player -> Publishing Settings -> Minify -> For Both Release and Debug = "Proguard" solved the problem (after importing Facebook SDK)– Ahmet HayrullahogluNov 23 '19 at 9:56
1
Glad to hear that my edited solution from September also worked in your case! That means it will probably work for more people.– Rasmus PulsNov 24 '19 at 19:26
Traceback (most recent call last): File "", line 446, in File "", line 289, in main File "", line 228, in argv_as_unicode_win32 AttributeError: 'module' object has no attribute 'wintypes' generate_xml_from_google_services_json returned -1
Firebase 6.9.0을 유니티에 Import하고 위와 같은 에러를 보게 됐다.
결론적으로 wintypes attribute가 없다는 말인데 저게 뭔지 몰라서 한참 찾아 헤메다가
구글링으로 이것 저것 같아 보았는데, compileSdkVersion 와 com.android.support:appcompat-v7을 28로 올리면 해결된다는 글이 많았습니다.
그래서 원인을 찾아보고 해결 방법을 찾았습니다.
[오류]
error: resource android:attr/fontVariationSettings not found.
Message{kind=ERROR, text=error: resource android:attr/fontVariationSettings not found.,
sources=[C:\*****\*****\.gradle\caches\transforms-1\files-1.1\appcompat-v7-26.1.0.aar\4fbc79d932923de1fd1d9a6e9b479d50\res\values\values.xml:246:5-69], original message=, tool name=Optional.of(AAPT)}
error: resource android:attr/ttcIndex not found.
Message{kind=ERROR, text=error: resource android:attr/ttcIndex not found.,
sources=[C:\*****\*****\.gradle\caches\transforms-1\files-1.1\appcompat-v7-26.1.0.aar\4fbc79d932923de1fd1d9a6e9b479d50\res\values\values.xml:246:5-69], original message=, tool name=Optional.of(AAPT)}
[원인]
애드몹의 SDK 최신 버전이 18로 이번주에 배포 되어 있는데, 이 SDK의 경우 Android API 28(안드로이드 9) 에서 최적화 된듯 합니다.
gradle의 dependencies에서 최신의 애드몹 SDK를 참조하고 있고, Andorid API가 27 이하인 경우에 발생합니다.
[해결]
모듈 gradle에서 참조하고 있는 애드몹의 SDK의 버전을 17로 설정하면 컴파일 오류가 해결됩니다.
Android devices with a notch (display cutout) have recently become quite common. However, if you make a Unity application and deploy it to such device, by default Android OS will letter-box your app so that it the notch doesn't interfere with your UI.
If you want to make use of the whole display surface area and render in the area "behind" the notch, you need to add code to your application. Fortunately, since Unity 2018.3 there is a special option in the Player settings called "Render outside safe area" which does exactly this. If you want to have the same option in earlier versions of Unity - this plugin was made for you!
One advantage of this plugin over the built-in Unity solution is that it allows changing the setting in runtime if needed, by callingpublic void SetRenderBehindNotch(bool enabled)inRenderBehindNotchSupport.
If you are planning to make use of "rendering behind the notch" feature, you'll also need another feature which returns you the area of the screen which is outside of the notch area (and is safe to render to). The API is equivalent to whatScreen.safeAreaAPI does in newer Unity versions, and returns aRect.
This plugin is targeted towards Unity 2017.4, however I see no reasons why it shouldn't work with earlier versions too.
System Requirements
Tested on Unity 2017.4.28f1. Should work on any Unity version out there, but make sure your target API is set to 28 or higher. There is no point in using this plugin in Unity 2018.3 or later because these versions have notch support out of the box.
An Android device with Android 9 Pie or later. Some devices with earlier Android versions have notch/cutout, but Google has added a corresponding API only in Android 9. Feel free to add other vendor-specific bits of code to add support on earlier Androids at your own risk.
Usage
Copy the contents ofAssetsdirectory to your project
Attach theAssets/Scripts/RenderBehindNotchSupport.csscript to a game object of your choice in your first scene to make sure the plugin is loaded as early as possible
The script has a public boolean property so that you can tick/untick the checkbox to enable or disable rendering behind the notch with a single click
If you want to change the setting in runtime, callpublic void SetRenderBehindNotch(bool enabled)inRenderBehindNotchSupportclass.
Attach theAssets/Scripts/AndroidSafeArea.csscript to a game object of your choice if you need the safe area API. The propertyAndroidSafeArea.safeAreais returning aRect, use it to layout your UI.
Enjoy
Alternative solution
Instead of using the script (or if you want to apply the "render behind the notch" flag as early as possible), you could modify the theme used by Unity. To do so, please create a file at the pathAssets/Plugins/Android/res/values-v28/styles.xmlwith the following contents:
Unity 편집기에서 화면 크기를 iPhoneX와 같은 크기 (1125 × 2436)로 설정하면 Unity Player에서 디버그 할 수도 있습니다.
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using System.Runtime.InteropServices;
public class SafeAreaScreen {
#if UNITY_IOS
[DllImport("__Internal")]
private extern static void GetSafeAreaImpl(out float x, out float y, out float w, out float h);
#endif
static public Rect GetSafeArea()
{
float x, y, w, h;
//初期値設定
x = 0;
y = 0;
w = Screen.width;
h = Screen.height;
#if UNITY_IOS && !UNITY_EDITOR
//iOSSafeAreasPluginを呼び出す
GetSafeAreaImpl(out x, out y, out w, out h);
#elif UNITY_ANDROID && !UNITY_EDITOR
//Androidの縦長端末対応が必要になったときのために
#else
//UnityエディタでiPhoneXのテストできるように値を設定する
if(Screen.width == 1125 && Screen.height == 2436 ){
y = 102;
h = 2202;
}
#endif
return new Rect(x, y, w, h);
}
static public int GetTopOffsetY(){
int offset = 0;
//画面の高さとセーフエリアの高さの差分
Rect screenSize = GetSafeArea();
if (Screen.height != screenSize.height) {
offset = Screen.height - (int)screenSize.height - (int)screenSize.y;
}
return offset;
}
static public int GetBottomOffsetY(){
int offset = 0;
//セーフエリアのyの位置取得
Rect screenSize = GetSafeArea();
if (Screen.height != screenSize.height) {
offset = (int)screenSize.y;
}
return offset;
}
}
NGUI의 SafeArea
NguiSafeAreaPatch.cs
SafeAreaScreen.cs에서 얻은 안전 영역을 바탕으로 Anchor의 위치를 조정합니다.
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class NguiSafeAreaPatch : MonoBehaviour {
void Awake()
{
// UIAnchorを使ってAnchorを設定している場合
UIAnchor anchor = gameObject.GetComponent();
if(anchor != null){
//offsetの値を取得する
SetUIAnchorOffset(anchor);
return;
}
// UIRectをAnchorを使っている場合
UIRect rect = gameObject.GetComponent();
if (rect != null) {
//現在,NGUIのソースコードを解析中
//完成しだい公開予定
return;
}
}
private void SetUIAnchorOffset(UIAnchor anchor){
//現在のoffsetを取得する
Vector2 nowOffset = anchor.pixelOffset;
//TOP側の補正値取得
int topCorrectionOffset = SafeAreaScreen.GetTopOffsetY ();
//Bottom側の補正値取得
int bottomCorrectionOffset = SafeAreaScreen.GetBottomOffsetY ();
switch (anchor.side) {
case UIAnchor.Side.Top:
case UIAnchor.Side.TopLeft:
case UIAnchor.Side.TopRight:
anchor.pixelOffset.Set(nowOffset.x, nowOffset.y - topCorrectionOffset);
break;
case UIAnchor.Side.Bottom:
case UIAnchor.Side.BottomLeft:
case UIAnchor.Side.BottomRight:
anchor.pixelOffset.Set(nowOffset.x, nowOffset.y + bottomCorrectionOffset);
break;
}
}
}
사용법은이 소스 코드를 UIAnchor가 부착되어있는 게임 객체에 첨부 할뿐.
소스에서 무슨 일을하는지는 동작 환경이 iPhoneX 판정되면 스크린과 안전 영역의 높이의 차이를 계산하여 차등 분 게임 오브젝트를 낮 춥니 다.
델타 값은 UIAnchor의 "Pixel Offset"에 할당됩니다.
소스 코드를 반영한 결과
NguiSafeAreaPatch.cs을 UIAnchor에 연결시킨 결과를 기재합니다.
■ 반영 전
■ 반영 후
그 결과 안전 영역을 기준으로 할 수있었습니다.
이것으로 UIAnchor 대해서는 SafeArea의 대처가되었습니다.
그러나, 그 밖에도 「UIRect의 Anchor '에 대해서도 SafeAreas 대응이 있습니다.대응이 끝나는대로 수시 문서에 추가하는 것입니다.