I’ve found something interesting about the Android 9 x64 force exit upon first launch from Google Play with fresh install (which means many users are affected):
- The game is Install Location doesn’t seem to help (tried all)
However, it seems like it’s due to the new feature from Android 8 that backs up user data in Google Drive, even after uninstall.
By adding both the android:allowBackup="false" tools:replace="android:allowBackup
AND the following steps prevents the user data backup, fixing the crash at start I mentioned:
-
Create the file:
Plugins/Android/res/xml/backup_rules.xml
-
With the content:
backup_rules.xml
<?xml version="1.0" encoding="utf-8"?>
<full-backup-content>
<include domain="sharedpref" path="."/>
</full-backup-content>
- Add to your AndroidManifest.xml file:
android:fullBackupContent="@xml/backup_rules"
inside the <application >
tag
Here’s the example of my manifest after this change with highlighted addition inside the brackets [ADD THIS] [/ADD THIS]:
Example AndroidManifest.xml file
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
package="com.company.game"
android:versionName="1.0"
android:versionCode="1"
android:allowBackup="false" tools:replace="android:allowBackup">
<application
android:icon="@drawable/app_icon"
android:label="@string/app_name"
android:hardwareAccelerated="true"
android:isGame="true"
[ADD THIS]android:fullBackupContent="@xml/backup_rules"[/ADD THIS]>
<activity android:name="com.unity3d.player.UnityPlayerActivity"
android:label="@string/app_name"
android:clearTaskOnLaunch="false"
android:screenOrientation="sensorLandscape"
android:configChanges="fontScale|keyboard|keyboardHidden|locale|mnc|mcc|navigation|orientation|screenLayout|screenSize|smallestScreenSize|uiMode|touchscreen">
<meta-data android:name="android.app.lib_name" android:value="unity" />
<meta-data android:name="unityplayer.ForwardNativeEventsToDalvik" android:value="true" />
<meta-data android:name="unityplayer.SkipPermissionsDialog" android:value="true" /> <!-- Important! Without this all the permissions are asked at app startup on Android 6.0 devices. -->
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
<category android:name="android.intent.category.LEANBACK_LAUNCHER" />
</intent-filter>
</activity>
</application>
<uses-sdk android:minSdkVersion="16" android:targetSdkVersion="28" />
<uses-permission android:name="android.permission.WAKE_LOCK" />
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
<uses-permission android:name="android.permission.CAMERA" />
<uses-feature android:name="android.hardware.touchscreen" android:required="false" />
<uses-feature android:name="android.hardware.camera" android:required="false" />
<uses-feature android:name="android.hardware.gamepad" android:required="false"/>
<uses-feature android:name="android.software.leanback" android:required="false"/>
</manifest>
Thanks to ** @TextusGames ** for this idea of fix that I found on this page: Unity 2019.x IL2CPP crash on Android 8 page-2
It seems to fix it for me right now, but I’ll come back to you tomorrow when the production build is fully live so I can test in final conditions as this crash only happens from Production build from Google Play.
I’m now going to check if I can reproduce the other crash I mentioned. Will come back soon!