MaterialFilePicker icon indicating copy to clipboard operation
MaterialFilePicker copied to clipboard

java.lang.RuntimeException: Unable to start activity ComponentInfo

Open anonym24 opened this issue 7 years ago • 5 comments
trafficstars

java.lang.RuntimeException: Unable to start activity ComponentInfo

   new MaterialFilePicker()
                            .withActivity(mActivity)
                            .withRequestCode(78)
                            .withFilter(Pattern.compile(".*\\.txt$")) // Filtering files and directories by file name using regexp
                            .withFilterDirectories(true) // Set directories filterable (false by default)
                            .withHiddenFiles(true) // Show hidden files and folders
                            .start();
02-21 23:57:55.546 6715-6715/com.google.android.demo E/AndroidRuntime: FATAL EXCEPTION: main
                                                                                  Process: com.google.android.exoplayer2.demo, PID: 6715
                                                                                  java.lang.RuntimeException: Unable to start activity ComponentInfo{com.google.android.exoplayer2.demo/com.nbsp.materialfilepicker.ui.FilePickerActivity}: java.lang.ArrayIndexOutOfBoundsException: length=1926; index=8172
                                                                                      at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2455)
                                                                                      at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2515)
                                                                                      at android.app.ActivityThread.access$1000(ActivityThread.java:154)
                                                                                      at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1379)
                                                                                      at android.os.Handler.dispatchMessage(Handler.java:102)
                                                                                      at android.os.Looper.loop(Looper.java:157)
                                                                                      at android.app.ActivityThread.main(ActivityThread.java:5555)
                                                                                      at java.lang.reflect.Method.invoke(Native Method)
                                                                                      at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:745)
                                                                                      at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:635)
                                                                                   Caused by: java.lang.ArrayIndexOutOfBoundsException: length=1926; index=8172
                                                                                      at android.content.res.TypedArray.getValueAt(TypedArray.java:1134)
                                                                                      at android.content.res.TypedArray.getColor(TypedArray.java:448)
                                                                                      at android.app.Activity.onApplyThemeResource(Activity.java:3837)
                                                                                      at android.view.ContextThemeWrapper.initializeTheme(ContextThemeWrapper.java:150)
                                                                                      at android.view.ContextThemeWrapper.setTheme(ContextThemeWrapper.java:94)
                                                                                      at android.support.v7.app.AppCompatActivity.setTheme(AppCompatActivity.java:89)
                                                                                      at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2401)
                                                                                      at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2515) 
                                                                                      at android.app.ActivityThread.access$1000(ActivityThread.java:154) 
                                                                                      at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1379) 
                                                                                      at android.os.Handler.dispatchMessage(Handler.java:102) 
                                                                                      at android.os.Looper.loop(Looper.java:157) 
                                                                                      at android.app.ActivityThread.main(ActivityThread.java:5555) 
                                                                                      at java.lang.reflect.Method.invoke(Native Method) 
                                                                                      at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:745) 
                                                                                      at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:635) 

anonym24 avatar Feb 21 '18 22:02 anonym24

Hi, I am also facing the same issue. Can some please guide how to fix this issue.

Thanks Pranav

prscX avatar Feb 23 '18 08:02 prscX

Hi @anonym24, I have got the fix in order to resolve this.

Basically it is trying to look for few color props. After looking to library example looks like we have to define colors.xml in app res with below value:


<?xml version="1.0" encoding="utf-8"?>
<resources>
    <color name="colorPrimary">#3F51B5</color>
    <color name="colorPrimaryDark">#303F9F</color>
    <color name="colorAccent">#FF4081</color>
</resources>

Ideally this should have been defined in README, not sure why they have missed to specify the same.

Thanks Pranav

prscX avatar Feb 23 '18 09:02 prscX

not color.xml.
it should be colors.xml

ZeroCool00 avatar Dec 22 '18 07:12 ZeroCool00

@ZeroCool00: noted. I have changed the same. Thanks

Thanks </ Pranav >

prscX avatar Jan 26 '19 09:01 prscX

@prscX you saved my life, I didnt know what was wrong. That should be added to the readme

NokisDemox avatar Mar 24 '19 12:03 NokisDemox