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

2019년 8월 26일 월요일

[Android] Android Device Monitor 실행 시 에러

Android Device Monitor 실행 시 에러 팝업창과 함께 로그파일 경로가 나왔다

이유는 알수 없지만 검색결과 아래 3가지 방법이 나왔다.

  1. Android Studio를 "관리자 권한으로 실행"
  2. "monitor.exe"를 "관리자 권한으로 실행"
  3. 작업 관리자에서 "monitor.exe"를 "작업 끝내기"

나의 해결책은 3번 "monitor.exe'을 "작업 끝내기"하고 '재실행" 하니 해결되었다.




[Unity Editor] Copying assembly from 'Temp/Assembly-CSharp.dll' to 'Library/ScriptAssemblies/Assembly-CSharp.dll' failed

에디터 실행중 SDK를 Import하거나 Git(svn)를 Pull 할때 아래와 같은 에러가 종종 발생한다.

Copying assembly from 'Temp/Assembly-CSharp.dll' to 'Library/ScriptAssemblies/Assembly-CSharp.dll' failed

해결 방법은
1. 가장 쉬운 에디터를 재실행.
2. Project 뷰에서 마우스 우 클릭 후 "Reimport"를 선택해주면 된다.


2019년 8월 5일 월요일

[Unity Tip] MonoBehaviour 스크립트 마법사를 사용한 Unity 메서드 구현

[Unity Tip] MonoBehaviour 스크립트 마법사를 사용한 Unity 메서드 구현

Visual Studio 에서 메서드를 추가할 위치에 커서놓고
단축키 Ctrl + Shift + M 를 사용하면 Create Script Methods에서 원하는 메서드를 검색해서 주석까지 추가할수 있다 (메서드 주석생성 체크)



상세 주석 설명

2019년 7월 25일 목요일

[Unity Android] Android 구글 클라우드 자동 저장 기능 끄기

[Unity Android] Android 구글 클라우드 자동 저장 기능 끄기

앱을 삭제 후 재설치 시 삭제 전에 Data가 남아있는 문제가 있다.
원인은 Android 6.0 (Api Level 23)부터 생긴 자동 저장 기능 때문이다.


AndroidManifest에 android:allowBackup, android:fullBackupContent 속성을 적어주지 않으면 디폴트로 true 설정이 들어가 구글 클라우드에 자동으로 저장되어 앱 삭제 후 재설치 시에 자료가 자동으로 복원된다.
  • android:allowBackup 속성값은 ADB(Android Debug Bridge)를 통해서 앱 백업과 복구를 사용 가능하는 설정
  • android:fullBackupContent 속성값은 Android 6.0 (Api Level 23)부터 구글 클라우드를 이용해 앱의 User Data를 자동 백업하도록 한다

자동 저장을 막기 위해서는 AndroidManifest파일을 아래처럼 설정한다.
 android:allowBackup = "false",  android:fullBackupContent = "false"


다른 플러그인에서 allowBackup 속성을 사용해 충돌이 생길 경우 tools:replace 사용

tools:replace="android:allowBackup"


Plugins/Android/AndroidManifest.xml
<application...
android:allowBackup="false" android:fullBackupContent="false" tools:replace="android:allowBackup"

[Unity Android Tip] Android Studio로 사용하여 Unity 에러 로그 자세히 보기

[Unity Android Tip]  Android Studio로 사용하여 Unity 에러 로그 자세히 보기

Unity Android Build시 여러 에러가 발생하지만 정확한 원인을 찾을수 없을 때가 있다.
이때는 Android Studio로 프로젝트 열면 자세한 정보를 얻을수 있다.

1. Export후 Android Studio로 프로젝트를 열기
2. Android 빌드 후 Temp 폴더 Android Studio로 열기


1. Export후 Android Studio로 프로젝트를 열기
Android Studio 실행 후 Export한 폴더 프로젝트 열기
 Build Settings -> Export Project 체크

Export 후 Android Studio에서 해당 프로젝트를 열어서 빌드하면 자세한 로그가 나온다.


