0

I'm running some monkey tests in a very simple android application (2 activities, a couple of buttons, edittexts, etc...) using Android emulator.

adb shell monkey -p my_package 5000

And I'm getting always this strange error:

java.lang.RuntimeException: Unable to create service com.android.music.MediaPlaybackService: java.lang.SecurityException: MODE_WORLD_READABLE no longer supported
//  at android.app.ActivityThread.handleCreateService(ActivityThread.java:3172)
//  at android.app.ActivityThread.-wrap5(ActivityThread.java)
//  at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1550)
//  at android.os.Handler.dispatchMessage(Handler.java:102)
//  at android.os.Looper.loop(Looper.java:154)
//  at android.app.ActivityThread.main(ActivityThread.java:6077)
//  at java.lang.reflect.Method.invoke(Native Method)
//  at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:865)
//  at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:755)
// Caused by: java.lang.SecurityException: MODE_WORLD_READABLE no longer supported
//  at android.app.ContextImpl.checkMode(ContextImpl.java:2162)
//  at android.app.ContextImpl.getSharedPreferences(ContextImpl.java:363)
//  at android.app.ContextImpl.getSharedPreferences(ContextImpl.java:358)
//  at android.content.ContextWrapper.getSharedPreferences(ContextWrapper.java:164)
//  at com.android.music.MediaPlaybackService.onCreate(MediaPlaybackService.java:338)
//  at android.app.ActivityThread.handleCreateService(ActivityThread.java:3162)
//  ... 8 more
// 
** Monkey aborted due to error.

It's about MediaPlayer but this app is not using anything related to that.

Why is this error happening? How can I avoid it?

Thanks in advance!

nano
  • 2,511
  • 4
  • 25
  • 42
  • Monkey is sending to your App lot of different events. One of these is probably start of MediaPlayer. Try to change settings default MediaPlayer in your device. – eurosecom May 22 '17 at 08:59
  • May be help http://stackoverflow.com/questions/6847986/android-exerciser-monkey-starts-playing-audio-files-at-random – eurosecom May 22 '17 at 09:09
  • I'm launching a new emulator in my IC process, installing this simple APK and then launching the monkey tests. I don't see how I can avoid using the MediaPlayer in the emulator, or ignore just this error during the tests. – nano May 24 '17 at 07:45
  • You do not ignore this error, please. Try add parameter --pct-syskeys 0 on emulator and then try to test on real device without --pct-syskeys 0. More https://developer.android.com/studio/test/monkey.html – eurosecom May 24 '17 at 08:34
  • Thanks! I could also fix it adding -v: `adb shell monkey -p my_package -v 5000` – nano May 25 '17 at 13:24

0 Answers0