Search Unity

  1. Welcome to the Unity Forums! Please take the time to read our Code of Conduct to familiarize yourself with the forum rules and how to post constructively.
  2. We have updated the language to the Editor Terms based on feedback from our employees and community. Learn more.
    Dismiss Notice
  3. Join us on November 16th, 2023, between 1 pm and 9 pm CET for Ask the Experts Online on Discord and on Unity Discussions.
    Dismiss Notice

ADT Legacy project export with OBB build enabled = missing critical file resulting in FMOD crash

Discussion in 'Android' started by skaarjslayer, Sep 28, 2017.

  1. skaarjslayer

    skaarjslayer

    Joined:
    Oct 10, 2013
    Posts:
    108
    I've been having difficulty with my Android project. Every time, at app launch I get the following error:

    When this error shows up, the game remains stuck on a black screen and never properly launches.

    I run Unity 5.6.3p1 and have "Split Application Binary" enabled. The project is exported to an ADT (Legacy) Android build that's built with ANT. A deprecated system, I know, but for reasons outside of my control I don't have the ability to use Gradle instead.

    Before running the ANT build commands, I decided to peak inside the generated Android Studio project and noticed that the project is completely missing the "sharedassets0.resource" file. If I export the project for Gradle just to check, the file is there as it should be.

    Important to note is that the "sharedassets0.resource" is there if I export to ADT (Legacy) project with "Split Binary Application" disabled.

    Needless to say, building the project straight to APK/OBB without exporting doesn't give me the FMOD crash and when I open the APK the "sharedassets0.resource" file is there.

    I doubt this behaviour is normal but I'm at a loss as to how to fix it.
     
  2. skaarjslayer

    skaarjslayer

    Joined:
    Oct 10, 2013
    Posts:
    108
    I'm really hoping to stay on Unity 5.6.x but just to see, I tried running a build using Unity 2017.1.1p3 and "sharedassets0.resource" is still missing from the Android Studio project with "Split Application Binary" enabled and exported using ADT (Legacy).
     
  3. Yury-Habets

    Yury-Habets

    Unity Technologies

    Joined:
    Nov 18, 2013
    Posts:
    1,165
    Well first of all don't use ADT - it is marked as obsolete in 2017.2, and removed in 2017.3, if I remember correctly.

    Second, you need to manually install the OBB on your phone to have the streaming sounds working. The OBB should be somewhere next to the exported ADT project. You also need to follow the naming scheme required for OBB - main.1.com.unity3d.app.obb, where 1 is the version code, and com.unity3d.app is the bundle identifier, and put it into the specific dir (which is usually the external strorage + Android/obb/).

    When you do "Build & Run" from the Editor, we do the OBB deployment magic for you. But when exporting, we are building the OBB and you should take care of installing it to the device yourself.
     
  4. skaarjslayer

    skaarjslayer

    Joined:
    Oct 10, 2013
    Posts:
    108
    Sorry, I think there was a misunderstanding. Hopefully these notes will clear some things up in my original post:

    1) I am completely aware of how to install an OBB build manually and my issue has nothing to do with forgetting to place the OBB file on device. Every time this issue occurs I have the OBB manually installed with the correct naming convention.

    2) The "sharedassets0.resource" file doesn't get placed into the OBB file when you build, it gets placed into the APK. My issue is that an OBB build using ADT is missing the "sharedassets0.resource" file completely from the Android Studio project so that when an ANT build is run, it also is missing from the APK completely. So this is an issue that occurs irrespective of whether the OBB file is there or not and it seems to have to do with how Unity generates the Android Studio project.

    3) I don't use streaming for audio at all.

    4) I don't have a choice but to use ADT Legacy (some companies still use legacy systems). In any case I'm using Unity 5.6.3p1 (not Unity 2017).

    I'm not sure if the missing "sharedassets0.resource" file is a bug or something about the way my project is set up that causes it to be missing. In any case I've run the following tests:

    ADT export with OBB enabled = "sharedassets0.resource" is missing from Android Studio project
    ADT export with OBB disabled = "sharedassets0.resource" is present in Android Studio Project
    Gradle export with OBB enabled = "sharedassets0.resource" is present in Android Studio Project
    Gradle export with OBB disabled = "sharedassets0.resource" is present in Android Studio Project

    I'm hoping for a little more investigation you can do on this issue, as it's not as simple as me not manually adding the OBB. Thanks!
     
    Last edited: Sep 29, 2017
  5. Yury-Habets

    Yury-Habets

    Unity Technologies

    Joined:
    Nov 18, 2013
    Posts:
    1,165
    Ah okay. It sounds like a bug indeed. Not that I'm eager to fix a bug for a dropped feature - but if you submit a bug report - it may get fixed!
     
  6. skaarjslayer

    skaarjslayer

    Joined:
    Oct 10, 2013
    Posts:
    108
    Ok thanks. Yea, I understand. I'd rather not be using a legacy system either but in this instance I have to try and make it work. I'll log a bug report on this issue now.
     
    Yury-Habets likes this.
  7. skaarjslayer

    skaarjslayer

    Joined:
    Oct 10, 2013
    Posts:
    108
    Just about to log the bug report but was just experimenting with an empty project and wanted to make note of it here:

    Apparently, the "sharedassets0.resource" file is generated specifically when you have audio in your 1st scene. In a Gradle build or non-export Unity Android build, everything in the 1st scene is bundled into the APK (for obvious reasons) and all other scenes and resources are put into the OBB. However, with an ADT export with OBB enabled, Unity is forgetting to bundle the audio in the 1st scene, as it neither shows up in the OBB or the Android Studio project (and thus is never in the APK).

    A workaround may simply to be just not having audio in the first scene at all, but I haven't tested that out yet - nevertheless I'll file a bug report.
     
    Yury-Habets likes this.