2. Android 빌드 후 Temp 폴더 Android Studio로 열기
Android Studio 실행 후 Temp/gradleOut 폴더 프로젝트 열기

2019년 7월 23일 화요일

[Unity Android] java.lang.RuntimeException: Unable to instantiate application android.support.multidex.MultiDexApplication

[Unity Android] java.lang.RuntimeException: Unable to instantiate application android.support.multidex.MultiDexApplication: java.lang.ClassNotFoundException: Didn't find class "android.support.multidex.MultiDexApplication"

1. Android Resolver 1.2.122
2. MultiDex 사용

Android Resolver 1.2.122로 버전을 올리니 mainTemplate.gradle파일에 UseAndroidX가 true로 되어있어서 기존에 사용하던 android.support를 사용할 수 없게 되었다.
AndroidX : 기존 Android 지원 라이브러리를 개선하여 만들었다고 한다.

Plugins/Android/mainTemplate.gradle
// Android Resolver Repos Start
([rootProject] + (rootProject.subprojects as List)).each {
    ext {
        it.setProperty("android.useAndroidX", true)
        it.setProperty("android.enableJetifier", true)
    }
}

AndroidManifest파일에 android.support를 androidx로 바꾸어주면된다.

Plugins/Android/AndroidManifest.xml
<application ....
android:name="android.support.multidex.MultiDexApplication"
->
android:name="androidx.multidex.MultiDexApplication"

참고
https://forum.unity.com/threads/gradle-3-2-0-crashes-app-on-launch.712970/

에러전문

2019년 7월 15일 월요일

[Unity Android] AWS SDK not Work / Unity 2019.+ Error

[Unity Android] AWS SDK Unity 2019.+ Error

AWS SDK를 Unity 2019에서 사용시 아래 에러 발생

- Unity : 2019 +
- SDK : aws-sdk-unity_3.3.542.0

Error Unity Unable to find /usr/lib/libobjc.dylib
Error Unity ArgumentException: Object of type 'System.Object[]' cannot be converted to type 'UnityEngine.AndroidJavaObject[]'.
Error Unity at System.RuntimeType.CheckValue (System.Object value, System.Reflection.Binder binder, System.Globalization.CultureInfo culture, System.Reflection.BindingFlags invokeAttr) [0x00071] in <a6266edc72ee4a578659208aefcdd5e1>:0
Error Unity at System.Reflection.MonoMethod.ConvertValues (System.Reflection.Binder binder, System.Object[] args, System.Reflection.ParameterInfo[] pinfo, System.Globalization.CultureInfo culture, System.Reflection.BindingFlags invokeAttr) [0x00069] in <a6266edc72ee4a578659208aefcdd5e1>:0
Error Unity at System.Reflection.MonoMethod.Invoke (System.Object obj, System.Reflection.BindingFlags invokeAttr, System.Reflection.Binder binder, System.Object[] parameters, System.Globalization.CultureInfo culture) [0x00011] in <a6266edc72ee4a578659208aefcdd5e1>:0
Error Unity at System.Reflection.MethodBase.Invoke (System.Object obj, System.Object[] parameters) [0x00000] in <a6266edc72ee4a578659208aefcdd5e1>:0



버전이 올라가면서 LINQ query가 바뀌어서 그런듯한다.
아래 링크의 AWSSDK.Core.dll 파일을 다운로드해서 내프로젝트에 붙여넣기 한다.
Download

2019년 7월 11일 목요일

[Unity Android] Unity 2019.1.9 base Custom Gradle Tamplate

[Unity Android] Unity 2019.1.+ base Custom Gradle Tamplate

Unity 2019.1.+에서 사용하는 기본 Custom Gradle Tamplate
Unity 버전이 올라갈때마다 바뀌어서 저장용으로 올려놓는다.

// GENERATED BY UNITY. REMOVE THIS COMMENT TO PREVENT OVERWRITING WHEN EXPORTING AGAIN
buildscript {
    repositories {
        google()
        jcenter()
    }


    dependencies {
        classpath 'com.android.tools.build:gradle:3.4.0'
**BUILD_SCRIPT_DEPS**}
}

