Does Android support copy file larger then 2Mb

pluton

Active Member
Licensed User
Longtime User
I have a problem with one app.

I have a litlle .apk inside my .apk (application). Don't ask me why because one user want that way :confused:

Ok
This code works fine with info.apk (100 Kb)

B4X:
If File.Exists(File.DirAssets,"info.apk") Then
File.Copy(File.DirAssets, "info.apk", File.DirDefaultExternal,"info.apk")
End If

But when I put a diffrent .apk (studio.apk - 3 Mb) the app stops working and debuger says:

Last Exception: java.io.IOException :BangHead: :BangHead:

Is there any way to copy larger files to sdcard or some storage to install that stupid .apk or I must say to user to download from internet and then install :BangHead: :BangHead:
 

NJDude

Expert
Licensed User
Longtime User
Try changing the extension from .apk to . jpg (I know it doesn't make sense but it's a workaround), so, your code should look like this:
B4X:
If File.Exists(File.DirAssets,"info.jpg") Then
File.Copy(File.DirAssets, "info.jpg", File.DirDefaultExternal,"info.apk")
End If

Give that a shot.
 
Upvote 0

pluton

Active Member
Licensed User
Longtime User
Ok
Sure I will try. That problem keeping me busy half a day.

I tell you if it worked

Sent from my LG-P500

EDIT:

Yes. It works if I rename extension. Thanks for tip ;)
 
Last edited:
Upvote 0
Top