Sound not work on android game build in unity 5
Hey I am working on a game Its sounds work fine when I play on unity or play on android phone by build and run but when I use apk file and install on same phone sound are not working. I have no idea what's going on any one please give any reference or help... Working on window 10, unity 5 sound format : mp3 and ogg
shows error in logcat :
11-18 09:50:41.013 3710-3730/? E/Unity﹕ Error: Cannot create FMOD::Sound instance for resource sharedassets0.resource, (File not found. )
(Filename: Line: 845)
Script :
using UnityEngine;
using System.Collections;
public class PlayerControl : MonoBehaviour{
bool check = false;
AudioSource sounds;
public AudioClip coin;
public AudioClip treasure;
public AudioClip power;
public AudioClip g_power;
public AudioClip spring_up;
public AudioClip cheerUp;
void Start ()
{
sounds = GetComponent<AudioSource> ();
}
void Update ()
{
if (!check && Movement.gameStart) {
check = true;
}
}
void OnCollisionStay2D (Collision2D col)
{
if (col.gameObject.tag == "box" && GetComponent<Rigidbody2D> ().velocity.y <= 0)
Movement.inAir = false;
}
void OnTriggerEnter2D (Collider2D col)
{
if (UI.sfx) {
if (col.gameObject.tag == "coin")
sounds.PlayOneShot (coin, 1f);
else if (col.gameObject.tag == "treasure") {
sounds.PlayOneShot (treasure, 1f);
sounds.PlayOneShot (cheerUp, 1f);
}
if (GetComponent<Rigidbody2D> ().velocity.y <= 0) {
if (col.gameObject.tag == "green") {
sounds.PlayOneShot (g_power, 1f);
sounds.PlayOneShot (spring_up, 1f);
} else if (col.gameObject.tag == "blue") {
sounds.PlayOneShot (power, 1f);
sounds.PlayOneShot (spring_up, 1f);
}
}
}
}}
How are you referencing your sound files in your project? Can you include the code?
if you are loading your sound from REsources or Shared assets... try moving it onto a prefab ins$$anonymous$$d then playing it. I had F$$anonymous$$OD error when files were in Strea$$anonymous$$gAssets folder...
Answer by anil4029 · Nov 18, 2015 at 04:33 AM
I found solution : Just turn off the binary split option in player setting > publishing setting
This is not a solution for someone who needs to publish a bigger game to google play console. You need to split the game to make it small enough to upload to google play console. Has anyone ever figure out how to do it? I am on 2018.3.0f2
Answer by Baintastic · Nov 17, 2015 at 04:40 PM
A couple of things you can try:
UI.sfx may be false for whatever reason on your Android build. Maybe remove that conditional and see if that's the issue?
Run logcat on your pc while the app is running and see if you can catch some android errors that way: http://answers.unity3d.com/questions/492681/how-to-use-adb-logcat.html
It works fine when I run it by build and run but when I use that same apk file and install then sound stop working..so I think UI.sfx is fine
Yep, that makes sense. Did you try out logcat?
it show error : 11-18 09:50:41.013 3710-3730/? E/Unity﹕ Error: Cannot create F$$anonymous$$OD::Sound instance for resource sharedassets0.resource, (File not found. ) (Filename: Line: 845)
I have the same issue... using Wwise audio tools, source assets are in Strea$$anonymous$$gAssets folder at build-time. Logcat shows the F$$anonymous$$OD error also .Changing split binary setting has no effect. Did you solve the problem ?
Answer by JonnyHilly · Feb 03, 2016 at 08:43 PM
Check your Edit->project settings->Audio If you have Unity Audio disabled, but any audio stuff in scene or scripts can cause this error. I had this when integrating Wwise audio tools into unty (droid build) which auto disables the unity audio option.
Is Wwise absolutely necessary when it comes to making android/ios/webgl builds? When I build my apk, there is no sounds on Samsung A50 device. Would Wwise fix this?
this is an old thread, wow! but no, you don't need wwise for iOS or droid. I never use it. I only used it above as I worked at a developer then that used it. It might be a good tool for very large, console or pc games. but not really needed at all for iOS / droid dev. it will just bloat your project and cause you compile problems. ( from what I remember)
Ok. Would you happen to know the reason behind this issue. $$anonymous$$y android apk works on some android phones but not on others. It's even wierder than two tested devices were samsung s10's and the sound worked on one of them, but not on the other.
Your answer
![](https://koobas.hobune.stream/wayback/20220612045211im_/https://answers.unity.com/themes/thub/images/avi.jpg)
Follow this Question
Related Questions
Failed to re-package resources 1 Answer
Animation working in Unity and PC build, but not Android 1 Answer
No GearVR in My app, But it always start GearVR when I start my app! 0 Answers
WINDOWS 10 DllNotFoundException: sqlite3 0 Answers
IL2CPP did not run probbably,IL2CPP Did not run probbably 0 Answers