allprojects {
    repositories {
        google()
        jcenter()
        flatDir {
            dirs 'libs'
        }
    }
}

apply plugin: 'com.android.application'
**APPLY_PLUGINS**

dependencies {
    implementation fileTree(dir: 'libs', include: ['*.jar'])
**DEPS**}


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


    compileOptions {
        sourceCompatibility JavaVersion.VERSION_1_8
        targetCompatibility JavaVersion.VERSION_1_8
    }


    defaultConfig {
        minSdkVersion **MINSDKVERSION**
        targetSdkVersion **TARGETSDKVERSION**
        applicationId '**APPLICATIONID**'
        ndk {
            abiFilters **ABIFILTERS**
        }
        versionCode **VERSIONCODE**
        versionName '**VERSIONNAME**'
    }


    lintOptions {
        abortOnError false
    }


    aaptOptions {
        noCompress = ['.unity3d', '.ress', '.resource', '.obb'**STREAMING_ASSETS**]
        ignoreAssetsPattern = "!.svn:!.git:!.ds_store:!*.scc:.*:!CVS:!thumbs.db:!picasa.ini:!*~"
    }**SIGN**


    buildTypes {
        debug {
            minifyEnabled **MINIFY_DEBUG**
            useProguard **PROGUARD_DEBUG**
            proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-unity.txt'**USER_PROGUARD****SIGNCONFIG**
            jniDebuggable true
        }
        release {
            minifyEnabled **MINIFY_RELEASE**
            useProguard **PROGUARD_RELEASE**
            proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-unity.txt'**USER_PROGUARD****SIGNCONFIG**
        }
    }**PACKAGING_OPTIONS****SPLITS**
**BUILT_APK_LOCATION**
**EXTERNAL_SOURCES**
    bundle {
        language {
            enableSplit = false
        }
        density {
            enableSplit = false
        }
        abi {
            enableSplit = true
        }
    }
}**SPLITS_VERSION_CODE****REPOSITORIES****SOURCE_BUILD_SETUP**


[Unity Facebook Plugin] Facebook.Unity.Android.dll, Facebook.Unity.IOS.dll Delete the one of the duplicate plugins.

[Unity Plugin] Facebook.Unity.Android.dll, Facebook.Unity.IOS.dll Delete the one of the duplicate plugins.

Unity Facebook SDK를 7.17.+로 올렸더니 아래 에러 발생
Found plugins with same names, Assets/FacebookSDK/Plugins/Android/Facebook.Unity.IOS.dll and Assets/FacebookSDK/Plugins/iOS/Facebook.Unity.IOS.dll. Delete the one of the duplicate plugins.
UnityEditor.AndroidPluginImporterExtension:CheckFileCollisions(String)
UnityEditorInternal.PluginsHelper:CheckFileCollisions(BuildTarget) (at C:/buildslave/unity/build/Editor/Mono/Plugins/PluginsHelper.cs:25)
UnityEditor.BuildPipeline:BuildPlayer(String[], String, BuildTarget, BuildOptions)


Found plugins with same names, Assets/FacebookSDK/Plugins/iOS/Facebook.Unity.Android.dll and Assets/FacebookSDK/Plugins/Android/Facebook.Unity.Android.dll. Delete the one of the duplicate plugins.
UnityEditor.AndroidPluginImporterExtension:CheckFileCollisions(String)
UnityEditorInternal.PluginsHelper:CheckFileCollisions(BuildTarget) (at C:/buildslave/unity/build/Editor/Mono/Plugins/PluginsHelper.cs:25)
UnityEditor.BuildPipeline:BuildPlayer(String[], String, BuildTarget, BuildOptions)

프로젝트 검색 결과 같은 이름의 DLL파일이 있다.
Plugin을 해당 Platform에 맞게 설정한다.
FacebookSDK/Plugins/Android 폴더
Facebook.Unity.Android
Facebook.Unity.IOS


FacebookSDK/Plugins/Ios 폴더
Facebook.Unity.Android
Facebook.Unity.IOS


