Problem with Android Standalone Application

Got a LiveCode personal license? Are you a beginner, hobbyist or educator that's new to LiveCode? This forum is the place to go for help getting started. Welcome!

Moderators: FourthWorld, heatherlaine, Klaus, kevinmiller

Post Reply
MarkoSato
Posts: 38
Joined: Fri Apr 22, 2016 7:55 am

Problem with Android Standalone Application

Post by MarkoSato » Tue May 12, 2020 2:29 pm

Hello,

i have a little program and wanted to test in on my android phone so i tried to make the apk but i get this error message: "There was an error while while saving the standalone application could not compile application class". i also attached a screenshot of my standalone settings

There is no problem with the mac and windows Standalone Application tho.

i hope some can help me

best regards,
Mark
Attachments
stndalnSetting.png
error.png

MarkoSato
Posts: 38
Joined: Fri Apr 22, 2016 7:55 am

Re: Problem with Android Standalone Application

Post by MarkoSato » Tue May 12, 2020 3:09 pm

i am using live code community 8 (rc1) and i installed the android studio and installed the android sdk 4.0.3 (i guess you need this for LC 8?).
If i try to set the preferences in mobile support and choose the android/sdk path it gives me an error.

Note: I used this version 3-4 years ago and at this time i could make an android apk but it's been quite a while and i don't really remember what i did. And now i don't know what to do :oops:
Attachments
err.png

LiveCode_Panos
Livecode Staff Member
Livecode Staff Member
Posts: 861
Joined: Fri Feb 06, 2015 4:03 pm

Re: Problem with Android Standalone Application

Post by LiveCode_Panos » Tue May 12, 2020 3:25 pm

Hello MarkoSato,

There are lots of newer LiveCode versions, I would suggest you download the latest (9.6 RC-1, released yesterday):

https://downloads.livecode.com/livecode/

Your android sdk tools are probably out of date, so I would suggest you have a look at this lesson, for installing Android Studio:

http://lessons.livecode.com/m/2571/l/62 ... oid-studio

Kind regards,
Panos
--

MarkoSato
Posts: 38
Joined: Fri Apr 22, 2016 7:55 am

Re: Problem with Android Standalone Application

Post by MarkoSato » Tue May 12, 2020 7:38 pm

Hey,

thanks for the reply.
So now i installed LC 9.5.1 stable because i read that the stable versions are better.
Then i reinstalled Java JDK 8u251, installed android studio and choose sdks 9.0 and now if i choose the path in the preferences it actually worked.
But now i get another error message if try to "save as a standalone Applikation":

hope you can help me again

Kind Regards,
Marko
Attachments
errr.png
errr.png (18.67 KiB) Viewed 8546 times

LiveCode_Panos
Livecode Staff Member
Livecode Staff Member
Posts: 861
Joined: Fri Feb 06, 2015 4:03 pm

Re: Problem with Android Standalone Application

Post by LiveCode_Panos » Wed May 13, 2020 1:44 pm

Hello MarkoSato,

A rough guess is that you have more Java versions installed in your system, so LC does not use version8 as it should.

What do you see in this folder:

/Library/Java/JavaVirtualMachines/ ?

Kind regards,
Panos
--

MarkoSato
Posts: 38
Joined: Fri Apr 22, 2016 7:55 am

Re: Problem with Android Standalone Application

Post by MarkoSato » Wed May 27, 2020 11:14 am

hello,

sry for the late reply.Yes that was the problem, i had more than 1 version, i deleted all, reinstalled now it works.
Now i have the problem that i don't have sound in my mobile application.
I copied files ind the standalone application in the folder "Sound" that i made and in the script i have this code:
"play (specialfolderpath("resources") & "/Sound/levelclick.wav")".
Do i have to do something else or something different?

PS: i also found a very interesting problem.
i have a background image which is on the whole screen of the program. Now if i click on a textfield, on mobile the keyboard opens. For some reason i cannot click anywhere else (the background) so that the keyboard should disappear again. I tried another card with the same constellation without the background image and the problem was solved. So why is it, if I have a background image i cannot click away from my textfield, so the user is stuck on this textfield? With this problem i can't really use my application on mobile. Thanks for the help

Kind Regards
Marko

Klaus
Posts: 14177
Joined: Sat Apr 08, 2006 8:41 am
Contact:

Re: Problem with Android Standalone Application

Post by Klaus » Wed May 27, 2020 11:25 am

Hi Marko,

as a workaround, add this script to your backgroundimage to force this behavior:

Code: Select all

on mouseup
  focus on NOTHING
end mouseup

Should make the virtual keyboard go away, at least worth a try. :D


Best

Klaus

jacque
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 7389
Joined: Sat Apr 08, 2006 8:31 pm
Contact:

