SapphireSteel Forum
Welcome, Guest. Please login or register.
April 26, 2017, 05:28:35 PM

Login with username, password and session length
Search:     Advanced search
Welcome to the SapphireSteel forum - for discussion of the Sapphire and Amethyst IDEs
4074 Posts in 848 Topics by 708 Members
Latest Member: dcham_inbsys
* Home Help Search Login Register
+  SapphireSteel Forum
|-+  General
| |-+  Amethyst
| | |-+  Deploy to Andriod with Amethyst
« previous next »
Pages: [1] 2 Print
Author Topic: Deploy to Andriod with Amethyst  (Read 9897 times)
Rix
Newbie
*
Posts: 7


« on: March 07, 2013, 04:44:44 AM »

Hi.

I had a long night last night trying to deploy a brand new Amethyst mobile application to Android. Looking at the tutorial it's as simple as creating a new mobile application, run the android emulator and hitting F5. I found this to be anything but the case.

The very first-time running deploy comes up with an exit code 6. Future deploys show an output "1 successful" which is definitely not the case. This was probably my biggest waste of time. There is no apk file generated which I didn't know until now that this will be one of the results from the build-deploy. (For me atleast, the Amethyst Copilier Service always fails the first time with a fatal(0|0|0) and from the 2nd build onwards it works OK so I was assuming the same here with the deploy).

Taking the deploy command output (when it fails the 1st time!)
"C:\ProgramData\SapphireSteel Software\Amethyst 2008\deploy-android.bat" "C:\AdobeAIRSDK\bin\adt.bat" "C:\Android\sdk" apk-debug "C:\Users\leiser-1\Documents\Flash\Decathlon\AndroidDecathlon\RixKey.p12" xxx AndroidDecathlon.apk AndroidDecathlon-app.xml AndroidDecathlon.swf -e "-connect 192.168.2.64" none

There were a few things that I'd got wrong, copying this command line above to bat file helped a lot and then running directly from powershell:
I'd also modified deploy-android.bat slightly to see where things got to:

Code:
@echo off
set PACKAGER=%~1
set SDK=%~2
set TARGET=%~3
set KEYSTORE=%~4
set PASSWORD=%~5
set OUTPUT=%~6
set APP_DESCRIPTOR=%~7
set FILE_OPTIONS=%~8

if "%FILE_OPTIONS%"=="none" set FILE_OPTIONS=
set DEVICE=%~9
shift
set CONNECT=%~9
if "%CONNECT%"=="none" set CONNECT=
shift
set DOWNLOADURL=%~9
if "%DOWNLOADURL%"=="none" set DOWNLOADURL=
set PATH=%PATH%;%SDK%\platform-tools

echo building package %OUTPUT%

echo PACKAGER %PACKAGER%
echo SDK %SDK%
echo TARGET %TARGET%
echo KEYSTORE %KEYSTORE%
echo PASSWORD %PASSWORD%
echo OUTPUT %OUTPUT%
echo APP_DESCRIPTOR %APP_DESCRIPTOR%
echo FILE_OPTIONS %FILE_OPTIONS%
echo CONNECT %CONNECT%
echo DOWNLOADURL %DOWNLOADURL%

call "%PACKAGER%" -package -target %TARGET% %CONNECT% %DOWNLOADURL% -storetype pkcs12 -keystore "%KEYSTORE%" -storepass %PASSWORD% %OUTPUT% %APP_DESCRIPTOR% %FILE_OPTIONS%
pause
if not %errorlevel%==0 goto error

echo downloading into device %DEVICE%
adb start-server
adb %DEVICE% install -r %OUTPUT%
if not %errorlevel%==0 goto error
echo **** Succeeded
pause
exit

:error
echo **** Failed (%errorlevel%) ...

pause
exit




Also running powershell and the ./adb from platform-tools of the android sdk helps.
./adb devices   -> tells you if devices are actually active and their serial number.
./adb logcat     -> helps spy on stuff going on.

1. I had the global options wrong. and instead of C:\AdobeAIRSDK\bin\adt.bat   I had  C:\AdobeAIRSDK\bin\adl.exe
2. Exit Code 6 is due to the 'AndroidDecathlon-app.xml' parameter. I moved this from the "Config" folder up 1 level" to where the rest of the project files are. I believe this is an error with the deploy-android.bat file.
3. I put the name of the device (serial number from ./adb devices) into the project properties.

Lastly installing Air from google play. And bing, finally it worked.

For the first few hoops on the latest Android 4.2.2, I followed this:
http://thepursuitofalife.com/nexus-7-usb-debugging-setup/

Please. Is it possible that the Ouput window should only come back as successful if a full deploy works. The whole she-bang. The creating the apk file would seem like a good major step that should be double checked.
Because not only are you lead down the wrong path but you also get taken away from the deploy-android.bat command in the output window. If there is an error then it should atleast be staring at you.

