Android Question MediaPlayer crash status=64

Robert Valentino

Well-Known Member
Licensed User
Longtime User
Does anyone know what a status 64 is in MediaPlayer

My App crashed and the crash report shows

B4X:
--------- beginning of /dev/log/system

--------- beginning of /dev/log/main

~i:** Service (starter) Create **

~e:cgenfuncs_initialize (java line: 445)

~e:java.io.IOException: Prepare failed.: status=64

~e:  at android.media.MediaPlayer.prepare(Native Method)

~e:  at anywheresoftware.b4a.objects.MediaPlayerWrapper.loadAfterReset(MediaPlayerWrapper.java:98)

~e:  at anywheresoftware.b4a.objects.MediaPlayerWrapper.Load(MediaPlayerWrapper.java:63)

~e:  at com.BOBs.BBS.cgenfuncs._initialize(cgenfuncs.java:445)

~e:  at com.BOBs.BBS.starter._service_create(starter.java:894)

~e:  at java.lang.reflect.Method.invokeNative(Native Method)

~e:  at java.lang.reflect.Method.invoke(Method.java:525)

~e:  at anywheresoftware.b4a.BA.raiseEvent2(BA.java:169)

~e:  at anywheresoftware.b4a.BA.raiseEvent(BA.java:153)

~e:  at com.BOBs.BBS.starter.onCreate(starter.java:57)

~e:  at android.app.ActivityThread.handleCreateService(ActivityThread.java:2577)

~e:  at android.app.ActivityThread.access$1600(ActivityThread.java:141)

~e:  at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1338)

~e:  at android.os.Handler.dispatchMessage(Handler.java:99)

~e:  at android.os.Looper.loop(Looper.java:137)

~e:  at android.app.ActivityThread.main(ActivityThread.java:5103)

~e:  at java.lang.reflect.Method.invokeNative(Native Method)

~e:  at java.lang.reflect.Method.invoke(Method.java:525)

~e:  at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:737)

~e:  at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:553)

~e:  at dalvik.system.NativeStart.main(Native Method)

~e:java.lang.RuntimeException: Unable to create service com.BOBs.BBS.starter: java.lang.RuntimeException: java.io.IOException: Prepare failed.: status=64

~e:  at android.app.ActivityThread.handleCreateService(ActivityThread.java:2587)

~e:  at android.app.ActivityThread.access$1600(ActivityThread.java:141)

~e:  at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1338)

~e:  at android.os.Handler.dispatchMessage(Handler.java:99)

~e:  at android.os.Looper.loop(Looper.java:137)

~e:  at android.app.ActivityThread.main(ActivityThread.java:5103)

~e:  at java.lang.reflect.Method.invokeNative(Native Method)

~e:  at java.lang.reflect.Method.invoke(Method.java:525)

~e:  at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:737)

~e:  at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:553)

~e:  at dalvik.system.NativeStart.main(Native Method)

~e:Caused by: java.lang.RuntimeException: java.io.IOException: Prepare failed.: status=64

~e:  at anywheresoftware.b4a.BA.raiseEvent2(BA.java:206)

~e:  at anywheresoftware.b4a.BA.raiseEvent(BA.java:153)

~e:  at com.BOBs.BBS.starter.onCreate(starter.java:57)

~e:  at android.app.ActivityThread.handleCreateService(ActivityThread.java:2577)

~e:  ... 10 more

~e:Caused by: java.io.IOException: Prepare failed.: status=64

~e:  at android.media.MediaPlayer.prepare(Native Method)

~e:  at anywheresoftware.b4a.objects.MediaPlayerWrapper.loadAfterReset(MediaPlayerWrapper.java:98)

~e:  at anywheresoftware.b4a.objects.MediaPlayerWrapper.Load(MediaPlayerWrapper.java:63)

~e:  at com.BOBs.BBS.cgenfuncs._initialize(cgenfuncs.java:445)

~e:  at com.BOBs.BBS.starter._service_create(starter.java:894)

~e:  at java.lang.reflect.Method.invokeNative(Native Method)