공식 git
v7.17.0 dll platforms setting error
https://github.com/facebook/facebook-sdk-for-unity/issues/266

2019년 5월 28일 화요일

[Android]Unity Android Resolver (1.2.111) mainTemplate.gradle설정

Unity Android 64bit 이슈로 
Android Resolver 버전(1.2.111)이 올라가면서 mainTemplate.gradle 파일의 설정이 변경되어서 정리 해 보았다

Unity 2018.3
Android Resolver(1.2.111)
 - firebase_unity_sdk_6.0.0
 - facebook-unity-sdk-7.15.1
 - GooglePlayGamesPlugin-0.9.64

 - GoogleMobileAds-v3.17.0

mainTemplate.gradle
// GENERATED BY UNITY. REMOVE THIS COMMENT TO PREVENT OVERWRITING WHEN EXPORTING AGAIN
buildscript {
    repositories {
        google()
        jcenter()
    }


    dependencies {
            classpath 'com.android.tools.build:gradle:3.2.0'
**BUILD_SCRIPT_DEPS**}
}


allprojects {
    repositories {
        google()
        jcenter()
        flatDir {
            dirs 'libs'
        }


        maven {
            url 'https://google.bintray.com/exoplayer/'
        }
    }
}


// Android Resolver 자동 생성 (1.2.111)
// Android Resolver Repos Start
allprojects {
    repositories {
        maven {
            url "https://maven.google.com"
        }
        maven {
            url "file:///C:/WORKSPACE/Assets/Firebase/m2repository" // Assets/Firebase/Editor/AppDependencies.xml:20, Assets/Firebase/Editor/MessagingDependencies.xml:22
        }
        maven {
            url "https://jcenter.bintray.com/" // Assets/GoogleMobileAds/Editor/FacebookMediationDependencies.xml:7, Assets/GoogleMobileAds/Editor/FacebookMediationDependencies.xml:12, Assets/GoogleMobileAds/Editor/UnityMediationDependencies.xml:7, Assets/GoogleMobileAds/Editor/UnityMediationDependencies.xml:12
        }
        maven {
            url "https://maven.google.com/" // Assets/GoogleMobileAds/Editor/GoogleMobileAdsDependencies.xml:7
        }
        maven {
            url "https://jcenter.bintray.com" // Assets/GoogleMobileAds/Editor/VungleMediationDependencies.xml:7
        }
        maven {
            url "https://jitpack.io" // Assets/GoogleMobileAds/Editor/VungleMediationDependencies.xml:12
        }
        maven {
            url "file:///C:/WORKSPACE/Assets/GooglePlayGames/Editor/m2repository" // Assets/GooglePlayGames/Editor/GooglePlayGamesPluginDependencies.xml:11
        }
        mavenLocal()
        jcenter()
        mavenCentral()
    }
}
// Android Resolver Repos End

apply plugin: 'com.android.application'
**APPLY_PLUGINS**


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


    compile fileTree(dir: 'libs', include: ['*.jar'])


