Android Question I'm Stuck! DirInternal Working on Phone, Not Tablet

Shadow&Max

Active Member
Licensed User
Longtime User
Please note: I've since discovered that it's not the DirInternal issue that's causing this, but instead, accessing the layout files after installation on the tablet. See below for the error log etc.

I'm really stuck. I'm using Erel's KeyValueStore class for a small, persistent database. For two months I've been developing this app and am getting ready to send it out to testers. Up until now, I've been using emulators (Genymotion & AVD stuff) as well as my Moto-X phone, and everything was working properly.

I purchased a cheapie tablet to test, just to be sure, and it's not working at all. The Phone doesn't have an SD card, and neither of course do the emulators.

When I run this on the tablet, which DOES have an SD card, the app immediately dies as I'm calling the KeyValueStore with File.DirInternal in one of the first steps. (After further investigation, it's not that call to DirInternal that's failing, but instead trying to open the bal files)

On the tablet, it's erroring out on the open, saying it cannot find the file on the SD card. I'm not trying to use the SD card. I want to avoid the SD card cause it could be removed and then my data is gone.

Am I accessing the wrong dir??? I only access two in the entire app... File.DirAssets for the icons etc., and File.DirInternal for everything else.

How can I get past this? Until I solve this, I can't release this app, and I really NEED to release this app.

Any help would be appreciated.
 
Last edited:

Shadow&Max

Active Member
Licensed User
Longtime User
Nope Margaret... Thanks... wish it were that! When I went into project files... ALL of them. They were all in lower case, except for the main bas files in the main project folder. I renamed those all to only lower case, opened it up in the IDE, ran it Debug(rapid) to the tablet, and it immediately died... "Unfortunately, --- has stopped working"

Connected to B4A-Bridge (Wifi)
sending message to waiting queue (CallSubDelayed - UpdateStatus)
Installing file.
PackageAdded: package:com.twodogapps.gaa
Copying updated assets files (47)
java.lang.RuntimeException: java.io.FileNotFoundException: /mnt/sdcard/Android/data/com.twodogapps.gaa/files/virtual_assets/about.bal: open failed: ENOENT (No such file or directory)
at anywheresoftware.b4a.shell.Shell.virtualAssets(Shell.java:159)
at anywheresoftware.b4a.shell.Shell.start(Shell.java:91)
at anywheresoftware.b4a.ShellBA.raiseEvent2(ShellBA.java:76)
at com.twodogapps.gaa.main.afterFirstLayout(main.java:90)
at com.twodogapps.gaa.main.access$100(main.java:16)
at com.twodogapps.gaa.main$WaitForLayout.run(main.java:76)
at android.os.Handler.handleCallback(Handler.java:615)
at android.os.Handler.dispatchMessage(Handler.java:92)
at android.os.Looper.loop(Looper.java:137)
at android.app.ActivityThread.main(ActivityThread.java:4745)
at java.lang.reflect.Method.invokeNative(Native Method)
at java.lang.reflect.Method.invoke(Method.java:511)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:786)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:553)
at dalvik.system.NativeStart.main(Native Method)
Caused by: java.io.FileNotFoundException: /mnt/sdcard/Android/data/com.twodogapps.gaa/files/virtual_assets/about.bal: open failed: ENOENT (No such file or directory)
at libcore.io.IoBridge.open(IoBridge.java:416)
at java.io.FileOutputStream.<init>(FileOutputStream.java:88)
at anywheresoftware.b4a.objects.streams.File.OpenOutput(File.java:370)
at anywheresoftware.b4a.shell.Shell.virtualAssets(Shell.java:146)
... 14 more
Caused by: libcore.io.ErrnoException: open failed: ENOENT (No such file or directory)
at libcore.io.Posix.open(Native Method)
at libcore.io.BlockGuardOs.open(BlockGuardOs.java:110)
at libcore.io.IoBridge.open(IoBridge.java:400)
... 17 more
 
Upvote 0

eps

Expert
Licensed User
Longtime User
If you run this in debug does it give any more information?

Oops, sorry just seen that you ran it in debug rapid..

Maybe try Debug Legacy? I seem to always have issues with debug rapid.
 
Upvote 0

margret

Well-Known Member
Licensed User
Longtime User
Have you tried to do a Clean Project under the tools menu. Also, look in the right side of the IDE in the files tab. If any of the names are not lower case only, you will have to remove them and re-add them to the files tab. Also, make sure when you remove them, do not delete them.

All files in the files tab should all be lower case as well.
 
Upvote 0

Shadow&Max

Active Member
Licensed User
Longtime User
Yep, it does in release mode!!! 100% as far as I can tell so far! Well, that's a relief... but still tough without debugging on the device...

Good call BTW...
 
Upvote 0

Shadow&Max

Active Member
Licensed User
Longtime User
Margaret: Thanks! Love your work BTW... Cleaning project does nothing, and the names in the IDE did not change... in the second run, there was no files to delete...

Moto: Didn't try legacy... Could... maybe that's it... will try in a minute...

Desolate: Great call... but awfully strange why...I mean, I'd understand that if the devices were 3 or earlier but... Still, it's a CHEAP tablet...
 
Upvote 0

Shadow&Max

Active Member
Licensed User
Longtime User
Hi all... Thanks Erel... That worked. Why did it work???

Where are the virtual assets stored?
 
Last edited:
Upvote 0

Shadow&Max

Active Member
Licensed User
Longtime User
OK, thanks... works with it off. That addition only applies to debugging so it won't affect the release version, right???
 
Upvote 0

Shadow&Max

Active Member
Licensed User
Longtime User
Thanks Erel...
 
Upvote 0
Top