~e:  at java.lang.reflect.Method.invoke(Method.java:525)

~e:  at anywheresoftware.b4a.BA.raiseEvent2(BA.java:169)

~e:  ... 13 more

~i:** Service (starter) Create **

~i:** Service (starter) Start **

~e:starter_service_start (java line: 945) ~e:java.lang.NullPointerException

~e:  at anywheresoftware.b4a.objects.IbHelper.startSetup(IbHelper.java:269)

~e:  at anywheresoftware.b4a.inappbilling3.BillingManager3.Initialize(BillingManager3.java:44)

~e:  at com.BOBs.BBS.starter._service_start(starter.java:945)

~e:  at java.lang.reflect.Method.invokeNative(Native Method)

~e:  at java.lang.reflect.Method.invoke(Method.java:525)

~e:  at anywheresoftware.b4a.BA.raiseEvent2(BA.java:169)

~e:  at anywheresoftware.b4a.BA.raiseEvent(BA.java:153)

~e:  at com.BOBs.BBS.starter.handleStart(starter.java:104)

~e:  at com.BOBs.BBS.starter.onStartCommand(starter.java:72)

~e:  at android.app.ActivityThread.handleServiceArgs(ActivityThread.java:2704)

~e:  at android.app.ActivityThread.access$1900(ActivityThread.java:141)

~e:  at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1353)

~e:  at android.os.Handler.dispatchMessage(Handler.java:99)

~e:  at android.os.Looper.loop(Looper.java:137)

~e:  at android.app.ActivityThread.main(ActivityThread.java:5103)

~e:  at java.lang.reflect.Method.invokeNative(Native Method)

~e:  at java.lang.reflect.Method.invoke(Method.java:525)

~e:  at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:737)

~e:  at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:553)

~e:  at dalvik.system.NativeStart.main(Native Method)

java.lang.NullPointerException

  at anywheresoftware.b4a.objects.IbHelper.startSetup(IbHelper.java:269)

  at anywheresoftware.b4a.inappbilling3.BillingManager3.Initialize(BillingManager3.java:44)

  at com.BOBs.BBS.starter._service_start(starter.java:945)

  at java.lang.reflect.Method.invokeNative(Native Method)

  at java.lang.reflect.Method.invoke(Method.java:525)

  at anywheresoftware.b4a.BA.raiseEvent2(BA.java:169)

  at anywheresoftware.b4a.BA.raiseEvent(BA.java:153)

  at com.BOBs.BBS.starter.handleStart(starter.java:104)

  at com.BOBs.BBS.starter.onStartCommand(starter.java:72)

  at android.app.ActivityThread.handleServiceArgs(ActivityThread.java:2704)

  at android.app.ActivityThread.access$1900(ActivityThread.java:141)

  at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1353)

  at android.os.Handler.dispatchMessage(Handler.java:99)

  at android.os.Looper.loop(Looper.java:137)

  at android.app.ActivityThread.main(ActivityThread.java:5103)

  at java.lang.reflect.Method.invokeNative(Native Method)

  at java.lang.reflect.Method.invoke(Method.java:525)

  at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:737)

  at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:553)

  at dalvik.system.NativeStart.main(Native Method)


It is trying to load a file

B4X:
  NotifySound.Initialize
  NotifySound.Load(File.DirAssets, "sound-notify.mp3")


and I am sure the file is included

What is status=64 and how to code for this error

BobVal
[/code]
 

DonManfred

Expert
Licensed User
Longtime User
Upvote 0

Robert Valentino

Well-Known Member
Licensed User
Longtime User
Not sure any of them apply.

I'm just doing an Init and load when the crash occurs.

Wonder if on some devices you can't have multiple mediaplayers defined and loaded.
 
Upvote 0

Robert Valentino

Well-Known Member
Licensed User
Longtime User
A friend suggested that I change the name to get rid of the Dash and make it an Underscore.

He says that he has found on some of these "knock off devices" they do not handle thinks like dash's very well.

Never heard that but worth a try.

NOTE: this is not crashing on anything I have but on some unknown device by a user
 
Upvote 0

ilan