// Android Resolver 자동 생성 (1.2.111)
// Android Resolver Dependencies Start
    compile 'com.android.support:appcompat-v7:25.3.1' // Facebook.Unity.Editor.AndroidSupportLibraryResolver.addSupportLibraryDependency
    compile 'com.android.support:cardview-v7:25.3.1' // Facebook.Unity.Editor.AndroidSupportLibraryResolver.addSupportLibraryDependency
    compile 'com.android.support:customtabs:25.3.1' // Facebook.Unity.Editor.AndroidSupportLibraryResolver.addSupportLibraryDependency
    compile 'com.android.support:support-v4:25.3.1' // Facebook.Unity.Editor.AndroidSupportLibraryResolver.addSupportLibraryDependency
    compile 'com.applovin:applovin-sdk:8.1.4' // Assets/GoogleMobileAds/Editor/AppLovinMediationDependencies.xml:6
    compile 'com.facebook.android:audience-network-sdk:5.0.1' // Assets/GoogleMobileAds/Editor/FacebookMediationDependencies.xml:12
    compile 'com.github.vungle:vungle-android-sdk:6.3.24' // Assets/GoogleMobileAds/Editor/VungleMediationDependencies.xml:12
    compile 'com.google.ads.mediation:applovin:8.1.4.0' // Assets/GoogleMobileAds/Editor/AppLovinMediationDependencies.xml:4
    compile 'com.google.ads.mediation:facebook:5.0.1.0' // Assets/GoogleMobileAds/Editor/FacebookMediationDependencies.xml:7
    compile 'com.google.ads.mediation:unity:3.0.0.0' // Assets/GoogleMobileAds/Editor/UnityMediationDependencies.xml:7
    compile 'com.google.ads.mediation:vungle:6.3.24.0' // Assets/GoogleMobileAds/Editor/VungleMediationDependencies.xml:7
    compile 'com.google.android.gms:play-services-ads:17.2.0' // Assets/GoogleMobileAds/Editor/GoogleMobileAdsDependencies.xml:7
    compile 'com.google.auto.value:auto-value-annotations:1.6.3' // Assets/Firebase/Editor/AppDependencies.xml:22
    compile 'com.google.firebase:firebase-analytics:16.5.0' // Assets/Firebase/Editor/MessagingDependencies.xml:15
    compile 'com.google.firebase:firebase-app-unity:6.0.0' // Assets/Firebase/Editor/AppDependencies.xml:20
    compile 'com.google.firebase:firebase-common:17.0.0' // Assets/Firebase/Editor/AppDependencies.xml:13
    compile 'com.google.firebase:firebase-iid:[18.0.0]' // Assets/Firebase/Editor/MessagingDependencies.xml:13
    compile 'com.google.firebase:firebase-messaging:18.0.0' // Assets/Firebase/Editor/MessagingDependencies.xml:17
    compile 'com.google.firebase:firebase-messaging-unity:6.0.0' // Assets/Firebase/Editor/MessagingDependencies.xml:22
    compile 'com.google.games:gpgs-plugin-support:0.9.64' // Assets/GooglePlayGames/Editor/GooglePlayGamesPluginDependencies.xml:11
    compile 'com.unity3d.ads:unity-ads:3.0.0' // Assets/GoogleMobileAds/Editor/UnityMediationDependencies.xml:12
// Android Resolver Dependencies End

**DEPS**
}


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


    compileOptions {
        sourceCompatibility JavaVersion.VERSION_1_8
        targetCompatibility JavaVersion.VERSION_1_8
    }


    defaultConfig {
        minSdkVersion **MINSDKVERSION**
        targetSdkVersion **TARGETSDKVERSION**
        applicationId '**APPLICATIONID**'
        ndk {
            abiFilters **ABIFILTERS**
        }
        versionCode **VERSIONCODE**
        versionName '**VERSIONNAME**'


        multiDexEnabled true
    }


    lintOptions {
        abortOnError false
    }


    dexOptions {
        jumboMode = true
        javaMaxHeapSize "4g"
    }


    aaptOptions {
        noCompress = ['.unity3d', '.ress', '.resource', '.obb'**STREAMING_ASSETS**]
        ignoreAssetsPattern = "!.svn:!.git:!.ds_store:!*.scc:.*:!CVS:!thumbs.db:!picasa.ini:!*~"
    }**SIGN**


    buildTypes {
          debug {
            minifyEnabled **MINIFY_DEBUG**
            useProguard **PROGUARD_DEBUG**
            proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-unity.txt'**USER_PROGUARD****SIGNCONFIG**
            jniDebuggable true
        }
        release {
            minifyEnabled **MINIFY_RELEASE**
            useProguard **PROGUARD_RELEASE**
            proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-unity.txt'**USER_PROGUARD****SIGNCONFIG**
        }
    }**PACKAGING_OPTIONS****SPLITS**
**BUILT_APK_LOCATION**
**EXTERNAL_SOURCES**
    bundle {
        language {
            enableSplit = false
        }
        density {
            enableSplit = false
        }
        abi {
            enableSplit = true
        }
    }
}**SPLITS_VERSION_CODE****REPOSITORIES****SOURCE_BUILD_SETUP**