eclipse - Can't play sound in Android Native Extension -


here's how try it:

try { mediaplayer mediaplayer = mediaplayer.create(context.getactivity().getbasecontext(), r.raw.mysound); mediaplayer.start(); } catch(exception e) { log.d("no sound",e.getmessage()); } 

(mysound.mp3 in res/raw/ folder in eclipse project)

i pack sound file .ane in platform.xml this:

<packagedresource>  <packagename>com.myname.androidextension</packagename>  <foldername>res</foldername>  </packagedresource> 

while having mysound.mp3 file in android-arm/res/raw/mysound.mp3

when check .ane file, mp3 inside.

but when run app on phone, dont hear sound, instead weird logcat line:

no sound | file res/layout/main.xml drawable resource id #0x7f030002 

i don't understand it. since it's native extension ment playing sounds, don't need layouts , there no main.xml in project.

been googling mad, unable find use.

what mean , how can make sound play?

thanks!

update: have marked extension project library , changed, logcat shows line instead of previous:

no sound | file res/raw/mysound.mp3 drawable resource id #0x7f040007 

so no more mysterious main.xml , id has changed. checked source of r.java , inside there line:

public static int mysound=0x7f030002; 

so ids in logcat , in r.java don't match, mean?


Comments

Popular posts from this blog

python - TypeError: start must be a integer -

c# - DevExpress RepositoryItemComboBox BackColor property ignored -

django - Creating multiple model instances in DRF3 -