Expert
Licensed User
Longtime User
where are you intializing the mediaplayer?
can you upload a small project that this error can be reproduced?
 
Upvote 0

Robert Valentino

Well-Known Member
Licensed User
Longtime User
No. As I said this is not happening on anything I have.

I have the logs turned on and when the system crashes it Emails me the log reports. (I trap it in the Application_Error in my Starter service as send the Email from there)
This happened to some user.

Wish I had more info

BobVal
 
Upvote 0

ilan

Expert
Licensed User
Longtime User
No. As I said this is not happening on anything I have.

I have the logs turned on and when the system crashes it Emails me the log reports. (I trap it in the Application_Error in my Starter service as send the Email from there)
This happened to some user.

Wish I had more info

BobVal

are you intializing the mediaplayer in the starter service?
 
Upvote 0

Robert Valentino

Well-Known Member
Licensed User
Longtime User
Yes

Code works perfectly for over a year now.

I'm going to wait and see what happens. I changed the file name from "sound-notify.mp3" to "sound_notify.mp3" (of course verified it works) and put up a new release

Wish I knew who the user was to tell them to try again.
 
Upvote 0

ilan

Expert
Licensed User
Longtime User
i would suggest you to do 1 test

go to your android settings and then open "developer options"
scroll down to "Apps"
then check "do not keep activities" and also limit background processes (to "no background process")
and try your app on your phone.

the problem is lot of people think that enabling those settings will make their phone run faster and they start changing those settings that can cause problems on your app. that's why i asked if you intialize the mp in starter because if they have enabled those settings starter may not run on background and your activity could not access mp and because on your phone and also on most phones those settings are not enabled then your app works.

i would also suggest you to set mp in process globals in your activity and not in starter service because of this reason.
if you do that you will always have access to your mp because it is set in your activity.
 
Upvote 0

Robert Valentino

Well-Known Member
Licensed User
Longtime User
WOW, interesting.

I have the code for all this in a Code Module (it's my GenFuncs class) and have a initialize routine that I call the first time (and YES this is being called the first time from Starter). In the initialize routine I initialize the MediaPlayer(s) - have multiple.

NOTE: Remember this is a Code Module so there is no IsInitialized routine so I created a variable so I could do a

B4X:
if  cGenFuncs.IsInitialized = false then cGenFuncs.Initialize

So it kind of looks like a Class Module

B4X:
Sub Process_Globals
  Public  IsInitialized  As Boolean = False

  Dim AlertBeeper  As Beeper
   
  Dim  NotifySound    As MediaPlayer   
  Dim  BowlingSound  As MediaPlayer   
End Sub

#Region Initialize
Public Sub Initialize
  IsInitialized = True
   
  AlertBeeper.Initialize2(500, 500, AlertBeeper.VOLUME_NOTIFICATION)

  NotifySound.Initialize
  NotifySound.Load(File.DirAssets, "sound_notify.mp3")

  BowlingSound.Initialize
  BowlingSound.Load(File.DirAssets, "bowling.mp3")
End Sub
#End Region

Public  Sub BowlingSoundPlay  
       BowlingSound.Position = 0  
       BowlingSound.Play  
End Sub

Public  Sub NotifySoundPlay  
       NotifySound.Position = 0  
       NotifySound.Play  
End Sub


If Starter is not running in the background I have a lot of other problems. I use it to download files, billing manager (get owned products).


I made the changes on my device and tried software runs with no problems.


Is there ANYWAY to check if this is a problem and give the user a ToastMessageShow to Fix their settings.

Do you really think moving MediaPlayers to main is really the necessary

BobVal
 
Upvote 0

ilan

Expert
Licensed User
Longtime User
Ok after testing i can confirm that the developer option is not the reason for that but i can also confirm that if you have in main activity a process global object that you want to access from a second activity then setting in developer option "do not keep activities" will kill the main activity and you will not be able to access those objects.

i have this problem in one of my apps. people like to play with those developer options and that could cause problems in some apps.
i thought maybe the starter service may also be effected of that but it seems like it is working.
 
Upvote 0
Top