Also, from my full-blown mobile project, I had a "Bitmap Asset" not found. Adding a reference to core.swc in the flex sdk libs fixed this.
Logged
Dermot
Administrator
Hero Member
*****
Posts: 1068


« Reply #1 on: March 07, 2013, 07:50:30 AM »

which version of Amethyst are you using? 1.6 or 2.0?

Dermot
Logged
Rix
Newbie
*
Posts: 7


« Reply #2 on: March 07, 2013, 08:58:16 AM »

1.6
Logged
Dermot
Administrator
Hero Member
*****
Posts: 1068


« Reply #3 on: March 07, 2013, 04:58:25 PM »

Ok - thanks for the feedback.

We've improved things quite a bit in Amethyst 2 on the mobile/deployment front (hopefully).

The error messages from adt are not great and we've had a lot of trouble trying to get anything other than 'Exit code 1' or whatever out of the thing. The problem with 'deploy succeeded' when it hasn't is that deployment is a bit different from build. Build checks its inputs vs its outputs to see if anything has changed and if anything needs doing. If you deploy, then the target is a machine that build knows nothing about, so you can't do the same thing. However, I think we can make the apk file an output of the Deploy task, which should fix the main problem you had. Not sure about how to deal with iOS .ipa file as opposed to a .apk file - but I'm sure we can figure a way round it.

In Amethyst 2, we don't use a batch file to do the packaging - we run the packaging directly. Hopefully, we fixed any problems that were in the .bat file. The reason we initially chose a .bat file was because we didn't fully understand how the packaging worked (and also Adobe were changing things all the time) so a user editable bat file seemed a good thing. But we've now got much more experience with mobile deployment and we're happier with a more direct approach.

Try Amethyst 2 to see if it works better.

Dermot
Logged
writer1
Newbie
*
Posts: 17


« Reply #4 on: July 05, 2013, 01:56:32 PM »

Hi,

I am exploring using Amethyst 2 and wondered if a successful build of an APK for Android has been done? I am a retired social worker who creates eLearning materials to help people in my community to improve their health, reduce stress.