Re: Problem with Android Standalone Application

Post by jacque » Wed May 27, 2020 4:34 pm

Another way is to disable the image, then taps will go through to the card.

Did you copy the whole sound folder into the Copy Files pane of the standalone settings? If so then the file path is correct. Wav files are supported on Android devices if they have the correct format. Supported formats are here: https://developer.android.com/guide/top ... ia-formats

I have had good luck with mp3 files too.
Jacqueline Landman Gay | jacque at hyperactivesw dot com
HyperActive Software | http://www.hyperactivesw.com

SparkOut
Posts: 2943
Joined: Sun Sep 23, 2007 4:58 pm

Re: Problem with Android Standalone Application

Post by SparkOut » Wed May 27, 2020 4:41 pm

Is the "play" command supported on Android? What if you use mobilePlaySoundOnChannel instead?

jacque
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 7389
Joined: Sat Apr 08, 2006 8:31 pm
Contact:

Re: Problem with Android Standalone Application

Post by jacque » Wed May 27, 2020 5:22 pm

SparkOut wrote:
Wed May 27, 2020 4:41 pm
Is the "play" command supported on Android? What if you use mobilePlaySoundOnChannel instead?
Oh right, good catch. I didn't notice that. Play is supported on mobile but only for a very few formats. I've always used a player control and that works fine.
Jacqueline Landman Gay | jacque at hyperactivesw dot com
HyperActive Software | http://www.hyperactivesw.com

MarkoSato
Posts: 38
Joined: Fri Apr 22, 2016 7:55 am

Re: Problem with Android Standalone Application

Post by MarkoSato » Wed May 27, 2020 7:05 pm

Hey,

thanks, background problem fixed with focus on NOTHING.
Sound works now on mobile but I get an error in LiveCode if i click on the button.

The code i found on the internet and used:

Code: Select all

put specialFolderPath("engine") & "/Sound/levelclick.wav" into tSoundFile
mobilePlaySoundOnChannel tSoundFile, "current", "now"
Error: can't find handler near mobilePlaySoundOnChannel, char1

Klaus
Posts: 14177
Joined: Sat Apr 08, 2006 8:41 am
Contact:

Re: Problem with Android Standalone Application

Post by Klaus » Wed May 27, 2020 7:10 pm

Hi Marko,

you see the error in the IDE, right?
Unfortunately LC will throw an error it if encounters a MOBILE command on the desktop, so you need to do like this:

Code: Select all

...
if the environment = "mobile" then
  put specialFolderPath("resources") & "/Sound/levelclick.wav" into tSoundFile
  mobilePlaySoundOnChannel tSoundFile, "current", "now"
end if
...
Important hint:
On iOS
-> specialfolderpath("engine")
happens to be the same as
-> specialFolderPath("resources")
So in your own interest, please stick with specialFolderPath("resources") on ALL platforms.


Best

Klaus

MarkoSato
Posts: 38
Joined: Fri Apr 22, 2016 7:55 am

Re: Problem with Android Standalone Application

Post by MarkoSato » Thu May 28, 2020 3:36 pm

Hey,

thanks Klaus, I did as you said now it works without problems.

A little question. Is it normal that the sounds are a little bit delayed on mobile?

Kind regards
Marko

vcirilli
Posts: 12
Joined: Sat Sep 03, 2022 7:58 pm

Re: Problem with Android Standalone Application

Post by vcirilli » Wed Jan 11, 2023 2:36 am

.... ) & "/Sound/levelclick.wav".
Is Sound a folder the developer creates or is that a default Android folder where audio is stored?
If the developer creates it, how?

Thanks
Vincent

if the environment = "mobile" then
put specialFolderPath("resources") & "/Sound/levelclick.wav" into tSoundFile
mobilePlaySoundOnChannel tSoundFile, "current", "now"
end if

Klaus
Posts: 14177
Joined: Sat Apr 08, 2006 8:41 am
Contact:

Re: Problem with Android Standalone Application

Post by Klaus » Wed Jan 11, 2023 10:15 am

Hi Vincent,

everything will reside inside of your APP bundle, so you need to create this folder.
However just add your complete "Sound" folder inclusive sounds to your standalone via "Copy files" tab
in the "Standalone Application Setting", then the folder will be present in your runtime!

Please use the CODE tags after pasting your code here. This way the formatting will be preserved
and makes it better readable.

Code: Select all

...
if the environment = "mobile" then
   put specialFolderPath("resources") & "/Sound/levelclick.wav" into tSoundFile
   mobilePlaySoundOnChannel tSoundFile, "current", "now"
end if
...
And there is nothing wrong with creating a new thread instead of using an old one like this. ;-)

Best

Klaus

Post Reply