Thứ Sáu, 4 tháng 8, 2023

Fix the issue Unity android 12, 13 can not start the game

When build unity game that target android 12, 13, the game can not start. 
There are two things to fix this: 
1. In Unity Player Settings, publish settings
- Check custom main manifest + Add property android:exported="true" to activity 
- Check custom main gradle template 
+ If using admob, add this to dependencies setting: implementation 'com.google.android.gms:play-services-ads:20.4.0' // For apps targeting Android 12, add WorkManager dependency. 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+.''' } 
 + If not using admob, just add implementation('androidx.work:work-runtime:2.7.0') to dependencies setting 
- check Custom gradle properties template Add those settings: android.useAndroidX=true android.enableJetifier=true android.enableR8=true
2. In Other settings
+ Uncheck Auto Graphic API, then move OpenGLES3 to the top of the list

Không có nhận xét nào:

Đăng nhận xét