Music is not playing after build to APK

I have tested my game in the Editor and everything seems to be working fine. But after I build it into APK, the music won’t load and the game got stuck on the main game scene. I believe there’s something to do with my Main.cs script and some others. Note: I’m trying to load the audio on runtime because I’m using a music selection system.


    public int CurrentBeat = 0;
    public float BPM;
    public bool RespawnNote = true;
    public Scoring ScoreSystem;
    public MusicData MusicData;
    public int Difficulty = 1;
    public int Speed = 4;
    private float FallTime;
    public AudioSource Music;
    private AudioClip music2Play;
    public GameHandler GameData;

    void Awake(){
            #region FromStart
            // preparing objects
            GameData = FindObjectOfType(); // if this fails, go to catch line
            music2Play = FindObjectOfType();
            // preparing data
            MusicData = GameData.GetCurrentMusic();
            FallTime = 16f / GameData.GameSpeed;
            Difficulty = GameData.Difficulty;
            Speed = GameData.GameSpeed;
            isTest = false;

            // set the clip to the AudioSource
            Music.clip = music2Play;
        catch (System.Exception)
            #region TestTrack
            // this will be a test script
            // so you don't need to start
            // all the way from the beginning
            // PS: I've set a track as default, so
            // no more FileName on MusicData
            isTest = true;
            MusicData = new MusicData() { Title = "TestTrack", Artist = "", 
                BPM = 120, Offset = testOffset, TrackBeats = TestTrackBeats };
            FallTime = 16f / Speed;
            //these lines will be executed no matter what
            ScoreSystem = FindObjectOfType();
            cache = FindObjectOfType();
             // preparing latency
            lateStart = MusicData.Offset > FallTime; 

    void LoadAudio()
        // load the audio file
        // note: ignore extension
        music2Play = Resources.Load(GameData.RawPath + MusicData.FileNameNoExt);

    IEnumerator Play()
        if (!lateStart)
            yield return new WaitForSeconds(FallTime + MusicData.Offset);


I used Start() to call the coroutine Play()

Please, I need a quick solution to this issue. I need to get it finished in a week or two.

Iam not entirely a expert on sound matter, but this behaviour you are getting,

  • Seems a wrong format to play on
    android. Mobile systems are sometimes
    very strict and specific to some
    extensions/plugins types. Same on
    videos also.
  • Check also a few options of the file,
    compressions, bitrates, etc… a
    sound expert may give you a help in
  • In the worst case, your android
    system runs out of resources to load
    the file, or not loading it quick
    enought to be readable by unity

Maybe this helps somehow.

try change build to 64x in other settings =)
works for me.