TaifunFile FileList and FileListAsync methods cause my app to crash [solved]

I'm wondering if anyone else has problems with TaifunFile extension while using the AI Companion associated with this Google Sheets component? My app works fine when connected through AI companion, but when I build an APK, the TaifunFile FileLIst and FileListAsync components cause my app to crash. Error refers to finding length of null array.

this is a known issue, the extension may return null object if no file is found instead of an empty array.
this is already on my to do list to fix...

the question however is, why do you get no files back after building the app? The same method returns some files using the companion app?

It would really help if you provided a screenshot of your relevant blocks including Do it result, so we can see what you are trying to do, and where the problem may be.

To get an image of your blocks, right click in the Blocks Editor and select "Download Blocks as Image". You might want to use an image editor to crop etc. if required. Then post it here in the community.


Trying to push the limits! Snippets, Tutorials and Extensions from Pura Vida Apps by Taifun.

1 Like

The program returns all files when using companion, but crashes when running it as an apk. I'm using a Samsung Galaxy S9 phone with Android 10. Blocks and aia file are attached.

CSVFinder.aia (33.8 KB)

Why are you using empty string instead of dir name/path?

Using an empty block there returns all files from /storage/emulated/0, but everything else from every sub directory as well.

1 Like

This should work even on Android 10 as long as AI2 targets API 29 (targetSdkVersion=29). But you must ask for READ (or WRITE which includes READ) permission:

So try this (you can also use an empty string for the directoryName, as Tim said):

1 Like

See also in the TaifunFile extension description:

1 Like

Thanks Anke, it works! I didn't expect the problem to be with the permissions. Thought Android would ask about permissions if needed. First time I'm using this extension.

Interesting to note that not all csv files are listed with the /storage/emulated/0/ prefix. I have two files that are just listed as Countries.csv and sample.csv.

Thanks also to Taifun for a great extension. I'll try it out for a while and see how it goes.

These files are most likely located in the Private directory (→ Internal Storage) if you have saved them without a slash at the beginning of the fileName (path):


As far as I know it's not possible to list these files with any component or extension at the moment.

See also here:

It is still mystery as to where the files are actually located. Actually it was until I deleted them... So I could see and delete them. Then there is the Android...../trash/.....filename.csv file that also gets listed, but when I want to delete it, it returns file doesn't exist.

I read the link to basics on Android storage system and other topic about nb184 file storage issues. If I understand correctly then this CSVFinder program won't work on Android 11? To fix it I'll need to start using app specific directories?

See here and watch the video:

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.