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

2019년 5월 17일 금요일

[Unity Android] ClassNotFoundException com.google.games.bridge.TokenFragment

Unity Android 64bit 빌드중 에러가 발생하여서 기존 SDK를 전부 버전업했다.
unity-jar-resolver 1.2.108, 1.2.109 버전이 아래와 같은 토큰 에러가 발생.
아래 설명처럼 1.2.110이상으로 설치하면 된다.

ClassNotFoundException com.google.games.bridge.TokenFragment after updating from version 1.2.104 to 1.2.108


05-06 11:12:23.462 16323-16386/ W/Unity: *** [Play Games Plugin DLL] 05/06/19 11:12:23 +02:00 ERROR: Exception launching token request: java.lang.ClassNotFoundException: com.google.games.bridge.TokenFragment


참고 링크
https://github.com/googlesamples/unity-jar-resolver/issues/208


아래 링크에서 Unity-jar-resolver버전을 안정된 버전으로 유지하도록 하자
https://github.com/googlesamples/unity-jar-resolver/

Error Log

2019년 3월 20일 수요일

[Unity] Emoji 입력 후 처리

[Unity] Emoji 입력 못받게 하는법
버전 Unity 2018.3

Nick Name이나 채팅에서 유저가 Emoji를 선택 하면 삭제 또는 막는법을 설명한다.

[Android]
android는 입력된 Emoji 찾아 삭제하면 된다.
#if UNITY_ANDROID
            mLabel = Regex.Replace(inputName.text,  "[\uD83C-\uDBFF\uDC00-\uDFFF\u1F30-\u1F5F]+", "").Trim(); // Emoji 삭제 , Trim
#endif

[IOS]
ios는 문자를 바꿀수 없어서 Emoji를 막는 방법은 3가지를 소개한다.
유저가 Emoji눌러도 InputField에는 입력이 들어오지 않게 하는 방법으로
개인적으로는 소스코드 보다 info.list를 수정하는 방법을 추천한다.
코드 수정시 빌드때마다 수정해 주어야한다.

1. Unity IOS 빌드 후 XCode Project에 UI/KEyboard.mm 파일을 찾아서
stringContainsEmoji() 함수의 return값을 항상 NO 처리 하면된다.
static bool stringContainsEmoji(NSString *string)
{
    return NO;
}

2. Unity IOS 빌드 후 XCode Project에 UI/KEyboard.mm 파일의 상위 define 을 1로 수정
#define FILTER_EMOJIS_IOS_KEYBOARD 1 // Disable

3. Xcode info.list 파일 수정
Info.list파일에 아래 필더를 등록하여 define을 바꾸어 준다.
buildSettings / PreprocessorMacros
FILTER_EMOJIS_IOS_KEYBOARD=1

Unity 에서 Info.list파일을 생성해주는 에셋 및 방법은 많다
무료에셋으로 egoxproject를 사용하면 쉽게 추가할 수 있다.

2019년 3월 16일 토요일

[IOS] xcode 설치된 프로비저닝 삭제

설치 위치로 가서 불필요한것을 삭제한다.

/Users/<USER_NAME>/Library/MobileDevice/Provisioning Profiles 폴더로 이동

설치된 프로비저닝 삭제

2019년 2월 28일 목요일

[Unity IOS] Could not extract GUID in text file project/Scene.unity at line xxx

[Unity IOS] Could not extract GUID in text file project/Scene.unity at line 50.

Atlas 작업중 아래와 같은 에러가 종종 발생한다.
AOS는 문제가 없지만 IOS 빌드시에는 아래 에러때문에 빌드가 되지 않는다.

원인은 guid key 값이 000000000000000000000000으로 들어가서 그렇다.
해당 부분을 찾아서  fileID : 2를 0으로 바꾸어 주고 guid를 삭제하면 된다.

texture: {fileID: 2, guid: 00000000000000000000000000000000, type: 0}
->
texture: {fileID: 0}

Error

원인

fileID를 수정


