Android Question Access to directory fails when compiles for release

blakemail

Member
I'm new to B4A. I have been trying it out by writing an app to replace one I wrote in VB6. It's been fun playing with B4A. My app works great in debug mode, but when I compile for release then run it the app throws an error when it tries to access the same directory.

The code failing:

songlist=File.ListFiles("/storage/extSdCard/lscpr/music")

I'm planning to get the full version if I can get my app to work. Is this a limitation of the free version?

TIA

Mike
 

DonManfred

Expert
Licensed User
Longtime User
Upvote 0

RandomCoder

Well-Known Member
Licensed User
Longtime User
And what @DonManfred forgot to do was welcome you to the forum, I see this is your first post.
With any type of fault it is always good to include the actual fault message or copy and paste the log.
If you are able to share your code then the best way to get help is to zip your project and upload it.

Regards,
RandomCoder
 
Upvote 0

blakemail

Member
Duh@me the error message would help.

Error Occurred
An error has occurred in sub:
java.io.IOException:/storage/extSdCard/lscpr/music is not a folder.
Continue?

and it offers a yes and no button.

/storage/extSdCard/lscpr/music is a folder according to the file browser on my android device. And when I run the same app but in debug mode the folder is found and the assignment to the list works. I can even play the songs.

I'm sure I'm doing something wrong.
 
Upvote 0

blakemail

Member
I'll check again, but I think File.DirRootExternal returned the emulated storage which is actually internal versus the actual SD card. This is for a Galaxy Tab 3 running android 4.4.2.

Assuming I can't use File.DirRootExternal is there a workaround to make this work. It's frustrating that it works in debug mode but not in release mode. Makes me think there is something else that needs to be deployed.
 
Upvote 0

blakemail

Member
Well this is interesting. I added Msgbox(File.DirDefaultExternal,"2") and after it prompts me and I hit ok the program works like it does in debug mode. I guess there is something wonky about File.DirDefaultExternal on the Galaxy Tab 3. At lease I know it will work.
 
Upvote 0

blakemail

Member
OK I used File.DirDefaultExternal in an assignment (dummy=File.DirDefaultExternal) and that fixed my issue as well. Easy fix for a nagging problem.
 
Upvote 0

Erel

B4X founder
Staff member
Licensed User
Longtime User
Upvote 0
Top