Android won't copy files
Moderators: FourthWorld, heatherlaine, Klaus, kevinmiller
Android won't copy files
Hello,
Trying to test deploying to Android... and everything works (yay!) except for copying files to the app.
In the "Standalone Application Settings" page, I've put a file that I want to have copied. I've got code that reads the file, and puts it into a field.
This works fine on iOS, but fails on Android, both in the emulator and on my Android phone.
As near as I can tell, I've got everything installed and set up properly.
Thanks for any help!
Trying to test deploying to Android... and everything works (yay!) except for copying files to the app.
In the "Standalone Application Settings" page, I've put a file that I want to have copied. I've got code that reads the file, and puts it into a field.
This works fine on iOS, but fails on Android, both in the emulator and on my Android phone.
As near as I can tell, I've got everything installed and set up properly.
Thanks for any help!
Re: Android won't copy files
What file path are you using? Files included in the app are in:
specialFolderpath("engine")
But you can't write any files there, it is read-only (same as iOS.) You'll need to write copies to specialFolderpath("documents"). That's the only permanent location Android has for app data files.
specialFolderpath("engine")
But you can't write any files there, it is read-only (same as iOS.) You'll need to write copies to specialFolderpath("documents"). That's the only permanent location Android has for app data files.
Jacqueline Landman Gay | jacque at hyperactivesw dot com
HyperActive Software | http://www.hyperactivesw.com
HyperActive Software | http://www.hyperactivesw.com
Re: Android won't copy files
Hi Jacque,
Thanks for the reply... sorry I wasn't clear. Yes, I'm using specialFolderPath("engine") as the directory. I don't want to write files there, I just want some text files and sqlite databases (all read-only) to be copied there, so the app can use them.
I've specified some files in the "Copy Files" pane of the "Standalone Application Settings" dialog; they get copied (and are available to the app) when I run under iOS, but they don't get copied (I asked it to list the files there) and so aren't available under Android.
I'm hoping it's a misconfiguration on my part, otherwise I should probably file a bug report.
Thanks for the reply... sorry I wasn't clear. Yes, I'm using specialFolderPath("engine") as the directory. I don't want to write files there, I just want some text files and sqlite databases (all read-only) to be copied there, so the app can use them.
I've specified some files in the "Copy Files" pane of the "Standalone Application Settings" dialog; they get copied (and are available to the app) when I run under iOS, but they don't get copied (I asked it to list the files there) and so aren't available under Android.
I'm hoping it's a misconfiguration on my part, otherwise I should probably file a bug report.
Re: Android won't copy files
Here's a stack that shows off the behavior I'm seeing... maybe someone can get it working on Android as well as iOS?
THANKS!
THANKS!
- Attachments
-
- ShowFile.zip
- Stack that shows the Android copy failure
- (2.73 KiB) Downloaded 367 times
Re: Android won't copy files
I think it's a bug. I'm getting a list of non-existent files which look like the ones Hanson showed in his conference talk. Your foo.txt file never does show up, though it's listed correctly in the custom property the standalone builder uses. I'd report it. There's no other workaround, the engine has to do the inclusion, so tag the report as major or critical.
Include your sample stack, it does a very good job of showing the problem.
Include your sample stack, it does a very good job of showing the problem.
Jacqueline Landman Gay | jacque at hyperactivesw dot com
HyperActive Software | http://www.hyperactivesw.com
HyperActive Software | http://www.hyperactivesw.com
Re: Android won't copy files
Cool, thanks Jacque. Just out of curiosity (and cluelessness
) what is this Hanson conference talk? Is it available online somewhere?

Re: Android won't copy files
It was one of the presentations at the RevLive Conference last month. The entire conference was videotaped and is available for viewing if you purchase the package (you may still be able to, check the online store. It's well worth it, there is about 40 hours of presentations and instruction there. Best conference they've ever had.) Hanson is one of the engineers at RunRev and he did a presentation on programming artificial intelligence with LiveCode. His artifically intelligent test creatures were fish -- and that goldfish file looks suspiciously like one he was using. The only strange thing is that his presentation wasn't done on mobile, it was a standard LiveCode stack. So all I can figure is that maybe he was testing for mobile and the engine accidentally got compiled with his files in it.yachris wrote:Cool, thanks Jacque. Just out of curiosity (and cluelessness) what is this Hanson conference talk? Is it available online somewhere?
Or maybe I'm entirely off base. Who knows. All I know is that they aren't "foo.txt", that's for sure. You see four odd files in the list too, right? It isn't just my build?
Jacqueline Landman Gay | jacque at hyperactivesw dot com
HyperActive Software | http://www.hyperactivesw.com
HyperActive Software | http://www.hyperactivesw.com
Re: Android won't copy files
Absolutely right. They are:jacque wrote:You see four odd files in the list too, right? It isn't just my build?
- init.rc
init.goldfish.rc
init
default.prop
- /data/app/com.yourcompany.yourapp-1.apk/foo.txt
Re: Android won't copy files
Yeah, same four weird file names. The path shows foo.txt but that's just the string your script constructed, not confirmation the file actually is there. Since the content isn't being read, I suspect it isn't.
Jacqueline Landman Gay | jacque at hyperactivesw dot com
HyperActive Software | http://www.hyperactivesw.com
HyperActive Software | http://www.hyperactivesw.com
Re: Android won't copy files
Okay, submitted as bug #9565.
Re: Android won't copy files
Thanks for putting in the bug report.
I'm kind of curious what's in the goldfish file though.
I'm kind of curious what's in the goldfish file though.

Jacqueline Landman Gay | jacque at hyperactivesw dot com
HyperActive Software | http://www.hyperactivesw.com
HyperActive Software | http://www.hyperactivesw.com
Re: Android won't copy files -- FIXED!
Wow, that was fast! I got a reply today from Mark at RunRev:

