Search Unity

Android 4.x build with Unity 5.x not working

Discussion in 'Android' started by Izzzo, Jun 17, 2015.

  1. Izzzo

    Izzzo

    Joined:
    Jun 12, 2015
    Posts:
    5
    Hi all,

    I've posted this on Unity Answer, but I didn't get any responses there, so I'm trying now in the forum, therefore please excuse the duplicate. I'm having a strange issue here: I was compiling my project without any problems on Unity 4.x (incl. latest 4.6) with Android API 15 and it was running perfectly fine on a Android 4.0.4 phone and emulators. But after I upgraded to Unity 5.0.1 I couldn't even build any more. The compiler error was the following: "AndroidManifest.xml:4: error: No resource identifier found for attribute 'isGame' in package 'android'". And it was stating the same for the "isBanner" attribute.

    I know that there is already an answer on this in http://answers.unity3d.com/questions/914949/unity-5-androidmanifestxml4-error-no-resource-iden.html

    But unfortunately this does not solve my issue, because after following the solution there and installing Android API 21 I can build my project again without any compiler errors, but it is not running anymore neither on my Android 4.0.3 device nor on the 4.0.3 Android emulator. The game is terminating right after the startup on both.

    It seems that Unity 5.x is creating a different AndroidManifest.xml, which now has two new elements: "android:isGame" and "android:banner". From what I got, these parameter were introduced with Android 5.x, which would explain, why an older API version (e.g. 15) has issues with them and API 21 compiles just fine. It seems that Unity 5.x is creating the AndroidManifest.xml always with this new parameters independent from the target API version set in the project's player settings! I guess that's why other people suggest, that one should get API 21 and it will work.

    I'm assuming that this parameters in the AndroidManifest.xml are not backwards-compatible, which means that an app compiled with API 21 and these parameter does not work on Android 4.x, or Android <5.x in general! And it seems that this is the case, but I couldn't prove that up to now.

    This is what I've already tried:

    • "adb logcat" didn't show up anything really suspisious to me (or I just didn't see it)

    • I've already upgraded Unity from 5.0.1 to 5.0.2, but it didn't solve this

    • I tried to modify the AndroidManifest.xml by placing my own one (based on the generated one) without "isGame" and "banner" in "Assets/Plugins/Android" as supposed, but this does not work, since the generated AndroidManifest.xml is not replaced with mine, but instead mine is merged into the generated one. I also tried then to add comment characters in mine and hoping that they would be merged into the generated one and thus commenting out the parameters in the generated one, but this does also not work. The generated "application" node stays as it is and my `` is attached at the end.

    • I've also tried to modify the AndroidManifest.xml in the APK file build with API 21 and remove the parameters there as post-processing, but I didn't manage to re-package the APK up to now, since it is failing on the installing process. But honestly this is just a fancy workaround and would just prove the backwards-incompatibility of "isGame" and "banner" and I don't want to constantly post-process my APKs.
    I haven't updated to Unity 5.1, but honestly I don't have much hope that this would solve anything.

    Some questions now:

    • Is anyone else having this issue?

    • Or am I the only one still targetting an older Android version with latest Unity??? Since I haven't found any other posts on this ..

    • How is this supposed to work from Unity side?

    • Why is Unity 5.x always generating an AndroidManifest.xml based on latest Android and thus making it backwards-incompatible?

    • Am I missing something?
    Thanks in advance. Any help is much appreciated.
     
  2. liortal

    liortal

    Joined:
    Oct 17, 2012
    Posts:
    3,562
    We are using Unity 5.0.3p1 for our game, and we are NOT only targeting Android 5.x devices.

    Just as a test, i selected API level 9 in the build settings:
    upload_2015-6-18_1-0-57.png

    This generates the following AndroidManifest.xml:
    upload_2015-6-18_1-1-36.png

    As you can see, there are actually 2 values being used:

    minSdkVersion:
    targetSdkVersion:
    (Source: http://developer.android.com/guide/topics/manifest/uses-sdk-element.html)

    As you can see, the API level selected in Unity affects the minimal SDK version that the game will support.

    As for why the game fails to run - it's hard to determine. Our game runs fine on pre - 5.x devices.
    Perhaps you could capture a logcat log (adb logcat -v time) for the whole test case (launching the game).

    Note that starting Unity 5, devices that do not support ARM NEON are no longer supported, what devices are you trying to test you game on ?
     
  3. MrEsquire

    MrEsquire

    Joined:
    Nov 5, 2013
    Posts:
    2,712
    Update your Android SDK on local machine?
     
  4. Izzzo

    Izzzo

    Joined:
    Jun 12, 2015
    Posts:
    5
    Thanks guys for your feedback and please excuse my very late response.

    @MsEsquire: This was also one of my first approaches and I've installed and reinstalled several SDKs several times and it does not solve the issue.

    @liortal: It is interesting to know that you are able to run games on pre-Android 5.x devices build with Unity 5.x. This means that there is definitely some issue on my device and probably on my emulator. Thanks for your description on the AndroidManifest.xml settings. I'm aware of these and I've tested with lots of values. Since I only have a LG P920 device with Android 4.0.4 it was the only device that I was testing on. But as I already stated I also tested on a Android 4.0.4 emulator just to make sure that it is independent from my device. Thanks for the info that Unity 5 does not support ARM NEONs anymore. I didn't know that, but my device isn't a ARM NEON. So this should be no issue. I've discovered one interesting fact when I managed to get a different device with Android 4.1.1 for a quick test. I installed my game and it worked just fine. So in the end this is definitly an issue of my LG device, which isn't actually a big deal for me, but I'm curious why it is also not working an the Android 4.0.4 emulator. It might be that there is a different issue, but I didn't had time to analyze this any further. Unfortunately I didn't have much time yet to analyze this whole issue in detail, but from the logcat output I can see the following call stack, when crashing:

    I/DEBUG ( 7857): #00 pc 00000000

    I/DEBUG ( 7857): #01 pc 004b3b88 /data/data/com.xyz.TestGame/lib/libunity.so (_ZN13GfxDeviceGLES8EndFrameEv)

    I/DEBUG ( 7857): #02 pc 002c6904 /data/data/com.xyz.TestGame/lib/libunity.so (_ZN12SplashScreen6RenderEi)

    I/DEBUG ( 7857): #03 pc 002c6688 /data/data/com.xyz.TestGame/lib/libunity.so (_ZN12SplashScreen6RenderEPKhjNS_9ScaleModeEi)

    I/DEBUG ( 7857): #04 pc 004f0130 /data/data/com.xyz.TestGame/lib/libunity.so (_Z15UnityPlayerLoopv)

    I/DEBUG ( 7857): #05 pc 004f51d0 /data/data/com.xyz.TestGame/lib/libunity.so (_Z12nativeRenderP7_JNIEnvP8_jobject)

    I/DEBUG ( 7857): #06 pc 0001edf0 /system/lib/libdvm.so (dvmPlatformInvoke)

    This is happening, when the splash screen is to be rendered. So it seems that this is some OpenGL issue on my phone. Maybe Unity 5 is using now some OpenGL call that my phone does not implement ..
     
  5. liortal

    liortal

    Joined:
    Oct 17, 2012
    Posts:
    3,562
    Actually, what i meant is that devices WITHOUT ARM NEON are no longer supported. If your device doesn't have it, the game won't be able to run, in case you built it with Unity 5 or higher.
     
  6. Izzzo

    Izzzo

    Joined:
    Jun 12, 2015
    Posts:
    5
    @liortal: Yes, you are right. Sorry for the misunderstanding in the first place.

    I just checked the hardware spec of my LG P920 and eventually it should support NEON. I could also verify this with a hardware info app and in fact it does support NEON. So this shouldn't be the root cause of this issue. (Nevertheless I'm quite shocked that Unity decided to quite the non-neon support, since lots of people (according to the forum here) are having issue with this, but this is now off-topic..)
     
  7. liortal

    liortal

    Joined:
    Oct 17, 2012
    Posts:
    3,562
    They took this decision to drop support for older devices with a major release (5.0). Tough call, since you're blocking support for many devices that used to work before, but still, these are pretty old devices..

    Anyways we completely missed out on that one when upgrading, so we had to find out it is not supported the hard way (crash reports from users).