OS 안드로이드 12 에서 설치가 안되고, 설치가 된다해도 실행이 되지않는 오류를 발견하였다.
Gradle 버전 관련 이슈로 Unity 버전업을했다.
2019.3.9f ->. 2020.3.25f1 (LTS)
Project Setting-> Player-> Publishing Settings ->Build
1. mainTemplate.gradle
아래코드를
constraints {
implementation('androidx.work:work-runtime:2.7.0') {
because '''androidx.work:work-runtime:2.1.0 pulled from
play-services-ads has a bug using PendingIntent without
FLAG_IMMUTABLE or FLAG_MUTABLE and will fail in Apps
targeting S+.'''
}
dependencies 하단에 추가해준다.
apply plugin: 'com.android.library'
**APPLY_PLUGINS**
dependencies {
implementation fileTree(dir: 'libs', include: ['*.jar'])
// Android Resolver Dependencies Start
..
..
// Android Resolver Dependencies End
// 이곳에 추가해야됨
constraints {
implementation('androidx.work:work-runtime:2.7.0') {
because '''androidx.work:work-runtime:2.1.0 pulled from
play-services-ads has a bug using PendingIntent without
FLAG_IMMUTABLE or FLAG_MUTABLE and will fail in Apps
targeting S+.'''
}
}
}
2. Custom MainManifeest.xml
Activity 속성에 아래코드를 추가해준다.
android:exported="true"
Activity 맨마지막 에 추가해주면된다.
<activity ..
android:exported="true">
<intent-filter>
...
</intent-filter>
...
</activity>
3. LauncherTemplate.gradle , mainTemplate.gradle
2파일을 만들어 빌드툴 버전을 30.0.3 으로 변경해준다.
buildToolsVersion '30.0.3'
3-1 launcherTemplate.gradle
android {
compileSdkVersion **APIVERSION**
buildToolsVersion '30.0.3'
//buildToolsVersion '**BUILDTOOLS**'
...
}
3-2 mainTemplate.gradle
android {
compileSdkVersion **APIVERSION**
buildToolsVersion '30.0.3'
//buildToolsVersion '**BUILDTOOLS**'
...
}
2곳을 수정해준다.
4. baseProjectTemplate.gradle
dependencies {
classpath 'com.android.tools.build:gradle:4.0.1'
**BUILD_SCRIPT_DEPS**
}
gradle 버전을 4.0.1 로 변경해준다.
이렇게하고 빌드를 진행하면 정상적으로 된다.
하지만. Error 가 나는 경우도 있다.
Minimum supported Gradle version is 6.1.1. Current version is 5.1.1. If using the gradle wrapper...
이런 에러문구가 발생하는데 gradle 버전이 낮아 업그레이드 하라고하는데 해결하려고해도.. 안되서
Unity2020.3.25f1 (LTS)로 업그레이드 하면 에러가 발생하지 않으므로 에디터 업그레이드가 가능하다면 하는걸 추천한다
(머리가 아픔)
-Reference
https://forum.unity.com/threads/android-12-android-app-crash.1168823/
[Android 12] Android App Crash
Hi, I'm not able to run an exported Unity game apk on Android 12, as I get the following crash : 2021-09-11 19:40:55.335 1252-1302/?...
forum.unity.com
https://developers.google.com/ar/develop/unity-arf/android-12-build
Unity로 Android 12용 빌드 | ARCore | Google Developers
Google은 흑인 커뮤니티의 인종 평등을 증진하기 위해 최선을 다하고 있습니다. 방법을 참조하십시오. 이 페이지는 Cloud Translation API를 통해 번역되었습니다. Switch to English 의견 보내기 Unity로 Androi
developers.google.com
그리고 R8 난독화 이슈를 해결하기위해 Progard 를 사용해야하므로
progard파일을 만들고 아래릍 붙여넣기해준다.
progard.txt
-keep class com.google.android.gms.games.leaderboard.** { *; }
-keep class com.google.android.gms.games.snapshot.** { *; }
-keep class com.google.android.gms.games.achievement.** { *; }
-keep class com.google.android.gms.games.event.** { *; }
-keep class com.google.android.gms.games.stats.** { *; }
-keep class com.google.android.gms.games.video.** { *; }
-keep class com.google.android.gms.games.* { *; }
-keep class com.google.android.gms.common.api.ResultCallback { *; }
-keep class com.google.android.gms.signin.** { *; }
-keep class com.google.android.gms.dynamic.** { *; }
-keep class com.google.android.gms.dynamite.** { *; }
-keep class com.google.android.gms.tasks.** { *; }
-keep class com.google.android.gms.security.** { *; }
-keep class com.google.android.gms.base.** { *; }
-keep class com.google.android.gms.actions.** { *; }
-keep class com.google.games.bridge.** { *; }
-keep class com.google.android.gms.common.ConnectionResult { *; }
-keep class com.google.android.gms.common.GooglePlayServicesUtil { *; }
-keep class com.google.android.gms.common.api.** { *; }
-keep class com.google.android.gms.common.data.DataBufferUtils { *; }
-keep class com.google.android.gms.games.quest.** { *; }
-keep class com.google.android.gms.nearby.** { *; }
launcherTemplate.gradle
buildTypes {
debug{
minifyEnabled **MINIFY_DEBUG**
proguardFiles getDefaultProguardFile('proguard-android.txt')**SIGNCONFIG**
jniDebuggable true
}
release{
minifyEnabled true
shrinkResources true
//minifyEnabled **MINIFY_RELEASE**
proguardFiles getDefaultProguardFile('proguard-android.txt')**SIGNCONFIG**
}
..
}
아래 블로그를 참고했습니다.
https://seansation-blog.tistory.com/12
R8 난독화 적용하기 & apk 디컴파일 확인하기
안녕하세요 개발새발 블로그입니다. 오늘은 R8 난독화 적용 및 예외처리 방법. 이후 apk 파일을 디컴파일하여 난독화가 잘 적용됬는지 확인해보겠습니다. 난독화를 하였을때 장점 코드 축소(또는
seansation-blog.tistory.com
step1 c# 기초 - 변수 와 자료형 (0) | 2022.02.12 |
---|---|
step0 - github + sourceTree SSH personal Token 사용방법 (0) | 2022.02.12 |
step0 -유니티 21.1.25f 설치 방법 (0) | 2022.02.09 |
Unity Admob How to Get Test Device /유니티 애드몹 테스트 디바이스 정보 얻기 (0) | 2022.01.21 |
Firebase Analytics Debug view Enable code (0) | 2022.01.18 |
Unity 인텐트 필터를 포함하되 'android:exported' 속성을 설정하지 않고 활동, 활동 별칭, 서비스 또는 broadcast receiver가 있는 apk 또는 android app bundle을 업로드했습니다. (4) | 2022.01.14 |