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 [2012/03/13 22:39] – seth | proton:android_setup [2017/05/22 08:33] (current) – seth | ||
---|---|---|---|
Line 1: | Line 1: | ||
+ | Before going in to compilation details check [[proton: | ||
+ | |||
====Compiling for Android from Windows==== | ====Compiling for Android from Windows==== | ||
- | **NEW: | + | |
+ | ** NOTE: ** 5/ | ||
+ | |||
+ | **NOTE: | ||
Originally the Android platform was crippled by requiring all " | Originally the Android platform was crippled by requiring all " | ||
Line 18: | Line 23: | ||
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+ (boo, hiss), but I plan to do an android target supporting this eventually, especially since it seems to be the only way to support the xperia play gamepad controls. -Seth | + | ** 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==== | ||
Line 29: | Line 34: | ||
====Section 1: Setting up your Windows computer to compile for Android==== | ====Section 1: Setting up your Windows computer to compile for Android==== | ||
- | Get ready to do some downloading and installing! Android might be the most complicated one to setup, but you're in luck, the latest NDK no longer requires installing cygwin so it just got a lot simpler! | + | Get ready to do some downloading and installing! |
Important note: For all this stuff, try to choose a custom install path WITHOUT spaces in it. There, I just saved you like 40 minutes of diagnosing vague errors that will happen later. | Important note: For all this stuff, try to choose a custom install path WITHOUT spaces in it. There, I just saved you like 40 minutes of diagnosing vague errors that will happen later. | ||
+ | * Install the [[http:// | ||
+ | * Add **C: | ||
+ | * Add **C: | ||
- | * Install the [[http:// | + | If you type " |
- | * Add **C: | + | |
- | * Add **C: | + | |
- | + | ||
- | 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 44: | 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 64: | Line 69: | ||
* 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" |
Line 71: | Line 76: | ||
You don't absolutely have to, but if you run into any snags in the install later, come back to this point and try installing [[http:// | You don't absolutely have to, but if you run into any snags in the install later, come back to this point and try installing [[http:// | ||
- | Android is complex and I don't really think p+ can shield you from its intricacies. | + | Android is complex and I don't really think p+ can shield you from its intricacies. |
- | + | ||
- | You should probably spend a few days of hacking around with hello world apps to get a feel for it before attempting to use Proton SDK with it. | + | |
====Section 2: Downloading and setting up the NDK and compiling RTBareBones==== | ====Section 2: Downloading and setting up the NDK and compiling RTBareBones==== | ||
Line 81: | Line 84: | ||
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:\pro\ant) | ||
- | **Note**: The NDK version should be r7b (latest at the time this was written) or later. | + | **Note**: The NDK version should be r8 (latest at the time this was written) or later. |
- | + | ||
- | **Another Note**: NDK r7b is slightly broken, it won't run on a Xoom/tegra2 chipset! | + | |
| | ||
- | Ant is command line utility that will do the Android packaging for us after the .so binary is built. | + | Ant is a command line utility that will do the Android packaging for us after the .so binary is built. |
- | Annoying | + | More annoying |
* Add your android ndk dir to the windows path | * Add your android ndk dir to the windows path | ||
- | * Edit RTBareBones/ | ||
====Finally, | ====Finally, | ||
Line 102: | 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. | + | 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, it then compiles the Java pieces in one second, then slowly | + | |
Tips: | Tips: | ||
* build.bat uses InstallOnDefaultPhone.bat which installs it to whatever device is plugged in, as long as only one device exists, it works. | * build.bat uses InstallOnDefaultPhone.bat which installs it to whatever device is plugged in, as long as only one device exists, it works. | ||
- | * If any headers change, use FullRebuild.bat or Clean.bat. Otherwise you can run into a situation where it seems like it compiled fine but crashes. | + | * If any headers change, |
- | * Compiling is very slow. This would drive me crazy except that I generally do it very rarely, as I can do 99% of the dev in MSVC where a recompile takes seconds. | + | * Use buildRelease.bat to make the final, signed version to upload to the android store. |
- | 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 142: | Line 140: | ||
Don't forget to change it back later. | Don't forget to change it back later. | ||
- | Note: The above is sort of outdated and instead of LOCAL_CFLAGS/ | + | Note: The above may be outdated |
- | ====Enabling the Android Market Licensing Verification Library==== | + | The only app specific |
- | 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. | + | |
- | //shared/ | + | |
- | //by all Proton projects. | + | |
- | + | ||
- | //Thanks to Phil Hassey for his help and code | + | |
- | + | ||
- | 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 to use the google licensing stuff"; | + | |
- | 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 and tips ==== | ====Final thoughts and tips ==== | ||
Line 183: | Line 150: | ||
* Want to clone one of the example apps to be the starting place of a new app? Then read the tutorial on [[: | * 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? | + | * Want to compile faster? |
- | + | ||
- | ====V2 Android setup==== | + | |
- | RTAdTest actually uses a new v2 setup, it has a preprocessing step to be able to include/not include certain java code and control package naming. | + | |
- | + | ||
- | It supports Android market IAB, Tapjoy, and Hooked. | + |
proton/android_setup.1331678397.txt.gz · Last modified: 2012/03/13 22:39 by seth