61,500

Views

Beginner

Level

31

Comments

Getting Started with Android

by Jon (Updated on 2015-10-23)


Contents

  • Requirements
  • Is there an Android "simulator"?
  • Walkthrough
    • Step 1: Set up your Device
    • Step 2: Install the Java JDK
    • Step 3: Install the Rest
    • Step 4: Test on Device
  • Troubleshooting
  • FAQ

System Requirements

To test and publish to Android, you need the following.

  • An Android device with Gingerbread (2.3) or better (4.0 or better strongly recommended)
  • A USB cable to connect your device to your computer
  • Java Development Kit 1.6 (JDK 1.6) or later

The rest of the software requirements are fetched by Stencyl directly from Google's servers.

Is there an Android "simulator"?

No emulator or simulator is available for testing Android games on your computer.

If you don’t have an Android device, we recommend picking up a cheap one, such as a Moto E or Moto G. We do not recommend purchasing off-brand devices since you may be unable to test your games on them

Step 1: Set up your Device

If you haven’t tested apps on your device before, you’ll need to do a few things to it before you begin.

Install a USB Driver

For some devices, especially those made by Samsung, a USB driver (called an OEM USB Driver) has to be installed for your PC/Mac to recognize your device.

Google maintains a page that lists all of these devices out.

Turn on USB Debugging

USB Debugging must be enabled, otherwise your device will be unable to communicate with your computer. The location of this option varies depending on what version of Android and what device you have.

Do a Google search for USB debugging [YOUR_DEVICE_HERE]

Turn on USB Mass Storage

If you don't turn off USB Mass Storage, your device will be treated like a USB flash drive, rather than a proper Android device. Again, the location of this option varies depending on what version of Android and what device you have.

One trick that sometimes works is to plug your device in - if you're lucky, your device will ask you whether you want to Turn off USB Mass Storage.

Do a Google search for USB Mass Storage [YOUR_DEVICE_HERE]

Step 2: Install the Java JDK

Android requires the Java JDK (Java Development Kit), version 1.6 or later, in order to build and sign apps. You must install this on your own, although Stencyl will make a best effort to flag this if you don’t have it installed.

Step 3: Install the Rest

The rest of the requirements (the Android SDK) are automatically downloaded by Stencyl. This is triggered when you attempt to run an Android app for the first time.

  • Plug in your Android device to your computer. Turn it on (or take out of sleep mode).
  • Switch the Platform dropdown's value to Android.
  • Click Test Game.

If all goes well, you'll see Stencyl download all of the required packages. This takes a while due to the large file sizes.

Step 4: Test on your Device

After the Android packages finish downloading, Stencyl may ask you to reboot. If it requests that, do that, reopen the game and then run the game again.

  • Plug in your Android device to your computer. Turn it on (or take out of sleep mode).
  • Switch the Platform dropdown's value to Android.
  • Click Test Game.

If all goes well, your game will build for a while and then finally launch the app directly on your device.

Tip: Monitor the Log Viewer (View > Log Viewer) to track the progress of your game's build. The first build will take some time depending on how fast your computer is.

Troubleshooting

While downloading the Android SDK in Step 3, the download stops. None of my apps run - how can I reset the installation process?

Go to the following location in the main menu: Debug > Android > Reinstall Android SDK

My game doesn't launch on my device. It gets stuck at "Sending to Device"

The good news is that if you get this far, it's out of Stencyl's hands - the Android SDK is in control at this point. Failure to launch usuall indicates a hardware / operating system issue. Here are some common causes.

  • Make sure the device is plugged in.
  • Make sure the device is turned on (not asleep).
  • Enable USB Debugging on the device.
  • Turn off USB Mass Storage.
  • Install the driver for your device. See: http://developer.android.com/tools/extras/oem-usb.html
  • Unplug and replug the USB cable, particularly if your computer or the device went to sleep.

If you continue to have issues, view our forum discussion for additional ideas.

My game crashes immediately on the device.

  • Create a blank, one-scene game and run that on your device. If this crashes too, ask for help on the forums.
  • If that blank games works fine, run your game on the Windows/Mac/Linux target and see if it crashes there.
  • If it crashes, try one last time on Flash. If it crashes, you are (relatively) lucky since you now have logs that are readable. Ask for help on the forums.

My game crashes immediately on a Samsung Galaxy (anything recent)

Enable 3x scale for your game since the flagship Galaxy line requires this scale. This change has to be done in two places.

  • Settings > Settings > Advanced > Project Scales
  • Settings > Mobile > Display > Scales

FAQ

Can I use an existing / external install of the Android SDK?

Not at this time. We'd like to support this in the future.

How do I view the official device logs outside of Stencyl?

Use Device Monitor, which can be launched from Stencyl (under Debug > Android > Launch Device Monitor).

What version of the Android SDK does Stencyl use?

As of late 2015, we're up to API Level 22 (Lollipop).

Print Article Edit Article How to Edit an Article
Disclaimer: Use comments to provide feedback and point out issues with the article (typo, wrong info, etc.). If you're seeking help for your game, please ask a question on the forums. Thanks!

31 Comments

Spaceboy Ross
To install a newer version of the android sdk, just remove the folder in your user's folder with this path ~/stencylworks/android-sdk/android- sdk-(your os)/ and replace it with the android sdk folder
0 1 week, 3 days ago
ODIronE
@Maruda the Title is wrong.

"Turn on USB Mass Storage
If you don't turn off USB Mass Storage,... "

0 3 months, 6 days ago
Maruda
Step 1:

