User Tools

Site Tools


proton:android_projects

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Next revision
Previous revision
proton:android_projects [2012/07/02 16:08] – Common Android stuff akiproton:android_projects [2022/08/01 07:41] (current) – [V3 style] seth
Line 1: Line 1:
-**NEW:**  5/23/2012 - Samples now work with latest versions of Android SDK (**YOU MUST HAVE THE LATEST SDK TOOLS NOW!**) , NDK and Ant, and use new build setup with a java pre-processing step 
- 
 ==== Intro ==== ==== Intro ====
  
 The Android projects are a bit more complicated than some other platforms. Most of the complication comes from the fact that the Android applications are a mixture of native C++ and interpreted Java code. This is true for any Android project (not just Proton) that uses native code. On top of this Proton also adds its own quirks. The Android projects are a bit more complicated than some other platforms. Most of the complication comes from the fact that the Android applications are a mixture of native C++ and interpreted Java code. This is true for any Android project (not just Proton) that uses native code. On top of this Proton also adds its own quirks.
  
-First of all there are two versions of Android projects around: the so called v1 and v2. The v1 style is a somewhat deprecated style how Android projects were originally handled in Proton. The v2 version is the current style. Even some of the example applications are still using the v1 style while some of them have been converted to the v2 style. The v1 style is still working but it won't receive any updates and fixes. If you are making a new project, choose the v2 style.+Over the years we've updated how Android compiling works because Android itself keeps changing.
  
-==== V2 style ====+V1 style:  Lost to the sands of time (outdated) 
 +V2 style:  Used Ant and preprocessor directives, tricky but worked (outdated) 
 +V3 style:  Using Android Studio/Gradle, a very normal looking project, nothing weird about it really. 
 + 
 +==== V2 style (outdated!) ====
  
 At some point in history it came apparent that on Android some Java classes (provided by Proton) need to be in specific packages. And these packages change from project to another. Hence it was necessary to introduce a way to get (almost) the same source files to different directories (and thus to different packages) in different projects. The source files also needed small modifications in the code, for example the package name needs to be specified in the source. At some point in history it came apparent that on Android some Java classes (provided by Proton) need to be in specific packages. And these packages change from project to another. Hence it was necessary to introduce a way to get (almost) the same source files to different directories (and thus to different packages) in different projects. The source files also needed small modifications in the code, for example the package name needs to be specified in the source.
Line 25: Line 27:
  
 The build scripts also include some optional Java code (like Google's billing stuff, Tapjoy or Hooked) into the project as needed. What gets copied needs to be set per project. The build scripts also include some optional Java code (like Google's billing stuff, Tapjoy or Hooked) into the project as needed. What gets copied needs to be set per project.
 +
 +==== V3 style ====
 +
 +After a few more years, Seth created an Android Studio/Gradle based build.  The preprocessor is no longer used and the build system is simplified quite a bit, you just change the package id in a single place (AndroidGradle/local.properties) and edit a CMakeLists.txt file to set which C/C++ files compile.  Android Studio can load the project and run/debug on devices or emulated devices very easily.
 +
 +Android Studio handles installing Gradle/NDK/etc by itself, much simpler than before.
 +
 +Note:  I've ripped out built in support (on the Java side) for In App Billing, Chartbooost/Tapjoy/Etc as I assume they don't work anymore anyway as I haven't used them for years.
 +
 +It is possible to use third party libraries the "gradle way" or directly by linking files, I do this in Dink Smallwood HD android for FMOD support.
 +
 +IMPORTANT NOTE:  The package ID set in App.cpp MUST match the one set in local.properties.  Those are the only two places you need to worry about it.  The RTAndroidApp name you see everywhere stays that way and shouldn't be changed. (it's used for internal bindings but won't affect the real build's package id etc)
  
 ==== Building ==== ==== Building ====
  
-The building process is somewhat different depending on what operating system you are using. Check instructions for [[proton:android_setup|Windows]] or [[proton:android_setup_linux|Linux]].+The building process is somewhat different depending on what operating system you are using. Check instructions for [[proton:android_setupv3|Windows]] or [[proton:android_setup_linuxv3|Linux]] 
 + 
 +Or the old outdated way: [[proton:android_setup|Windows]] or [[proton:android_setup_linux|Linux]].
  
proton/android_projects.1341245305.txt.gz · Last modified: 2012/07/02 16:08 by aki