101,269

Views

Beginner

Level

32

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!

32 Comments

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 5 years, 8 months ago
rocketree
Tip: If you're stuck on "sending to device"

1. Make sure your Android phone has "developer options" enabled, then make sure "USB debugging" is enabled. (Google "enable android developer option")
2. Make sure both your computer and phone have support for Media Transfer Protocol (MTP) otherwise it won't work. My old Windows XP does not support MTP, so no matter how many times I download MTP driver, it won't connect to phone. On Windows 7, it connects. How do you tell if both your computer

1 5 years, 8 months ago
Zukile
When I run the app on my device, it runs then quickly stop, can you please help me. Bellow is what is shown on the LOG:

[LOG] I/trace (11834): Universal.hx:162: Stage Width: -1
[LOG] I/trace (11834): Universal.hx:163: Stage Height: -1
[LOG] I/trace (11834): Universal.hx:164: Screen Width: 480
[LOG] I/trace (11834): Universal.hx:165: Screen Height: 764
[LOG] I/trace (11834): Universal.hx:166: Screen DPI: 160
[LOG] I/trace (11834): Universal.hx:197: Widescreen (Aspect Ratio > 1.5)
[LOG] I/trace (11834): Universal.hx:302: Theoretical Scale: 1.5
[LOG] I/trace (11834): Universal.hx:314: Max Scale: 4
[LOG] I/trace (11834): Universal.hx:315: Engine Scale: 1.5x
[LOG] I/trace (11834): Universal.hx:365: Algorithm: Full Screen
[LOG] I/trace (11834): Universal.hx:669: Scale X: 1
[LOG] I/trace (11834): Universal.hx:670: Scale Y: 1
[LOG] I/trace (11834): Purchases.hx:32: Purchases: Started

1 5 years, 11 months ago
simpledevelopers
i'm stuck on compiling.

windows-vista
android-4.3
java dk-8
please help

0 6 years, 1 day ago
wvcoalminer
For those getting errors about Java, you need to uninstall your current version, and reinstall the JDK for 6.31. It'll work fine from there, downloading requires an oracle account, however, since 6.31 is legacy.
0 6 years, 1 week ago
jonyah
when im trying to test my game it says this


[LOG] JAVA_HOME is set? true
[LOG] JAVA_HOME = C:\Program Files\Java\jdk1.6.0_31
[LOG] JAVA_HOME Exists? true
[LOG] JAVA_HOME points to a valid JDK? false
[ERR] No JDK found. Attempting to install or ask for the JDK.
[LOG] We're on Windows, searching for the JDK in default locations.
[LOG] These locations are: [Ljava.lang.String;@be5687
[LOG] Looking at this location... C:\Program Files (x86)\Java\
[LOG] Location is a directory... C:\Program Files (x86)\Java\
[LOG] Looking at this file... C:\Program Files (x86)\Java\jre7
[LOG] Looking at this location... C:\Program Files\Java\
[LOG] Location is a directory... C:\Program Files\Java\
[LOG] Looking at this file... C:\Program Files\Java\jdk1.6.0_31
[LOG] Found the JDK at... C:\Program Files\Java\jdk1.6.0_31
[LOG] Saving Preference
[LOG] Looking at this location... C:\Java\
[LOG] Yay, we found the JDK at: C:\Program Files\Java\jdk1.6.0_31
[LOG] JAVA_HOME is now: C:\Program Files\Java\jdk1.6.0_31
[ERR] Still no JDK is installed. Can't proceed. Either user canceled JDK installation or something is wrong on the user's end.
[LOG] Aborting Android build.

can any body help ive downloaded java jdk muptible times

0 6 years, 3 weeks ago
Vadim Va
I have the same problem as vincentkblau
[LOG] -pre-compile:
[LOG] -compile:
[LOG] BUILD FAILED
[LOG] E:\Stencyl Game Redactor\stencylworks\android-sdk\a ndroid-sdk-windows\tools\ant\build. xml:598: The following error occurred while executing this line:
[LOG] E:\Stencyl Game Redactor\stencylworks\android-sdk\a ndroid-sdk-windows\tools\ant\build. xml:713: The following error occurred while executing this line:
[LOG] E:\Stencyl Game Redactor\stencylworks\android-sdk\a ndroid-sdk-windows\tools\ant\build. xml:727: Class not found: javac1.8
[LOG] Total time: 1 second
[LOG] Finished building for Android (or errored out): 1

My PC - Win7 SP1
Java 8 (jdk1.8.0_05)
Smartphone - LG Optimus G e975 Android 4.1.2

Who can tell - how to fix this problem? :)

0 6 years, 1 month ago
LeonMane
I had a lot of problem trying to install the correct drivers on windows to test my game, but installing Kies apparently did the trick for me, maybe this can be usefull to others.
0 6 years, 1 month ago
vincentkblau
Dear all

I got following error during build my 1st Android test game. Any suggestion? My mobile run Android 2.3.6 and PC is Win7.

BUILD FAILED
[LOG] C:\Users\vincent\AppData\Roaming\St encyl\stencylworks\android-sdk\andr oid-sdk-windows\tools\ant\build.xml :598: The following error occurred while executing this line:
[LOG] C:\Users\vincent\AppData\Roaming\St encyl\stencylworks\android-sdk\andr oid-sdk-windows\tools\ant\build.xml :713: The following error occurred while executing this line:
[LOG] C:\Users\vincent\AppData\Roaming\St encyl\stencylworks\android-sdk\andr oid-sdk-windows\tools\ant\build.xml :727: Class not found: javac1.8
[LOG] Total time: 1 second
[LOG] Finished building for Android (or errored out): 1


Thanks

0 6 years, 2 months ago
chesaro
I (too) already have de Android SDK and i really wish not to download again, is there a way? Also, isn't it time to use a safer version of the JDK, on the link to oracle says it's outdated... Well i'm using JDK 8.0 and it seems very JDK 7 compatible, so it could be the best.
0 6 years, 2 months ago

Sign In to Comment