소스로 수정
List<string> scenePaths = new List<string>();
foreach (UnityEditor.EditorBuildSettingsScene S in  UnityEditor.EditorBuildSettings.scenes)
{
    if (S.enabled)
        scenePaths.Add(S.path);
}
string changeString = "texture: {fileID: 0}";
foreach (string str in scenePaths)
{
    string tempPath = Application.dataPath.Replace("Assets", "") + str;
    string[] allLines = File.ReadAllLines(tempPath);
    for (int i = 0; i<allLines.Length; ++i)
    {
        string lineStr = allLines[i];
        if (lineStr.Contains("fileID:") && lineStr.Contains("guid:  00000000000000000000000000000000"))
        {
            lineStr.Remove(0, lineStr.Length);
            lineStr += changeString;
        }
    }
    File.WriteAllLines(tempPath, allLines);
}

2019년 1월 29일 화요일

[Unity Android] Unity 2018 - mainTemplate.gradle 정리

[Unity Android] 버전 체크 mainTemplate.gradle 파일

Unity 2018.3 버전에서 사용

// GENERATED BY UNITY. REMOVE THIS COMMENT TO PREVENT OVERWRITING WHEN EXPORTING AGAIN
buildscript {
    repositories {
        if (GradleVersion.current() >= GradleVersion.version("4.2")) {
            jcenter()
            google()
        } else {
            jcenter()
        }
        maven { url "https://maven.google.com/"}
    }


    dependencies {
           // use newer version of the plugin for newer unity/gradle versions
            if (GradleVersion.current() < GradleVersion.version("4.0")) {
                classpath 'com.android.tools.build:gradle:2.1.0'
            } else if (GradleVersion.current() < GradleVersion.version("4.2")) { // Unity 2018.1 : Gradle version 4.0.1
            classpath 'com.android.tools.build:gradle:2.3.3'
            } else {                        // Unity 2018.2 : Gradle version 4.2.1
                classpath 'com.android.tools.build:gradle:3.0.1'
            }
    }
}


allprojects {
    repositories {
        if (GradleVersion.current() >= GradleVersion.version("4.2")) {
            jcenter()
            google()
        } else {
            jcenter()
        }


        maven { url 'https://maven.google.com'}
        flatDir {
            dirs 'libs'
        }
    }
}


apply plugin: 'com.android.application'


dependencies {
    compile 'com.android.support:multidex:1.0.1'


    if (GradleVersion.current() >= GradleVersion.version("4.2")) {
        implementation fileTree(dir: 'libs', include: ['*.jar'])
    } else {
        compile fileTree(dir: 'libs', include: ['*.jar'])
    }
**DEPS**
}


android {
    compileSdkVersion **APIVERSION**
    buildToolsVersion '**BUILDTOOLS**'


    if (GradleVersion.current() < GradleVersion.version("4.2")) {
        // fix complaint that 3rd party libraries have the same package name
        enforceUniquePackageName false
    }


    defaultConfig {
        minSdkVersion    **MINSDKVERSION**
        targetSdkVersion **TARGETSDKVERSION**
        applicationId '**APPLICATIONID**'
        
        versionCode    **VERSIONCODE**
        versionName    '**VERSIONNAME**'


        // Enabling multidex support.
        multiDexEnabled true


        if (GradleVersion.current() >= GradleVersion.version("4.0")) {
            ndk {
                abiFilters **ABIFILTERS**
            }
        }
    }
    dexOptions {
        javaMaxHeapSize "4g"
    }


    lintOptions {
        abortOnError false
    }


    aaptOptions {
        noCompress '.unity3d', '.ress', '.resource', '.obb'**STREAMING_ASSETS**
    }


**SIGN**
    buildTypes {
          debug {
             minifyEnabled **MINIFY_DEBUG**
            if (GradleVersion.current() >= GradleVersion.version("4.2")) {// > Build-in class shrinker and multidex are not supported yet.
                useProguard **PROGUARD_DEBUG**            
            }
             proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-unity.txt'**USER_PROGUARD**
              jniDebuggable true
          }
          release {
             minifyEnabled **MINIFY_RELEASE**
             if (GradleVersion.current() >= GradleVersion.version("4.2")) {// > Build-in class shrinker and multidex are not supported yet.
                useProguard **PROGUARD_RELEASE**
            }
              proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-unity.txt'**USER_PROGUARD**
              **SIGNCONFIG**
          }
    }
**PACKAGING_OPTIONS**
}


**SOURCE_BUILD_SETUP**


2019년 1월 3일 목요일

