filestack-android
filestack-android copied to clipboard
FilePicker crashes on tablet (devices uses `layout-sw600dp-v13`)
I'm seeing the following crash when launching the app. Note this same build works on the phone. FsActivity.java:148 attempts to find a view with the id like this.
((TextView) nav.getHeaderView(0).findViewById(R.id.filestack__drawer_title)).setTextColor(theme.getBackgroundColor());
The app crashes with the following stacktrace.
java.lang.RuntimeException: Unable to start activity ComponentInfo{com.nativestorybook/com.filestack.android.FsActivity}: java.lang.NullPointerException: Attempt to invoke virtual method 'android.view.View android.view.View.findViewById(int)' on a null object reference
at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:3260)
at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:3396)
at android.app.servertransaction.LaunchActivityItem.execute(LaunchActivityItem.java:83)
at android.app.servertransaction.TransactionExecutor.executeCallbacks(TransactionExecutor.java:135)
at android.app.servertransaction.TransactionExecutor.execute(TransactionExecutor.java:95)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:2009)
at android.os.Handler.dispatchMessage(Handler.java:107)
at android.os.Looper.loop(Looper.java:214)
at android.app.ActivityThread.main(ActivityThread.java:7319)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:492)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:934)
Caused by: java.lang.NullPointerException: Attempt to invoke virtual method 'android.view.View android.view.View.findViewById(int)' on a null object reference
at com.filestack.android.FsActivity.onCreate(FsActivity.java:148)
at android.app.Activity.performCreate(Activity.java:7783)
at android.app.Activity.performCreate(Activity.java:7772)
at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1299)
at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:3235)
I noticed there are two layouts version of filestack__activity_filestack.xml in the library for that particular screen: one in layout, the other is in layout-sw600dp-v13. The latter is for devices with width greater than 600dp (which applies to most tablets). The layout-sw600dp-v13 version of the layout doesn't have a view with ID filestack__drawer_title as a result the app crashes (FsActivity:148). Does this library work for tablets. How should this be fixed?
Any solution?
No solution yet. I've raised the issue to support team but conversation has gone stale. I haven't had the chance to follow up and try to resolve this. Let me know if you have any more information.
Since this package is clearly no longer being maintained my team has opted to fork this package and do our own maintenance. We ran into this issue as well and were able to resolve it by simply deleting the layout file noted above that's causing the issue. This resolves the bug and the existing layout for mobile looks and works fine on a tablet.