Search Unity

Unable to find main - arm64?

Discussion in 'Android' started by detournment_19, Jul 10, 2017.

  1. detournment_19

    detournment_19

    Joined:
    Jan 20, 2015
    Posts:
    22
    I've got a build that includes a library jar I built around UnityPlayerActivity. There are several other dependencies as well - a 3rd party SDK for biosensor data, AppCompat, Ok http and okio. The built app works fine on an Insignia Table running Android 5 and on a Samsung Tab S2 running Android 6.01 (this is a 64 bit processor but a 32 bit kernel). It fails on a Samsung Galaxy s7 (64 bit all-around), showing the dialog "Failure to initialize! Your hardware does not support this application, sorry!" I've also built a separate Android Studio app using the 3rd party's supplied non-Unity demo project which includes all those dependencies except my library, and it runs fine on the s7.

    Here's the Unity tagged portion from logCat:

    07-10 14:57:39.932: E/Unity(7788): Unable to find main
    07-10 14:57:39.932: I/Unity(7788): splash_mode = 0 (integer)
    07-10 14:57:39.932: I/Unity(7788): useObb = False (bool)
    07-10 14:57:39.932: I/Unity(7788): showSplash = True (bool)
    07-10 14:57:39.992: I/Unity(7788): onResume
    07-10 14:57:42.672: I/Unity(7788): onPause
    07-10 14:57:43.422: I/Unity(7788): onPause
    07-10 14:57:43.422: W/Unity(7788): Not running Google VR from an Activity; Ignoring execution request...


    I tried specifying build architectures in the build.gradle in my plugin projects like this:

    productFlavors {
    x86 {
    ndk {
    abiFilter "x86"
    }
    }
    mips {
    ndk {
    abiFilter "mips"
    }
    }
    armv7 {
    ndk {
    abiFilter "armeabi-v7a"
    }
    }
    arm64_v8a {
    ndk {
    abiFilter "arm64-v8a"
    }
    }
    arm {
    ndk {
    abiFilter "armeabi"
    }
    }
    fat
    }

    If I take the built app and dissect it using apktool I see no lib main.so in lib/arm64-v8a. Should I be seeing that library in there? I understand Unity doesn't support Android 64 bit so I am trying to figure out if my plugin is not supplying the correct architectures or if the problem is elsewhere.
     
  2. yasirkula

    yasirkula

    Joined:
    Aug 1, 2011
    Posts:
    2,879
    AFAIK, Unity only has a 32-bit Android library but it normally works on 64-bit devices as well because 64-bit devices natively support 32-bit applications. The deal here is that, your application should only have 32-bit Android libraries; so if you have any 64-bit libraries (any folder other than armv7 in jniLibs in Android Studio), you should delete them. If all your libraries are 32-bit, then it will work flawlessly on both 32-bit devices and 64-bit devices but if you have some libraries that are 64-bit, then it will work flawlessly on 32-bit devices but not on 64-bit devices. At least that is what I have experienced recently.
     
  3. detournment_19

    detournment_19

    Joined:
    Jan 20, 2015
    Posts:
    22
    Yes, the 3rd party library does have a 64 bit library in it. I've been unsuccessful in removing it from the car - trying to use Java Archive tool from the command line to remove that directory. I get an AndroidManifest missing file error during a build. I don't have access to their source. Any ideas how I could remove the arm64 from that .aar?
     
  4. yasirkula

    yasirkula

    Joined:
    Aug 1, 2011
    Posts:
    2,879
    I used Vuforia+Everyplay in Unity and integrated that project to Ionic in Android Studio. It was sufficient to just delete any folders other than armeabi-v7a in jniLibs in Android Studio. If you targeted ARM+Intel on Unity (FAT build), then also don't delete x86 folder.

    If libraries inside .aar are not automatically separated into separate folders inside jniLibs in Android Studio, then I also don't know what to do for your case.
     
  5. detournment_19

    detournment_19

    Joined:
    Jan 20, 2015
    Posts:
    22
    I've simply been trying to open the aar file using jar from the command line, remove the arm64 folder and then archive it again using jar. But Unity isn't happy with something regarding the manifest, so I'm not sure I can do it that way.
     
  6. yasirkula

    yasirkula

    Joined:
    Aug 1, 2011
    Posts:
    2,879
    If only we could see the manifest and the error :D
     
  7. detournment_19

    detournment_19

    Joined:
    Jan 20, 2015
    Posts:
    22
    I did manage to solve it, and learned a few tricks with jar on the command line. Needed to adjust the directory and options, and then the aar update worked,. Also needed to switch from Gradle build to Internal in Unity build settings.

    Thanks so much for the tip on 64 bit libraries, that was the trick!
     
    yasirkula likes this.
  8. Yury-Habets

    Yury-Habets

    Unity Technologies

    Joined:
    Nov 18, 2013
    Posts:
    1,167
    @detournment_19 can you please share more details about gradle not working? Maybe submit a bug report and attach your project. Thanks!