Page 1 of 1
					
				Problem with Android Standalone Application
				Posted: Tue May 12, 2020 2:29 pm
				by MarkoSato
				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
			 
			
					
				Re: Problem with Android Standalone Application
				Posted: Tue May 12, 2020 3:09 pm
				by MarkoSato
				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 

 
			 
			
					
				Re: Problem with Android Standalone Application
				Posted: Tue May 12, 2020 3:25 pm
				by LiveCode_Panos
				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
--
 
			 
			
					
				Re: Problem with Android Standalone Application
				Posted: Tue May 12, 2020 7:38 pm
				by MarkoSato
				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
			 
			
					
				Re: Problem with Android Standalone Application
				Posted: Wed May 13, 2020 1:44 pm
				by LiveCode_Panos
				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
--
			 
			
					
				Re: Problem with Android Standalone Application
				Posted: Wed May 27, 2020 11:14 am
				by MarkoSato
				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
			 
			
					
				Re: Problem with Android Standalone Application
				Posted: Wed May 27, 2020 11:25 am
				by Klaus
				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. 
 
Best
Klaus
 
			 
			
					
				Re: Problem with Android Standalone Application
				Posted: Wed May 27, 2020 4:34 pm
				by jacque
				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.
 
			 
			
					
				Re: Problem with Android Standalone Application
				Posted: Wed May 27, 2020 4:41 pm
				by SparkOut
				Is the "play" command supported on Android? What if you use mobilePlaySoundOnChannel instead?
			 
			
					
				Re: Problem with Android Standalone Application
				Posted: Wed May 27, 2020 5:22 pm
				by jacque
				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.
 
			 
			
					
				Re: Problem with Android Standalone Application
				Posted: Wed May 27, 2020 7:05 pm
				by MarkoSato
				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
 
			 
			
					
				Re: Problem with Android Standalone Application
				Posted: Wed May 27, 2020 7:10 pm
				by Klaus
				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
 
			 
			
					
				Re: Problem with Android Standalone Application
				Posted: Thu May 28, 2020 3:36 pm
				by MarkoSato
				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
			 
			
					
				Re: Problem with Android Standalone Application
				Posted: Wed Jan 11, 2023 2:36 am
				by vcirilli
				.... ) & "/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
			 
			
					
				Re: Problem with Android Standalone Application
				Posted: Wed Jan 11, 2023 10:15 am
				by Klaus
				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