[HELP] Unity 5.5 Android build crashes at startup
Hello, I have a built an apk game for Android. I am using Unity 5.5 and my minimum API level is set to (Android 2.3.1 'Gingerbread') (API level 9). Anyway when I copy the apk app to my mobile (HUAWEI GRA-UL00) and open it, it loads for a couple of seconds then immediately crashes.
Some details of the phone:
EMUI version: EMUI 3.1
Android version: 5.0.1
Kernel version: 3.10.61-geb4b1e7 android@localhost #2 Wed Dec 9 03:59:12 CST 2015
Baseband version: 21.293.25.00.000,21.239.25.00.000
Intended Scenario:
I want the game to run on my phone without any problems that cause it to crashes immediately at startup.
Methods Implemented:
- I checked the (Protect Graphics Memory) in the Player Settings as I found it from external sources it solved the problem for some others, however the problem still persists after I implemented this method.
- I tried changing maybe couple of lines in the Android Manifests file but it did not help.
This is a log from the adb I opened while trying to open the app on my phone:
I/ActivityManager( 3361): Displayed com.Blue_Factory_Games.Run_Kid/com.unity3d.player.UnityPlayerActivity: +293ms
E/Unity (13096): Unable to find AudioPluginMsHRTF
E/Unity (13096): Unable to find AudioPluginOculusSpatializer
I/Unity (13096): Building GPG services, implicitly attempts silent auth
I/Unity (13096):
I/Unity (13096): (Filename: ./artifacts/generated/common/runtime/DebugBindings.gen.cpp Line: 51)
I/Unity (13096):
I/ActivityManager( 3361): filter receiver for action = android.net.wifi.SCAN_RESULTS
I/Unity (13096): [Play Games Plugin DLL] 01/13/17 17:33:20 +03:00 DEBUG: Activating PlayGamesPlatform.
I/Unity (13096):
I/Unity (13096): (Filename: ./artifacts/generated/common/runtime/DebugBindings.gen.cpp Line: 51)
I/Unity (13096):
I/Unity (13096): [Play Games Plugin DLL] 01/13/17 17:33:20 +03:00 DEBUG: Instance was not initialized, using default configuration.
I/Unity (13096):
I/Unity (13096): (Filename: ./artifacts/generated/common/runtime/DebugBindings.gen.cpp Line: 51)
I/Unity (13096):
I/Unity (13096): [Play Games Plugin DLL] 01/13/17 17:33:20 +03:00 DEBUG: PlayGamesPlatform activated: GooglePlayGames.PlayGamesPlatform
I/Unity (13096):
I/Unity (13096): (Filename: ./artifacts/generated/common/runtime/DebugBindings.gen.cpp Line: 51)
I/Unity (13096):
I/Unity (13096): [Play Games Plugin DLL] 01/13/17 17:33:20 +03:00 DEBUG: Creating platform-specific Play Games client.
I/Unity (13096):
I/Unity (13096): (Filename: ./artifacts/generated/common/runtime/DebugBindings.gen.cpp Line: 51)
I/Unity (13096):
I/Unity (13096): [Play Games Plugin DLL] 01/13/17 17:33:20 +03:00 DEBUG: Creating Android IPlayGamesClient Client
I/Unity (13096):
I/Unity (13096): (Filename: ./artifacts/generated/common/runtime/DebugBindings.gen.cpp Line: 51)
I/Unity (13096):
I/ActivityManager( 3361): filter receiver for action = android.intent.action.DROPBOX_ENTRY_ADDED
I/ActivityManager( 3361): filter receiver for action = com.huawei.android.action.AUTO_UPDATE_MYLOCATION
I/ActivityManager( 3361): filter receiver for action = com.huawei.android.action.AUTO_UPDATE_MYLOCATION
I/ActivityManager( 3361): filter receiver for action = android.net.wifi.SCAN_RESULTS
This is a copy from the Android Manifest file:
<?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.Blue_Factory_Games.Run_Kid"
android:versionName="1.0"
android:versionCode="1">
<uses-sdk android:minSdkVersion="9"
android:targetSdkVersion="19" />
<!-- Google Mobile Ads Permissions -->
<uses-permission android:name="android.permission.INTERNET"/>
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE"/>
<!-- Uncomment to add billing for in-app purchase ads -->
<!--<uses-permission android:name="com.android.vending.BILLING"/> -->
<application>
<!-- Denote the referenced Google Play services version -->
<meta-data android:name="com.google.android.gms.version"
android:value="@integer/google_play_services_version" />
<!-- Google Mobile Ads Activity -->
<activity android:name="com.google.android.gms.ads.AdActivity"
android:configChanges="keyboard|keyboardHidden|orientation|screenLayout|uiMode|screenSize|smallestScreenSize"
android:theme="@android:style/Theme.Translucent" />
<!-- InAppPurchase Activity -->
<activity android:name="com.google.android.gms.ads.purchase.InAppPurchaseActivity"
android:theme="@style/Theme.IAPTheme"/>
<activity android:name="com.unity3d.player.UnityPlayerNativeActivity"
android:label="@string/app_name">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<!-- <category android:name="android.intent.category.LAUNCHER" /> -->
</intent-filter>
<meta-data android:name="unityplayer.UnityActivity" android:value="true" />
<meta-data android:name="unityplayer.ForwardNativeEventsToDalvik"
android:value="true" />
</activity>
</application>
</manifest>
I would really appreciate the help finding a solution as it has become really frustrating for a couple of day now.
Answer by jackblue2009 · Jan 15, 2017 at 10:47 AM
After a long couple days of headaches and frustration and testing, the problem turned out to be in the "MenuScript.cs" that is attached to the (MenuManager) in my start scene. When I disabled the script component in the game object, and ran the game again on my phone, it didn't crash.
Also I would like to point out that it crashed in the end screen (which is the game over scene) probably because I have a similar script to the "MenuScript.cs" there.
In conclusion, this was the problem for me as to why it was crashing on mobile.
you should have pointed out what you were doing in that script.. :/