proton:android_setup
Differences
This shows you the differences between two versions of the page.
Both sides previous revisionPrevious revisionNext revision | Previous revision | ||
proton:android_setup [2011/08/26 10:03] – seth | proton:android_setup [2017/05/22 08:33] (current) – seth | ||
---|---|---|---|
Line 1: | Line 1: | ||
- | **NOTE:** If you have any problems packing Android things with ant, check [[http:// | + | Before going in to compilation details |
====Compiling for Android from Windows==== | ====Compiling for Android from Windows==== | ||
+ | |||
+ | ** NOTE: ** 5/ | ||
+ | |||
+ | **NOTE: | ||
+ | |||
Originally the Android platform was crippled by requiring all " | Originally the Android platform was crippled by requiring all " | ||
Line 8: | Line 13: | ||
* Native ARM machine code is faster than using Java | * Native ARM machine code is faster than using Java | ||
* The ability to use millions of lines of existing legacy C++ code | * The ability to use millions of lines of existing legacy C++ code | ||
- | * Can use boost and stl | + | * Can use boost and stl (since r5 I think..) |
* Can write an Android game without writing a single line of Java | * Can write an Android game without writing a single line of Java | ||
* Can debug your app in MSVC or Xcode | * Can debug your app in MSVC or Xcode | ||
Line 17: | Line 22: | ||
The C++ " | The C++ " | ||
+ | |||
+ | ** Side Note **: There is actually an even newer way to do NDK now - something called a NativeActivity where you can use 100% C++. Except you can't, because things like IAP and Tapjoy integration would still be in Java so I assume more ugly bridging would be required.. also it requires Android 2.3+, but I plan to do an android target supporting this eventually, especially since it seems to be the only way to fully support the xperia play analog sticks. -Seth | ||
====Prerequisites==== | ====Prerequisites==== | ||
- | Before attempting | + | Before attempting |
* Read the [[proton: | * Read the [[proton: | ||
Line 25: | Line 32: | ||
NOTE (MK): RTSimpleApp, | NOTE (MK): RTSimpleApp, | ||
- | ====Section 1: Setting up your Windows computer to compile for Android==== | ||
- | Get ready to do a lot of downloading and installing. | ||
- | This is going to take a while. | + | ====Section 1: Setting up your Windows computer |
+ | Get ready to do some downloading and installing! | ||
- | * Install the [[http:// | + | Important note: For all this stuff, try to choose a custom |
- | * Add **C: | + | |
- | * Add **C: | + | |
- | * [[http:// | + | |
+ | * Install the [[http:// | ||
+ | * Add **C: | ||
+ | * Add **C: | ||
- | If you type " | + | If you type " |
Here is how I setup my AVD (note my naming format.. helps later to remember which AVD is which version) | Here is how I setup my AVD (note my naming format.. helps later to remember which AVD is which version) | ||
Line 42: | Line 48: | ||
{{: | {{: | ||
+ | Having said that, the truth is I never use the AVD/ | ||
Make sure you install "USB Driver package, revision X", your phone probably needs this. Also, " | Make sure you install "USB Driver package, revision X", your phone probably needs this. Also, " | ||
Line 47: | Line 54: | ||
**Note**: I had problems on Win7 until I found " | **Note**: I had problems on Win7 until I found " | ||
- | You want to test on your real phone, right? | + | **Another note**: The emulator refused |
- | Setup your Android | + | You want to test on your real device(s), right? |
+ | |||
+ | Driver links for your device: | ||
+ | |||
+ | * For Nexus One and Nexus S, download them from the Android SDK and AVD Manager, then they will be in / | ||
+ | * [[http:// | ||
+ | * [[http:// | ||
+ | |||
+ | Setup your Android | ||
* In Settings-> | * In Settings-> | ||
* In Settings-> | * In Settings-> | ||
- | * After plugging in your phone, in the Win device manager it will probably say "no drivers installed" | + | * After plugging in your phone, in the Win device manager it will probably say "no drivers installed" |
- | * Typing "abd devices" | + | * Typing "adb devices" |
- | Ok. In theory, you're now setup for building a standard Android app and running it in the emulator or on your phone. | ||
- | You don't absolutely have to, but I'd recommend installing [[http:// | + | Ok. In theory, you're now setup for building a standard Android |
- | Android is complex and I don' | + | You don' |
- | You should probably spend a few days of hacking around with hello world apps to get a feel for it before attempting | + | Android is complex and I don't really think p+ can shield you from its intricacies. |
- | ====Section 2: Setting | + | ====Section 2: Downloading and setting |
- | Ok, your hairs have magically turned white and mostly fallen out, but you've finally got your hello world app on your device. | + | Ok, typing adb from the dos prompt shows your device |
- | + | ||
- | You are now ready to move to the next step. | + | |
First, mentally throw away Eclipse if you were using it for testing - you'll never need it again. | First, mentally throw away Eclipse if you were using it for testing - you'll never need it again. | ||
- | * Install [[http:// | + | * Install [[http:// |
- | * Add the ant directory to your windows path. Verify it's working by typing " | + | * Add the ant directory to your windows path. Verify it's working by typing " |
- | * Download the [[http:// | + | * Download the [[http:// |
+ | * Make sure that the environmental variable ANT_HOME exists and is set to your ant path. (ie, c: | ||
+ | |||
+ | **Note**: The NDK version should be r8 (latest at the time this was written) or later. | ||
| | ||
- | Ant is command line utility that will do the Android packaging for us after the .so binary is built. Cygwin lets us run linux-style stuff on Windows. | + | Ant is a command line utility that will do the Android packaging for us after the .so binary is built. |
- | Annoying | + | More annoying |
- | * Add a Windows environmental var CYGWIN_DIR to your base cygwin directory. | ||
* Add your android ndk dir to the windows path | * Add your android ndk dir to the windows path | ||
- | * Edit RTBareBones/ | ||
- | * Edit RTBareBones/ | ||
- | * Edit RTBareBones/ | ||
- | |||
- | Phew! I could probably find ways to reduce the hand edits needed above but meh. Good enough for now. Tricky hacks like reading from windows environmental vars from inside cygwin would make it harder to build from linux or mac later, don't want that either. | ||
====Finally, | ====Finally, | ||
Line 94: | Line 103: | ||
From file explorer, double click / | From file explorer, double click / | ||
- | You should see a bunch of weird warnings like "this precompiled header message should show up once" showing up forty times. This is all perfectly normal. Trust me. | + | After a lengthy C++ compile process, it then compiles the Java pieces in one second, then puts it on the active device, as long as you only have one plugged in. The .apk it makes is located in / |
- | After a lengthy C++ compile process, | + | Tips: |
+ | * build.bat uses InstallOnDefaultPhone.bat which installs | ||
+ | * If any headers change, | ||
+ | * Use buildRelease.bat | ||
- | Run ViewLog.bat to see the debug output | + | Run ViewLogDefaultPhone.bat to see the debug output. (As long as only one device is plugged in/active, it will work, be it the emulator or a real device) |
====Customize the .mak==== | ====Customize the .mak==== | ||
- | If you need to add remove source files to the project, manually edit RTBareBones/ | + | If you need to add/remove source files to the project, manually edit RTBareBones/android/ |
Also, if you're having trouble, it's a good idea to enable debug mode compiling. | Also, if you're having trouble, it's a good idea to enable debug mode compiling. | ||
Line 128: | Line 140: | ||
Don't forget to change it back later. | Don't forget to change it back later. | ||
- | ====Enabling the Android Market Licensing Verification Library==== | + | Note: The above may be outdated with some projects |
- | If you want to sell your App in the Android market, you should use [[http:// | + | |
- | + | ||
- | It's actually already implemented in Proton SDK, take a look at the only .Java file in RTBareBones, | + | |
- | + | ||
- | <code java> | + | |
- | //This is the only app-specific java file for the android project. | + | |
- | // | + | |
- | //by all Proton | + | |
- | + | ||
- | // | + | |
- | + | ||
- | package com.rtsoft.rtbarebones; | + | |
- | import com.rtsoft.shared.SharedActivity; | + | |
- | import android.os.Bundle; | + | |
- | + | ||
- | public class Main extends SharedActivity | + | |
- | { | + | |
- | @Override | + | |
- | protected void onCreate(Bundle savedInstanceState) | + | |
- | { | + | |
- | //EDIT THESE TO MATCH YOUR PROJECT NAME | + | |
- | BASE64_PUBLIC_KEY = "uh, it would go here if you had one and wanted | + | |
- | PackageName= " | + | |
- | dllname= " | + | |
- | securityEnabled = false; | + | |
- | | + | |
- | } | + | |
- | } | + | |
- | </ | + | |
- | + | ||
- | You would just need to enter your public key (The Google developer console gives this to you after you sign up) and change " | + | |
- | ====Final thoughts==== | + | The only app specific .java file is located in / |
- | That's about it for getting the samples running. | + | |
- | Use the same process to compile RTSimpleApp. | + | ====Final thoughts and tips ==== |
+ | That's about it for getting | ||
- | Want to clone one of the example apps to be the starting place of a new app? Then read the tutorial on [[: | + | Use the same process |
+ | * Want to clone one of the example apps to be the starting place of a new app? Then read the tutorial on [[: | ||
+ | * Want to compile faster? |
proton/android_setup.1314353016.txt.gz · Last modified: 2011/08/26 10:03 by seth