Tried the fixes and they work. So kudos to the team, and I learned something today! I'll attach the fixed Stack in case anyone is curious.Hi Chris,
Thanks for the report.
Looking at your stack there are two changes you can make to cause it to work.
The first is in the 'Show files' button. Here, setting the folder to
specialFolderPath("engine") & slash causes the file listing to work properly.
(i.e The Android engine is currently requiring a trailing slash on the engine
folder to make it work - this is unique to the engine folder; other folders
don't require it).
The second is in the 'Show foo.txt' button. Here, you need to "open file ...
for text read" - at the moment you are opening for 'update' which is not
possible as you cannot write to files within the engine folder. (This is
because the engine 'folder' isn't a folder at all; but is actually part of the
APK zip file that is copied to the device / emulator).
We'll look further into both of these issues. The first is definitely a bug;
the second is more something that should be consistent as (from memory) the iOS
app bundle folder is read-only (this might be a difference between iOS
simulator and device though).
Warmest Regards,
Mark.
Yeah, me toojacque wrote:I'm kind of curious what's in the goldfish file though.

- Attachments
-
- ShowFileFixed.zip
- (2.87 KiB) Downloaded 379 times
Re: Android won't copy files
I'm kicking myself for not noticing the "open for update" thing. We all know you can't write to the engine folder, and I knew that a plain "open file" command will open for update, but I didn't put the two together.
I usually just use the "get URL" syntax when grabbing a file's content, which bypasses the issue. Will make a mental note about "open file", which probably I'll forget again by tomorrow...
A toast to goldfish everywhere.
I usually just use the "get URL" syntax when grabbing a file's content, which bypasses the issue. Will make a mental note about "open file", which probably I'll forget again by tomorrow...
A toast to goldfish everywhere.
Jacqueline Landman Gay | jacque at hyperactivesw dot com
HyperActive Software | http://www.hyperactivesw.com
HyperActive Software | http://www.hyperactivesw.com
Re: Android won't copy files
Wow, did this thread cut to the chase! Thanks! I spent a lot of time trying to find out if my file, entered into "Copy Files" in the standalone settings configuration was actually going to the device. Then, the "ShowFileFixed.zip" app, when loaded on my Android, showed that the my file was actually on the device under specialFolder("Engine"). I had written a similar utility to examine the Engine and the Documents folders, and came up with nothing until I learned about the slash needed behind specialFolder("Engine").
However...so near, yet so far. My file is called "Stairs.wmv," and I want to play it on my Android through LC. It plays from the gallery when uploaded manually, so I'm pretty sure the Android video mechanism will play a ".wmv" video.
The video plays in the Windows authoring environment with the following, where the .wmv file is in the same directory as the LC file:
set the filename of "Player 1" to "Stairs.wmv"
play player "Player 1"
However, I haven't found any variation on the following that will work, although it appears that the .wmv file exists under specialFolder("Engine"):
set the filename of "Player 1" to "Stairs.wmv", or set the filename of "player 1 to specialFolder("Engine") & "/Stairs.wmv", or set the filename of "player 1" to specialFolder("Engine") & slash & "Stairs.wmv".
I will continue to try to hammer this out, but it would be great if someone could apply the magic touch to this problem.
BTW - I found the following in Wikipedia about the Android Goldfish:
"Goldfish
Android SDK isn't targeted for a special (ARM) SoC. Instead, they use QEMU to create a virtual ARM SoC called Goldfish. The virtual ARM SoC boots an (currently 2.6.23, m5-rc14) ARM Linux kernel with Goldfish platform support on your (x86) Windows, MacOS X or Linux host."
Sounds like a shark rather than a goldfish. Maybe some of you folks are eqiupped to probe into this, but I'll just be satisfied to play my video file.
Cheers - Gene
However...so near, yet so far. My file is called "Stairs.wmv," and I want to play it on my Android through LC. It plays from the gallery when uploaded manually, so I'm pretty sure the Android video mechanism will play a ".wmv" video.
The video plays in the Windows authoring environment with the following, where the .wmv file is in the same directory as the LC file:
set the filename of "Player 1" to "Stairs.wmv"
play player "Player 1"
However, I haven't found any variation on the following that will work, although it appears that the .wmv file exists under specialFolder("Engine"):
set the filename of "Player 1" to "Stairs.wmv", or set the filename of "player 1 to specialFolder("Engine") & "/Stairs.wmv", or set the filename of "player 1" to specialFolder("Engine") & slash & "Stairs.wmv".
I will continue to try to hammer this out, but it would be great if someone could apply the magic touch to this problem.
BTW - I found the following in Wikipedia about the Android Goldfish:
"Goldfish
Android SDK isn't targeted for a special (ARM) SoC. Instead, they use QEMU to create a virtual ARM SoC called Goldfish. The virtual ARM SoC boots an (currently 2.6.23, m5-rc14) ARM Linux kernel with Goldfish platform support on your (x86) Windows, MacOS X or Linux host."
Sounds like a shark rather than a goldfish. Maybe some of you folks are eqiupped to probe into this, but I'll just be satisfied to play my video file.
Cheers - Gene
Re: Android won't copy files
Hi Gene,
from the Android release notes:
so you code would be
not tested since I dont have the Android SDK, according to the documentation this works the same as in iOS. There it works.
also have a look at 'the sound' and 'play empty' in the release notes.
Kind regards
Bernd
from the Android release notes:
p 21-22play soundFile [ looping ]
so you code would be
Code: Select all
put thePathToMySoundfile into tSoundPath
play tSoundPath
also have a look at 'the sound' and 'play empty' in the release notes.
Kind regards
Bernd