Turn on USB Mass Storage

Troubleshooting

Turn off USB Mass Storage.

Sooo ?

1 4 months, 1 week ago
supratim26
after working hard on trying to fix the issue with testing on android, and posting the question in forum, to which I didnt get any such replies that can help me debug the code, finally i found a way-around to solve the problem.
after you click on test game and the processing gets stuck at sending to device, search for gamename debug.apk.
once you get that apk file, copy it manually to your android mobile and run it from there.

i seriously hope there is some proper guidance by stencyl community on debugging those complicated android sdk related errors.

0 1 year, 1 week ago
supratim26
Hello,
I am not able to test a scene that I built, in my android phone. My phone is lava iris x1. I have installed android sdk and updated java. i have read the guidelines and set the usb debugging mode on, and set the connection of my phone as MTP. when i am clicking on test game, its saving , compiling and then getting stuck at sending to device for ages. I am getting the following log msg....


jar:file:/C:/Program Files (x86)/Stencyl/sw.jar!/res/logview4j /images/info.gif false INFO 1452446728490000834 stencyl.sw.util.StreamGobbler [haxelib.exe] --------- beginning of /dev/log/main
jar:file:/C:/Program Files (x86)/Stencyl/sw.jar!/res/logview4j /images/info.gif false INFO 1452446727616000829 stencyl.sw.util.StreamGobbler [haxelib.exe] Running command: TRACE
jar:file:/C:/Program Files (x86)/Stencyl/sw.jar!/res/logview4j /images/info.gif false INFO 1452446727616000828 stencyl.sw.util.StreamGobbler [haxelib.exe] at dalvik.system.NativeStart.main(Nati ve Method)
jar:file:/C:/Program Files (x86)/Stencyl/sw.jar!/res/logview4j /images/info.gif false INFO 1452446727616000827 stencyl.sw.util.StreamGobbler [haxelib.exe] at com.android.internal.os.RuntimeInit .main(RuntimeInit.java:337)
jar:file:/C:/Program Files (x86)/Stencyl/sw.jar!/res/logview4j /images/info.gif false INFO 1452446727616000826 stencyl.sw.util.StreamGobbler [haxelib.exe] at com.android.internal.os.RuntimeInit .nativeFinishInit(Native Method)
jar:file:/C:/Program Files (x86)/Stencyl/sw.jar!/res/logview4j /images/info.gif false INFO 1452446727616000825 stencyl.sw.util.StreamGobbler [haxelib.exe] at com.android.commands.am.Am.main(Am. java:76)
jar:file:/C:/Program Files (x86)/Stencyl/sw.jar!/res/logview4j /images/info.gif false INFO 1452446727616000824 stencyl.sw.util.StreamGobbler [haxelib.exe] at com.android.internal.os.BaseCommand .run(BaseCommand.java:47)
jar:file:/C:/Program Files (x86)/Stencyl/sw.jar!/res/logview4j /images/info.gif false INFO 1452446727616000823 stencyl.sw.util.StreamGobbler [haxelib.exe] at com.android.commands.am.Am.onRun(Am .java:264)
jar:file:/C:/Program Files (x86)/Stencyl/sw.jar!/res/logview4j /images/info.gif false INFO 1452446727616000822 stencyl.sw.util.StreamGobbler [haxelib.exe] android.util.AndroidException: Can't connect to activity manager; is the system running?
jar:file:/C:/Program Files (x86)/Stencyl/sw.jar!/res/logview4j /images/info.gif false INFO 1452446727616000821 stencyl.sw.util.StreamGobbler [haxelib.exe] Error type 2
jar:file:/C:/Program Files (x86)/Stencyl/sw.jar!/res/logview4j /images/info.gif false INFO 1452446727398000818 stencyl.sw.util.StreamGobbler [haxelib.exe] Running command: RUN
jar:file:/C:/Program Files (x86)/Stencyl/sw.jar!/res/logview4j /images/info.gif false INFO 1452446727382000817 stencyl.sw.util.StreamGobbler [haxelib.exe] 3767 KB/s (7523256 bytes in 1.950s)
jar:file:/C:/Program Files (x86)/Stencyl/sw.jar!/res/logview4j /images/info.gif false INFO 1452446727132000816 stencyl.sw.util

0 1 year, 2 weeks ago
Jon
You seem to be missing parts of the Android SDK. Try reinstalling it.

Debug > Android > Reinstall Android SDK

If you still experience problems, please post your question on the forums.

0 1 year, 2 months ago
amirghasemian
Hello I want to send a simple game to my android device but stencyl shows this error message
""Stencyl Encountered a problem while building your game"

I found this error in the error log:
Error: Could not detect Android API platforms in "C:\Users\Amir\AppData\Roaming \Stencyl\stencylworks\android-sdk/a ndroid-ndk-r7b//platforms"

how can I fix it

thanks.

0 1 year, 2 months ago
Nikolai Narlev
Hello guys, i am absolutely new to this, sorry for the basic quesiton but ..
Can i upload Stencyl game to Android and monetise it with ads?

0 1 year, 4 months ago
calabresearts
Hello,

If anyone is having trouble reinstalling the SDK and having it hang, crash, or get corrupted, I suggest you follow this link:

http://community.stencyl.com/index. php/topic,40114.new.html#new

~Cal Arts

-1 1 year, 7 months ago
okyanusefer
i cant see logs. your game could not be built. if nothing shows beow, run the game again to see why it failed.

W7 Pro

jdk 8u25

Samsung Gt-P5210

1 2 years, 1 month ago

Sign In to Comment