Error when copying to File.DirDefaultExternal

CidTek

Active Member
Licensed User
Longtime User
I get an error when installing a file to SD storage executing this line. It worked since day one and now it just pops the error in the screenshot.

File.Copy(File.DirAssets,"grt.db",File.DirDefaultExternal,"grt.db")
 

Attachments

  • Clipboard01.jpg
    Clipboard01.jpg
    18.4 KB · Views: 352

Merlot2309

Active Member
Licensed User
Longtime User
Spended quite some time (I'm slowwwww, ha, ha) why SQL commands in the .apk didn't function. Got it working via the link that CidTek gave.

Just now I installed B4A v1.2, removed the android_metadata table, etc.
and it's working like a charm with the new SQL lib.

Thank you Erel!

Helen.

Ps. I love the B4A HelpViewer.
 
Upvote 0

touchsquid

Active Member
Licensed User
Longtime User
Same problem

I have downloaded and installed the latest SQL library.

I have the issue where it crashes (but only on the real device). The emulator works fine.


Sub LoadDB

Try
File.Copy(File.DirAssets,"squid.db",File.DirInternal,"squid.db")
If SQL1.IsInitialized = False Then
SQL1.Initialize(File.DirInternal, "squid.db", False)
End If
Catch
File.Copy(File.DirAssets,"squid.db",File.DirDefaultExternal,"squid.db")
If SQL1.IsInitialized = False Then
SQL1.Initialize(File.DirDefaultExternal, "squid.db", False)
End If
End Try

End Sub

This code Falls out of the Try block, then crashes on the copy which goes to the SD card. There is plenty of disk space, but the database is about 20MB.

The project has another, much smaller database which works fine. Both were created outside the Android environment. Any ideas?
 
Upvote 0

touchsquid

Active Member
Licensed User
Longtime User
I figured it out. This one was caused by the database being too large to uncompress.

Dealing with Asset Compression in Android Apps

So, I renamed it with the extension rtttl which is in the list of files which do not get compressed.

The amusing/annoying thing is it now works perfectly on the real device (7" android 2.2 tablet) but fails to load on the emulator.

Does anyone know how to give the emulator more internal storage?
 
Last edited:
Upvote 0

touchsquid

Active Member
Licensed User
Longtime User
I figured out how to make an emulator with 150 MB "hard disk" BUT the large APK with uncompressed database still will not load. It times out every time. The logfile shows nothing. I tried a couple of smaller apps and they load and run fine. I need to get this working as the real device is not convenient (I don't have USB drivers for it so I put the APK on a website and download it. It works, but too slow for debugging.

Help!
 
Upvote 0

touchsquid

Active Member
Licensed User
Longtime User
Again found a solution.

The file extension .rtttl I used on my database does not work. However if I use the extension .jet it works fine. This only affects the emulator, both work in the actual device.
 
Upvote 0

touchsquid

Active Member
Licensed User
Longtime User
A Red Herring. It worked one time only, failed the next. I tried uninstalling the app that worked to free space, but it did not help. The time it worked it took 51 seconds to load. I'm guessing the timeout is the problem. Is there any way to increase this?
 
Upvote 0

RomansUP

Member
Licensed User
Longtime User
Hi, Erel
I use 1.70 version of Basic4android and SQL library 1.02. But I have got the same error now. I think the problem returned back after a while but nobody catched it. I tried to use SQL Library 1.01 - The same Error with files of SQL DB which are more then 1Mb. How can I solve the problem without any additional Tables in my DB files?
 
Last edited:
Upvote 0
Top