User Tools

Site Tools


en:tutorials:android:setup_android

Differences

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

Link to this comparison view

Both sides previous revisionPrevious revision
Next revision
Previous revision
en:tutorials:android:setup_android [2023/02/16 03:39 (2 years ago)] sausageen:tutorials:android:setup_android [2023/03/26 21:39 (2 years ago)] (current) sausage
Line 1: Line 1:
-<WRAP center round box 90%>This guide is based on Android Studio 3.1.3 and NDK version r17b. +<WRAP center round box 60%>This guide is based on Android Studio Electric Eel (which ships with SDK 33). If you need to set up a development environment for Android, you must first ensure you have completed the [[en:tutorials:android:getting_android_tools_and_orx|Getting Android Studio and Orx]] step first.</WRAP>
-If you need to set up a development environment for Android, visit: [[en:tutorials:android:getting_android_tools_and_orx|Getting Android Studio and the NDK]] first.</WRAP>+
  
-====== Compiling the Orx Library and the Android Demo Project ====== 
- 
-To follow this guide, you must first ensure you have completed the [[en:tutorials:android:getting_android_tools_and_orx|Getting Android Studio, NDK and Orx]] step. 
- 
-<WRAP center round box 90%> 
-To decide on which Android port to use, see: [[en:tutorials:android:which_android|Which Android Port should you use?]] 
-</WRAP> 
  
 +===== Compiling the Orx Library and the Android Demo Project =====
  
 **1. Compiling the Orx library for Android** **1. Compiling the Orx library for Android**
  
-   cd <DEV_FOLDER>/orx/code/build/android +   cd orx/code/build/android 
-   ndk-build +   build.bat
-   ./install.sh +
-    +
-   For windows, use install.bat instead. +
-    +
-<hidden Notes about ndk-build: what's going on here?>\\ +
-ndk-build will compile for all four cpu architectures (arm64-v8a, arm64-v8a, x86 and x86_64) into android/obj/local.+
  
-Each folder will contain the three versions of the Orx static library: liborx.a, liborxd.a and liborxp.a (release, debug and profile).+For Linux or Mac use ''build.sh'' instead
  
-There is an install.bat (for windows) and install.sh (for mac and linux) to copy the libraries into place in the orx project structure at: orx/code/lib/static+The compiled libraries will be located under ''orx\code\build\android\orx\build\outputs\aar''
  
-Holding the android versions of the Orx libraries at this location will make things more convenient when building your own projects.+  - orx-debug.aar 
 +  - orx-profile.aar 
 +  - orx-release.aar
  
-A good guide to ndk-build can be found at: https://developer.android.com/ndk/guides/ndk-build</hidden>\\+**2Compiling the Android Demo**
  
-   +Compile the Demo which links in the static Orx library that we prepared in step 1:
  
-**2Compiling the Android Demo Native Code**+   cd <DEV_FOLDER>/orx/code/demo/android 
 +   build.bat
  
-Let's compile the native code portion of the Demo which links in the static Orx library that we prepared in step 1:+For Linux or Mac use ''build.sh'' instead. 
  
-   cd <DEV_FOLDER>/orx/code/demo/android/app/src/main/jni +An APK file (one each for debug, profile and release) be created are available at: ''orx\code\demo\android\app\build\outputs\apk''
-   ndk-build+
  
-This step creates the native library for the demo.+You can copy this to your Android device to test.
  
-Creating a native library is only half the story, and will provide only a shared library (.so). This library and assets still need to be packaged for use on a device. 
- 
-That's what Android Studio (and Gradle: it's build system) are used for. 
- 
- 
- 
-    
-**3. Building the Android Demo in Android Studio** 
- 
-Now that we have the shared library of the demo, we need to build it in Android Studio. What really happens at the step? 
- 
-Android Studio (using Gradle) will take the shared library and wrap some java code around it so that the application can be executed. Everything will be packaged up. 
- 
-  - Open Android Studio 
-  - Load in the demo by selecting the orx/code/demo/android folder. 
-  - Gradle inside Android Studio will begin building automatically. 
-  - If there are no setup issues, the build will complete. 
-  - You can test the build on a real Android device or the emulator by selecting the Run / Run 'app' menu. 
-  - When running this step, an APK file be created and deployed to your device. 
- 
-You can also create an APK at any time and copy this to your Android device as well. 
-\\ 
  
 ===== General Troubleshooting ===== ===== General Troubleshooting =====
  
-**Tip:** If you receive the following error: +There are currently no tips here since our new process has been completely streamlined. Please get in touch on Discord if you experience issues so we can add them here.
-//[OrxTest] Unable to resolve target 'android-19'// +
- +
- +
-You don't have the minimum required android SDK (API 19) that the orx Demo is set to. Use the SDK Manager (Tools/Android/SDK Manager) to check and download the latest SDK. In the build.gradle, you can also set the SDK you want to target. This is an excellent resource to [[https://developer.android.com/guide/topics/manifest/uses-sdk-element|help you choose]]. +
- +
- +
-**Tip:** If you only receive a debug build, and no release build, there is an excellent workaround detailed here: http://stackoverflow.com/questions/27646262/how-to-create-a-release-android-library-package-aar-in-android-studio-not-deb +
- +
-**Tip:** Android NDK: Could not find application project directory ! +
-Android NDK: Please define the NDK_PROJECT_PATH variable to point to it. +
- +
-If you get this when running ndk-build, then you are not in the correct folder. Check the instructions to ensure you are at the correct path. There should be a jni folder present. ndk-build operates on the contents of a jni folder. +
- +
-\\ +
  
  
 If you have completed this tutorial and would like to try it with your own project, continue to [[en:tutorials:android:using_the_android_demo_as_a_template_for_your_own_projects|Using the Android demo as a template for your own projects]]. If you have completed this tutorial and would like to try it with your own project, continue to [[en:tutorials:android:using_the_android_demo_as_a_template_for_your_own_projects|Using the Android demo as a template for your own projects]].
        
en/tutorials/android/setup_android.1676547597.txt.gz · Last modified: 2023/02/16 03:39 (2 years ago) by sausage