0
votes

I am trying to port a native Android app to BB10 OS (BlackBerry). I was able to install the app but when I launch it, I see this error:

 FATAL EXCEPTION: main
 java.lang.RuntimeException: Unable to create application com.example.MyApplication: java.lang.SecurityException: Failed to open /dev/urandom for writing
     at android.app.ActivityThread.handleBindApplication(ActivityThread.java:4454)
     at android.app.ActivityThread.access$1300(ActivityThread.java:141)
     at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1316)
     at android.os.Handler.dispatchMessage(Handler.java:99)
     at android.os.Looper.loop(Looper.java:137)
     at android.app.ActivityThread.main(ActivityThread.java:5116)
     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:787)
     at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:600)
     at dalvik.system.NativeStart.main(Native Method)
 Caused by: java.lang.SecurityException: Failed to open /dev/urandom for writing
     at o.dD$if.Ë‹(:279)
     at o.dD$if.engineSetSeed(:215)
     at java.security.SecureRandom.setSeed(SecureRandom.java:243)
     at java.security.SecureRandom.setSeed(SecureRandom.java:258)
     at java.lang.reflect.Method.invokeNative(Native Method)
     at java.lang.reflect.Method.invoke(Method.java:525)
     at o.ff$Õ™.<clinit>(Unknown Source)
     at o.dA.ËŠ(:285)
     at o.dA.<init>(:99)
     at o.dA.ËŠ(:151)
     at com.example.MyApplication.ͺ(:182)
     at com.example.MyApplication.onCreate(:66)
     at android.app.Instrumentation.callApplicationOnCreate(Instrumentation.java:1007)
     at android.app.ActivityThread.handleBindApplication(ActivityThread.java:4451)
     ... 10 more
 Caused by: java.io.FileNotFoundException: /dev/urandom: open failed: EACCES (Permission denied)
     at libcore.io.IoBridge.open(IoBridge.java:409)
     at java.io.FileOutputStream.<init>(FileOutputStream.java:88)
     at java.io.FileOutputStream.<init>(FileOutputStream.java:73)
     at o.dD$if.Ë‹(:277)
     ... 23 more
 Caused by: libcore.io.ErrnoException: open failed: EACCES (Permission denied)
     at libcore.io.Posix.open(Native Method)
     at libcore.io.BlockGuardOs.open(BlockGuardOs.java:110)
     at libcore.io.IoBridge.open(IoBridge.java:393)
     ... 26 more
W/ActivityManager(6766745):   Force finishing activity com.example.android.agent/com.example.agent.activities.LaunchActivity
E/OrientationUtil(6766745): Unable to read sensor data. errno 11
D/dalvikvm(20689057): GC_CONCURRENT freed 307K, 5% free 10097K/10576K, paused 1ms+1ms, total 48ms

Any insights into addressing this issue is highly appreciated.

why you need to write to urandom?Marcin Orlowski
I am using /dev/urandom to generate high entropy random PRNG as the default PRNG provider is low entropy. I understand that /dev/urandom is Linux specific and i would like to understand if the BlackBerry Runtime for Android doesn't support it. If not, i would appreciate an alternative. I am a newbie on BB development. Thanks.VJ Vélan Solutions