rollbar / rollbar-java

Rollbar for Java and Android
https://docs.rollbar.com/docs/java
MIT License
72 stars 74 forks source link

Crash: Could not create folder .../cache/rollbar-items #308

Open malua opened 10 months ago

malua commented 10 months ago

Hey, do you maybe have an idea, why our apps are crashing?

Exception java.lang.RuntimeException: Unable to create application com.xxx.app.CustomApplicationClass: java.lang.RuntimeException: Could not create folder: /data/user/0/com.xxx.app/cache/rollbar-items
  at android.app.ActivityThread.handleBindApplication (ActivityThread.java:6810)
  at android.app.ActivityThread.-$$Nest$mhandleBindApplication
  at android.app.ActivityThread$H.handleMessage (ActivityThread.java:2132)
  at android.os.Handler.dispatchMessage (Handler.java:106)
  at android.os.Looper.loopOnce (Looper.java:201)
  at android.os.Looper.loop (Looper.java:288)
  at android.app.ActivityThread.main (ActivityThread.java:7918)
  at java.lang.reflect.Method.invoke
  at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run (RuntimeInit.java:548)
  at com.android.internal.os.ZygoteInit.main (ZygoteInit.java:936)
Caused by java.lang.RuntimeException: Could not create folder: /data/user/0/com.xxx.app/cache/rollbar-items
  at com.rollbar.notifier.sender.queue.DiskQueue.<init> (DiskQueue.java:46)
  at com.rollbar.notifier.sender.queue.DiskQueue.<init> (DiskQueue.java:24)
  at com.rollbar.notifier.sender.queue.DiskQueue$Builder.build (DiskQueue.java:213)
  at com.rollbar.android.Rollbar.<init> (Rollbar.java:357)
  at com.rollbar.android.Rollbar.init (Rollbar.java:162)
  at com.rollbar.android.Rollbar.init (Rollbar.java:138)
  at com.rollbar.android.Rollbar.init (Rollbar.java:123)
  at com.rollbar.android.Rollbar.init (Rollbar.java:109)
  at com.rollbar.android.Rollbar.init (Rollbar.java:82)
  at com.xxx.app.CustomApplicationClass.onCreate (CustomApplicationClass.java:18)
  at android.app.Instrumentation.callApplicationOnCreate (Instrumentation.java:1277)
  at android.app.ActivityThread.handleBindApplication (ActivityThread.java:6805)

It seems that it crashes when I initialize Rollbar in my CustomApplicationClass:

public class CustomApplicationClass extends MultiDexApplication {

  @Override
  public void onCreate() {
    // Rollbar initialization
    Rollbar.init(this, getResources().getString(R.string.rollbar_access_token), getResources().getString(R.string.rollbar_environment));

    super.onCreate();
  }

  @Override
  protected void attachBaseContext(Context base) {
    super.attachBaseContext(base);
    MultiDex.install(this);
  }
}
buongarzoni commented 3 weeks ago

hi @malua ! I was trying to reproduce the error but so far I couldn't, could you share more information with me? like, are you testing it on an emulator or a device? with what api? Did you try the example app and it also produced this error?

malua commented 3 weeks ago

This happened a lot in our production apps. I removed the rollbar sdk from android, when I created the issue. But I could not reproduce it locally. I thought you can maybe do more with the error message than me.