[Unity Android] Admob - The Google Mobile Ads SDK was initialized incorrectly.

[Unity Android] Admob - The Google Mobile Ads SDK was initialized incorrectly.

Unity Admob SDK 추가 후 에러 발생
AdMob AppID를 설정하지 않아서 발생하는 에러로 AndroidManifest.xml파일에 AppID 추가 하면 된다.

아래 에러에 나와있는 링크를 보면 해당 설명을 따라하면된다.
https://goo.gl/fQ2neu




GoogleMoblieAdsPlugin 폴더 AndroidManifest.xml파일 AppID 추가

Assets/Plugins/Android/GoogleMobileAdsPlugin/AndroidManifest.xml
  • APPLICATION_ID 추가
<?xml version="1.0" encoding="utf-8"?>
<!--
This Google Mobile Ads plugin library manifest will get merged with your
application's manifest, adding the necessary activity and permissions
required for displaying ads.
-->
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
    package="com.google.unity.ads"
    android:versionName="1.0"
    android:versionCode="1">
  <uses-sdk android:minSdkVersion="14" android:targetSdkVersion="19" />
  <application>
    <!-- Your AdMob App ID will look similar to this sample ID: ca-app-pub-3940256099942544~3347511713 -->
    <meta-data android:name="com.google.android.gms.ads.APPLICATION_ID" android:value="ca-app-pub-3940256099942544~3347511713"/>
  </application>
</manifest>


2019년 1월 2일 수요일

[Android] IAP Subscription Google 영수증 정보

[Android] IAP Subscription Google 영수증 정보

UnityIAP 구독 처리 진행 Google 영수증 정보
https://docs.unity3d.com/kr/2017.4/Manual/UnityIAPPurchaseReceipts.html
https://developer.android.com/google/play/billing/billing_reference.html

로그인 시 "IAP 구독 상품"이 있는지 확인을 위한 "구독 영수증 정보"를 정리했다.
구글에서는 "IAP 구독 테스트"를 위해 기간에 상관없이 5분에 한번씩 결제가 되어서 빠르게 영수증 정보가 확인 가능하다.(자동으로 5번까지 결제됨)

1. 구독 첫 결제
autoRenewing = true
GPA.1234-1234-1234-12345 -
{
    "Store":"GooglePlay",
    "TransactionID":"GPA.1234-1234-1234-12345",
    "Payload":"
    {
        \"json\":\"
        {
            \\\"orderId\\\":\\\"GPA.1234-1234-1234-12345\\\",
            \\\"packageName\\\":\\\"com.kor.fms\\\",
            \\\"productId\\\":\\\"com.kor.fms.mysoldierpack\\\",
            \\\"purchaseTime\\\":1545900055028,
            \\\"purchaseState\\\":0,
            \\\"developerPayload\\\":\\\"
            {
                \\\\\\\"developerPayload\\\\\\\":\\\\\\\"asdfokjdfsafOTI0N3M2RljEz\\\\\\\\n\\\\\\\",
                \\\\\\\"is_free_trial\\\\\\\":false,
                \\\\\\\"has_introductory_price_trial\\\\\\\":false,
                \\\\\\\"is_updated\\\\\\\":false
            }
            \\\",
            \\\"purchaseToken\\\":\\\"maddfaddkoodicpdkdclfpdf.AO-Rl-PBiB3myqbdk4zyWht_DFdfdfWyNVNmutQXSAD\\\",
            \\\"autoRenewing\\\":true
        }\",
        \"signature\":\"5t7anjvTKxP9zOIpqWqqS2A5n\y......wcQlJywnpE4yb8VtGZAsiWkFB06BF5EMA==\",
        \"skuDetails\":\"
        {
            \\\"productId\\\":\\\"com.kor.kor.subsoldierpack\\\",
            \\\"type\\\":\\\"subs\\\",
            \\\"price\\\":\\\"₩3,900\\\",
            \\\"price_amount_micros\\\":3900000000,
            \\\"price_currency_code\\\":\\\"KRW\\\",
            \\\"subscriptionPeriod\\\":\\\"P1W\\\",
            \\\"title\\\":\\\"Soldier Pack(7days)\\\",
            \\\"description\\\":\\\"300 Gems immediately.\\\\nAnd more during the subscription period.\\\"
        }\",
        \"isPurchaseHistorySupported\":true
    }"
}


