filestack / filestack-android

Official Android SDK for Filestack - API and content management system that makes it easy to add powerful file uploading and transformation capabilities to any web or mobile application.
https://www.filestack.com
Apache License 2.0
154 stars 90 forks source link

FilePicker crashes on tablet (devices uses `layout-sw600dp-v13`) #206

Open ghost opened 5 years ago

ghost commented 5 years ago

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?

MherKarapetyan commented 4 years ago

Any solution?

ghost commented 4 years ago

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.

ryanlkuhn commented 3 years ago

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.