If yes, I would like to test an Amethyst 2 generated APK in a program (secureSWF http://www.kindi.com/) used to obfuscate the script, make the APK more secure. This helps assure that safety guidelines for its use are not bypassed.

In order to try it, I would need a "Hello World" APK type file. If anyone can post it along with, if possible, the certificate used to create it and the specific SDK version used to generate it (both required by secureSWF to set up, process and secure the APK), then I could test it. If all goes well, there will be no error messages in secureSWF and the secured version of the "Hello World" APK, if side-loaded on my Android device, should play OK.

(Apologies. Ordinarily, I would create the "Hello World" APK myself, but haven't yet put Visual Studio or Amethyst 2 on my computer, nor am I up to speed yet on how to use it, so the fastest way to check if it will work for my projects, is to get a sample file, certificate and specific SDK build, do the test using these. If it doesn't work in secureSWF, no point in installing Visual Studio Shell, Amethyst 2, etc., going further.)

Thank you for your help.

Kind Regards,
« Last Edit: July 05, 2013, 02:33:13 PM by writer1 » Logged

writer1
Dermot
Administrator
Hero Member
*****
Posts: 1068


« Reply #5 on: July 07, 2013, 03:23:59 AM »

I've uploaded one of our test programs to

http://www.sapphiresteel.com/downloads/misc/starling-mobile.zip

This is a Starling demo project and I can download it to my Android Nexus 4 and debug/run it there. You'll have to change the location of the Android SDK and the Flex SDK because they are specific to my machine. It's a moderately complicated program, but it does demonstrate Starling and Amethyst deployment quite well.

Dermot
Logged
writer1
Newbie
*
Posts: 17


« Reply #6 on: July 07, 2013, 06:55:17 AM »

Hi Dermot,

Thank you very much. I tried the APK with secure SWF, and it works. Then tested the secured APK on an Android device. Again, it works. I'm not very skilled at using the certificate/SDK settings in secureSWF, so hopefully this part also worked, but the secureSWF export APK said "secure" so maybe this also worked?

Maybe the next step for me to take to assure that this will be a viable option for my eLearning projects would be to try out a trial version of Amethyst. Hopefully this can be used with VisualStudio 2012 Express edition or (from watching the video) VisualStudio Shell?

If I want to try it further, should I use Express or Shell?

Again, thank you very much for your help.
Logged

writer1
Huw Collingbourne
Administrator
Hero Member
*****
Posts: 947



« Reply #7 on: July 07, 2013, 07:41:52 AM »

Use the Shell. It cannot be installed into VSExpress (that's because Microsoft doesn't permit it) but the Shell is fine.

Best wishes
Huw
Logged
writer1
Newbie
*
Posts: 17


« Reply #8 on: July 07, 2013, 10:08:00 AM »

Hi,

Doing some online research, it appears that in order to develop in one of VS's languages like VB or C#, and benefit from those IDE's, their toolboxes, etc. plus integrate Amethyst, would need to have Full VS installed. Integrated Shell (as opposed to Isolated Shell) cannot be installed side-by-side on the same computer with Express editions, and Intergrated Shell does not appear to have any toolbox components, like buttons to drag/drop into a project. A problem for a novice user like me.

Regards,
« Last Edit: July 07, 2013, 01:04:24 PM by writer1 » Logged

writer1
Dermot
Administrator
Hero Member
*****
Posts: 1068


« Reply #9 on: July 08, 2013, 04:13:52 PM »

The Integrated Shell (the core component of VS) does have the Toolbox, but it's up to the individual packages (i.e. VB, C#, etc) to put things in there. Amethyst does populate the Toolbox, but, like VB and C#, you have to have something that is 'designable'. You will get the Toolbox populated with suitable controls if you have a Flex project or an AIR project or a Flash Forms project. The .mxml file or the .sxml file will have a designer associated with it, and when you switch to design mode, you will see suitable controls in the Toolbox which can then be dragged onto the design surface.

Dermot
Logged
writer1
Newbie
*
Posts: 17


« Reply #10 on: July 08, 2013, 04:42:45 PM »

Hi Dermot,

Yes, I was finally able to figure out the designer interface, tried it out, got a build error, if I recall correctly.

It just may be a stretch for me, given my limited skills. I think it would require me to spend several months learning. Whew!

But, I am familiar enough with quality software to say: Amethyst is top-flight, well-integrated with VS. The coding skills, or lack thereof, are purely me.  Grin

Kind Regards,
Logged

writer1
Huw Collingbourne
Administrator
Hero Member
*****
Posts: 947



« Reply #11 on: July 09, 2013, 02:48:31 AM »

Have you tried our tutorials? Most of these were made for Amethyst 1 but they should all still be relevant to Amethyst 2: http://www.sapphiresteel.com/Tutorials/Amethyst-Tutorials/article/amethyst-tutorials-index

Best wishes
Huw
Logged
writer1
Newbie
*
Posts: 17


« Reply #12 on: July 09, 2013, 05:21:08 AM »

Thank you, Huw.

Quite an impressive list of tutorials!  Smiley
Logged

writer1
san83
Newbie
*
Posts: 13


« Reply #13 on: January 07, 2014, 12:44:39 PM »

Hi! Sorry for bad English.
VS2010, amethyst 2.0.3.1577
Project MobileActionScriptApplication.

1.
When setting the field "Device name"(smsng3) command is generated with the parameter "-s smsng3", it does not correctly put quotation marks.
Code:
"D:\android\adt64\sdk\platform-tools\adb.exe" "-s smsng3" install -r "C:\Projects\MobileActionScriptApplication1.apk"


2.
At initialization file "*.apk" in adb.exe, an error - "Deploy timed out".

Code:
"D:\android\adt64\sdk\platform-tools\adb.exe" -e install -r "C:\Projects\MobileActionScriptApplication1.apk"
process error:Deploy timed out
C:\Program Files (x86)\MSBuild\SapphireSteel Software\Amethyst_2_10.0\Amethyst.targets(361,5): Error : Deploy timed out

Although, if you execute the same command in cmd, the command executes without errors.
Code:
"D:\android\adt64\sdk\platform-tools\adb.exe" -e install -r "C:\Projects\MobileActionScriptApplication1.apk"
61 KB/s (10287047 bytes in 164.615s)
        pkg: /data/local/tmp/MobileActionScriptApplication1.apk
Success

Is it possible to increase the timeout?
Thank you.
Logged
Dermot
Administrator
Hero Member
*****
Posts: 1068


« Reply #14 on: January 07, 2014, 01:40:12 PM »

Hi,

#1: there's currently no way to set a "-s" option on the device. We'll need to fix that - I doesn't look too difficult to do. I think you are right, we just need to quote the string correctly.

#2: the timeout used is the same as the compiler timeout, which is by default 120 seconds. It looks like you are taking 164 seconds, so a timeout occurs. You can increase the timeout by going to Tools | Options | Projects | Amethyst and looking for 'Compiler Timeout".

Try that.

Dermot
Logged
Pages: [1] 2 Print 
« previous next »
Jump to:  

Powered by MySQL Powered by PHP Powered by SMF 1.1.11 | SMF © 2006-2009, Simple Machines LLC Valid XHTML 1.0! Valid CSS!