Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

IllegalArgumentException in StatFs in WebViewCore internal thread

Google play reports an exception on some devices (all are "other" and one "LG-E400", so it might be some custom android build)

Exception is:

java.lang.IllegalArgumentException
at android.os.StatFs.native_setup(Native Method)
at android.os.StatFs.<init>(StatFs.java:32)
at android.webkit.CacheManager.init(CacheManager.java:199)
at android.webkit.BrowserFrame.<init>(BrowserFrame.java:210)
at android.webkit.WebViewCore.initialize(WebViewCore.java:201)
at android.webkit.WebViewCore.access$500(WebViewCore.java:54)
at android.webkit.WebViewCore$WebCoreThread$1.handleMessage(WebViewCore.java:631)
at android.os.Handler.dispatchMessage(Handler.java:99)
at android.os.Looper.loop(Looper.java:130)
at android.webkit.WebViewCore$WebCoreThread.run(WebViewCore.java:653)
at java.lang.Thread.run(Thread.java:1019)

The problem is I can't ignore this axception 'cause it is in separate thread. Is there any solution for this problem? Or what can I do with that?

like image 459
babay Avatar asked Feb 10 '13 10:02

babay


5 Answers

Much likely it's a device OS bug. I have much problems with AudioRecord library - it also fails in native init on number of devices like Yusu, Micromax, Alcatel and other low range devices. They are all shown as "other" in GooglePlay reports. Also I encoundered that some Cyanogenmod ROMs have a bug in AudioRecord - on my HTC One V it worked okay until I flashed CM10. One good way to know exact device model, logcats, mem and other info about what happens on these devices is to use some advanced crash report tool, as ACRA After I get report that something is definitely wrong on device with it's manufacturer's firmware, I blacklist it on GooglePlay.

like image 179
Yaroslav Mytkalyk Avatar answered Nov 05 '22 17:11

Yaroslav Mytkalyk


Path which you are providing in Statfs constructor does not exists

  String path = "path to some directory";
StatFs statFs = null;
statFs = new StatFs(path);

and you must have external storage permission in manifest file

like image 23
Amit Avatar answered Nov 05 '22 17:11

Amit


Looks like some firmware had problem with StatFs

I had similar issue with Samsung Galaxy Stratosphere™ II (Verizon) SCH-I415, Android:4.1.2 When I call:

 StatFs statFs = null;
 statFs = new StatFs(Environment.getExternalStorageDirectory().getAbsolutePath());

I got exception:

 java.lang.IllegalArgumentException
 at android.os.StatFs.native_setup(Native Method)
 at android.os.StatFs.<init>(StatFs.java:32)
like image 20
0x8BADF00D Avatar answered Nov 05 '22 18:11

0x8BADF00D


I have got similar issue and my log was looking like

03-14 13:41:55.715: E/PayPalService(14037): Risk component failed to initialize, threw null
03-14 13:41:56.295: E/(14037): statfs /storage/sdcard0 failed, errno: 13
03-14 13:41:56.365: E/AndroidRuntime(14037): FATAL EXCEPTION: Thread-1219
03-14 13:41:56.365: E/AndroidRuntime(14037): java.lang.IllegalArgumentException
03-14 13:41:56.365: E/AndroidRuntime(14037): at android.os.StatFs.native_setup(Native Method)
03-14 13:41:56.365: E/AndroidRuntime(14037): at android.os.StatFs.<init>(StatFs.java:32)

I found this issue related to sd card by looking the first two lines .Then I checked device setting and found I had checked their a option apps must have permission to read sd card and the app I was installing was not having READ SD CARD permission in manifest. So possibly these things are related and possible solutions for me were either put permission in manifest or to unchecke that option .Hope it will help in further research.

like image 37
Bansal_Sneha Avatar answered Nov 05 '22 17:11

Bansal_Sneha


Starting with Lollipop, Android placed rather extreme restrictions on accessing external SD cards. You can use:

    StatFs stat;
    try {
        stat = new StatFs(path);
    } catch (IllegalArgumentException e) {
        // Handle the failure gracefully or just throw(e)
    }

to work-around the error.

For my application, I just skip unavailable directories, essentially limiting the user to the internal storage. Not an ideal solution, but a limited application that doesn't crash is better than one which does.

like image 1
DWalker Avatar answered Nov 05 '22 17:11

DWalker