1-1. 구독 정보 확인
GPA.1234-1234-1234-12345 -
{
"Store":"GooglePlay",
"TransactionID":"GPA.1234-1234-1234-12345",
"Payload":"
{
\"json\":\"
{
\\\"orderId\\\":\\\"GPA.1234-1234-1234-12345\\\",
\\\"packageName\\\":\\\"com.kor.fms\\\",
\\\"productId\\\":\\\"com.kor.fms.mysoldierpack\\\",
\\\"purchaseTime\\\":1545964510849,
\\\"purchaseState\\\":0,
\\\"developerPayload\\\":\\\"
{
\\\\\\\"developerPayload\\\\\\\":\\\\\\\"asdfokjdfsafOTI0N3M2RljEz\\\\\\\\n\\\\\\\",
\\\\\\\"is_free_trial\\\\\\\":false,
\\\\\\\"has_introductory_price_trial\\\\\\\":false,
\\\\\\\"is_updated\\\\\\\":false
}\\\",
\\\"purchaseToken\\\":\\\"maddfaddkoodicpdkdclfpdf.AO-Rl-PBiB3myqbdk4zyWht_DFdfdfWyNVNmutQXSAD\\\",
\\\"autoRenewing\\\":true
}\",
\"signature\":\"k4naFJ4RxZV7qC33U7D7Q74ouevyhLTXG\\/Rk+\\/BAkPsfwDy8AvJwneEpVgvt05HVqd0N8CwCV4xJEF7if\\/==\",
\"skuDetails\":\"
{
\\\"productId\\\":\\\"com.kor.fms.mysoldierpack\\\",
\\\"type\\\":\\\"subs\\\",
\\\"price\\\":\\\"₩3,900\\\",
\\\"price_amount_micros\\\":3900000000,
\\\"price_currency_code\\\":\\\"KRW\\\",
\\\"subscriptionPeriod\\\":\\\"P1W\\\",
\\\"title\\\":\\\"My Soldier Pack(7days) (MY GAME)\\\",
\\\"description\\\":\\\"300 Gems immediately.\\\\nAnd more during the subscription period.\\\"
}\",
\"isPurchaseHistorySupported\":true
}"
}


2. 구독 두번째 결제 
autoRenewing = true

구독 정보 receipt
GPA.1234-1234-1234-12345 -
{
"Store":"GooglePlay",
"TransactionID":"GPA.1234-1234-1234-12345",
"Payload":"
{
\"json\":\"
{
\\\"orderId\\\":\\\"GPA.1234-1234-1234-12345\\\",
\\\"packageName\\\":\\\"com.kor.fms\\\",
\\\"productId\\\":\\\"com.kor.fms.mysoldierpack\\\",
\\\"purchaseTime\\\":1545964510849,\\\"purchaseState\\\":0,
\\\"developerPayload\\\":\\\"
{
\\\\\\\"developerPayload\\\\\\\":\\\\\\\"asdfokjdfsafOTI0N3M2RljEz\\\\\\\\n\\\\\\\",\
\\\\\\"is_free_trial\\\\\\\":false,
\\\\\\\"has_introductory_price_trial\\\\\\\":false,
\\\\\\\"is_updated\\\\\\\":false
}\\\",
\\\"purchaseToken\\\":\\\"maddfaddkoodicpdkdclfpdf.AO-Rl-PBiB3myqbdk4zyWht_DFdfdfWyNVNmutQXSAD\\\",
\\\"autoRenewing\\\":true
}\",
\"signature\":\"k4naFJ4RxZV7qC33U7D7Q74ouevyhLTXG\\/Rk+\\//BAkPsfwDy8AvJwneEpVgvt05HVqd0N8CwCV4xJEF7if\\/==\",
\"skuDetails\":\"
{
\\\"productId\\\":\\\"com.kor.fms.mysoldierpack\\\",
\\\"type\\\":\\\"subs\\\",
\\\"price\\\":\\\"₩3,900\\\",
\\\"price_amount_micros\\\":3900000000,
\\\"price_currency_code\\\":\\\"KRW\\\",
\\\"subscriptionPeriod\\\":\\\"P1W\\\",
\\\"title\\\":\\\"My Soldier Pack(7days) (MY GAME)\\\",
\\\"description\\\":\\\"300 Gems immediately.\\\\nAnd more during the subscription period.\\\"
}\",
\"isPurchaseHistorySupported\":true
}"
}

