React-native-document-picker: Android No Activity found to handle

Created on 31 May 2017  路  14Comments  路  Source: rnmods/react-native-document-picker

Hey, just tried using the package but i get a weird error, i checked all the manual installing and it is all correct. Im trying to when the user opens the 'page' it will appear the picker after 200 milisec but it gets this error or sometimes the App closes:

screenshot_2017-05-31-15-53-49-097_com goofyapp 1

This is what i wrote:

const DocumentPicker = require('react-native').NativeModules.RNDocumentPicker;

componentDidMount(){
this.timeoutHandle = setTimeout(() => { DocumentPicker.show({ filetype: ['public.image'], },(error,url) => { alert(url); }); }, 200);
}

Most helpful comment

I've had same error (though only visible in Android monitor logs in Android Studio, no red screen) and found out that filetype values for Android should be MIME types (e.g. */* for all files or image/* for all images). So you should detect current platform and choose filetype from some map accordingly (e.g. image/* for Android and public.image for iOS).

@Elyx0 could you add this to readme?

All 14 comments

I've had same error (though only visible in Android monitor logs in Android Studio, no red screen) and found out that filetype values for Android should be MIME types (e.g. */* for all files or image/* for all images). So you should detect current platform and choose filetype from some map accordingly (e.g. image/* for Android and public.image for iOS).

@Elyx0 could you add this to readme?

Yep, thanks I need to get a Wiki / Common Errors page rolling!

@ivankashtanov It worked, thanks!

@Elyx0 it worked now but when i click a file how I can save the URL? it should got the Alert of the URL when i click right? it does nothing

@bmoreira10 What is in the error arg?

@Elyx0 alert(url), i copied the example the package has just to test it out

DocumentPicker.show({
      filetype: ['public.image'],
    },(error,url) => {
     if (error) return console.log(error);  // You should verify that there is no error first
      alert(url);
    });

I really need to update the readme I thought this was obvious

@Elyx0 nothing happens , i clicked a file and it just goes back to the App and on the console theres nothing

DocumentPicker.show({
      filetype: ['*/*'],
    },(error,url) => {
     if (error) return console.log(error);  // You should verify that there is no error first
      alert(url);
    });

Sadly I didn't write that part so I wouldn't know more. I think you would have to dig deeper into this and look at

You can try it out by editing it from your node_modules I hope you'll find something!

If anyone fixing this can submit an Android PR quite soon that would save a lot of users! (this has 800DL / month)

Not sure if that's the right workaround but I've used setTimeout after receiving file info from picker before doing anything with it as recommended in one of readme examples.
I've also used Alert component from react-native to show alert dialog, not just JS alert.

@ivankashtanov this kinda got me to get it right, i didn't need the timeout tho the alert is not working , i tried Alert.alert it gave me the error of getting object and not a string so I just did console.log(url) and it worked! Kinda silly that I didn't try this lol my bad

I'm reopening this because people often forget to check for closed issues when searching for their problem. I'm keeping this open until it's clearly stated in either the README or a PR.

I still have encountered this issue on my app and I've made a PR to solve this problem https://github.com/Elyx0/react-native-document-picker/pull/131

Was this page helpful?
0 / 5 - 0 ratings