3. 구독 취소
autoRenewing = false
signature값이 변경되서 온다

구독 정보 receipt
GPA.1234-1234-1234-12345 - 
{
"Store":"GooglePlay",
"TransactionID":"GPA.1234-1234-1234-12345",
"Payload":"
{
\"json\":\"
{
\\\"orderId\\\":\\\"GPA.1234-1234-1234-12345\\\",
\\\"packageName\\\":\\\"com.kor.fms\\\",
\\\"productId\\\":\\\"com.kor.fms.mysoldierpack\\\",
\\\"purchaseTime\\\":1545964510849,\\\"purchaseState\\\":0,
\\\"developerPayload\\\":\\\"
{
\\\\\\\"developerPayload\\\\\\\":\\\\\\\"asdfokjdfsafOTI0N3M2RljEz\\\\\\\\n\\\\\\\",
\\\\\\\"is_free_trial\\\\\\\":false,
\\\\\\\"has_introductory_price_trial\\\\\\\":false,
\\\\\\\"is_updated\\\\\\\":false}\\\",
\\\"purchaseToken\\\":\\\"maddfaddkoodicpdkdclfpdf.AO-Rl-PBiB3myqbdk4zyWht_DFdfdfWyNVNmutQXSAD\\\",
\\\"autoRenewing\\\":false
}\",
\"signature\":\"qUCNlHNY6TJHZxVMTiaPPO6Fuis\\/De\\//+EJl7G0\\/uolQ\\//E5i5qm5rJFbG60\\/FqqWlbXAgLoeEIzA==\",
\"skuDetails\":\"
{
\\\"productId\\\":\\\"com.kor.fms.mysoldierpack\\\",
\\\"type\\\":\\\"subs\\\",
\\\"price\\\":\\\"₩3,900\\\",
\\\"price_amount_micros\\\":3900000000,
\\\"price_currency_code\\\":\\\"KRW\\\",
\\\"subscriptionPeriod\\\":\\\"P1W\\\",
\\\"title\\\":\\\"My Soldier Pack(7days) (MY GAME)\\\",
\\\"description\\\":\\\"300 Gems immediately.\\\\nAnd more during the subscription period.\\\"
}\",
\"isPurchaseHistorySupported\":true
}"
}

4. 구독 끝 
아무 정보도 오지 않는다.

 구독 정보 receipt
""

2018년 12월 19일 수요일

[Unity Error] The associated script cannot be loaded, please fix any compile errors and assign a valid script.

[Unity Error] The associated script cannot be loaded, please fix any compile errors and assign a valid script.

Visual Studio나 Console에서는 에러 내용이 없는데 Editor에서 Play하면
특정 컴퓨터에서 Complie error 발생
- Window 7 64bit


이유를 설명할수 없지만 나의 경우는 visual studio 업데이트로 해결하였다.

아래처럼 해보면 된다.
- visual studio installer로 visual studio 업데이트
- 프로젝트 내 라이브러리 폴더 삭제
- Unity 다시 실행

2018년 12월 17일 월요일

[Unity Android] Unity 2018.3 마이그레이션 Firebase.Editor.dll error

Unity 2018.3.0f 마이그레이션 Firebase.Editor.dll error

Unity 2018.2 -> 2018.3.0으로 버전을 업. 에러 발생
Assembly 'Assets/Firebase/Editor/Firebase.Editor.dll' will not be loaded due to errors: Unable to resolve reference 'Unity.iOS.Extensions.Xcode'. Is the assembly missing or incompatible with the current platform?


- 사용중인 Firebase 버전 5.2.1

공식 홈페이지확인 결과
5.3.1에서 해당사항이 수정되었다.


Firebase 버전 업~ 패키지 설치 후
- Android Resolver






2018년 11월 1일 목요일

[Unity Android] Facebook sdk "keytool not find"

Facebook Unity Plugin "keytool not find"

Program Files에 설치 되어있는 Java jre파일 확인
"C:\Program Files\Java\jre1.8.0_19\bin"

환경변수 -> Path에 설치 되어있는 jre의 bin폴더 추가