User Tools

Site Tools


projtec:readme.md

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
projtec:readme.md [2017/03/23 15:20] orelprojtec:readme.md [2024/03/18 15:06] (current) – external edit 127.0.0.1
Line 47: Line 47:
 Don't forget to accept ALL Licences when the install process starts! Don't forget to accept ALL Licences when the install process starts!
  
-**At CREMI, launch for the first time the following script to move $HOME/.android in a different place to save disk space:**+**At CREMI**  
 + 
 +Get archive *android-sdl2-demo.zip* on Moodle and decompress it... 
 + 
 +Then, launch (only for the first timethe following script to move $HOME/.android in a different place to save disk space:**
  
     ./init-cremi.sh     ./init-cremi.sh
Line 83: Line 87:
  
 Here is the typical structure of an SDL Android project: Here is the typical structure of an SDL Android project:
 +
 ~~~ ~~~
 . .
Line 105: Line 110:
 ~~~ ~~~
  
-* AndroidManifest.xml: The high-level description of our Android+* AndroidManifest.xml: The high-level description of your Android
   application (label, icon, orientation, activity, ...).   application (label, icon, orientation, activity, ...).
-* build.xml: The main build file for our Android application (used by+* build.xml: The main build file for your Android application (used by
   Ant compiler). It defines the target Android version (SDK API level   Ant compiler). It defines the target Android version (SDK API level
   23) and the package name.    23) and the package name. 
-* SDLActivity.java: This is the main Android "activity" for our SDL2+* SDLActivity.java: This is the main Android "activity" for your SDL2
   application. In other words, it is the Java entry point of your   application. In other words, it is the Java entry point of your
   Android application. This file is provided by SDL2. Don't modify it,   Android application. This file is provided by SDL2. Don't modify it,
Line 122: Line 127:
 * Application.mk: This file describes both the Android version (api * Application.mk: This file describes both the Android version (api
   level 23) we target and the platform (x86 & arm) we target.   level 23) we target and the platform (x86 & arm) we target.
-* Android.mk: This is the Makefile for the native part of our Android+* Android.mk: This is the Makefile for the native part of your Android
   application (used by ndk-build compiler).   application (used by ndk-build compiler).
 * the SDL2 libraries in jni/SDL*/ subdirectories; * the SDL2 libraries in jni/SDL*/ subdirectories;
-our SDL2 demo code in jni/src/* with the main SDL2 loop (called by+your SDL2 demo code in jni/src/* with the main SDL2 loop (called by
   SDLActivity.java)   SDLActivity.java)
  
Line 139: Line 144:
 application. application.
  
-~~~c+~~~
   #ifdef __ANDROID__   #ifdef __ANDROID__
     /* android code only */     /* android code only */
Line 150: Line 155:
 ------------- -------------
  
-Our Android project requires to download the SDL2 library (and its+Your Android project requires to download the SDL2 library (and its
 extensions) in the 'jni' directory. This is required because the SDL2 extensions) in the 'jni' directory. This is required because the SDL2
 library is not available on standard Android system. Besides, it must library is not available on standard Android system. Besides, it must
Line 187: Line 192:
 src/) and it finally generates an Android package src/) and it finally generates an Android package
 (sdl2-demo-debug.apk) in the bin/ directory.  This package will (sdl2-demo-debug.apk) in the bin/ directory.  This package will
-contain all the stuffs needed for our app (native libraries, assets,+contain all the stuffs needed for your app (native libraries, assets,
 java bytecode, ..) to run on the target plaftorms. java bytecode, ..) to run on the target plaftorms.
  
Line 193: Line 198:
 ---------- ----------
  
-You can deploy and run your application on both a real phone (off-topic) or an emulator.+You can deploy and run your application on both a real phone or an emulator. 
 + 
 +### Deployment on Emulator
  
 To create your own emulator or AVD (Android Virtual Device), launch To create your own emulator or AVD (Android Virtual Device), launch
Line 203: Line 210:
 'Nexus 5' device with Android 6.0 (API level 23) and CPU/ABI 'Intel 'Nexus 5' device with Android 6.0 (API level 23) and CPU/ABI 'Intel
 Atom (x86)' without Skin. Set RAM to 1024MB and Heap to 256MB. Use Atom (x86)' without Skin. Set RAM to 1024MB and Heap to 256MB. Use
-Host GPU (unless OpenGL ES could fail). See the configuration snapshot of our AVD below.+Host GPU (unless OpenGL ES could fail). See the configuration snapshot of your AVD below.
  
-![Our emuator configuration.](avd.png) +![Emuator configuration.](lib/exe/fetch.php?media=projtec:avd.png)
-[![alt text](_media/projtec/avd.png)]+
  
 Such an emulator is installed in the directory $HOME/.android/avd/ and Such an emulator is installed in the directory $HOME/.android/avd/ and
Line 226: Line 232:
  
 Now, find the 'SDL2 Demo' icon in the Android emulator... Enjoy! Now, find the 'SDL2 Demo' icon in the Android emulator... Enjoy!
 +
 +### Deployment on a real phone (Android version >= 6.0)
 +
 +First to activate the developer mode. For that, click 5 times on the [build number](https://www.greenbot.com/article/2457986/how-to-enable-developer-options-on-your-android-phone-or-tablet.html).
 +
 +Now, on your phone, allow "debug via USB"
 +
 +Now connect your phone with a USB cable.
 +
 +Now, on your phone, allow this particular computer to debug via the USB cable
 +
 +Finally, on the computer run the deployment command:
 +
 +    ant debug install
 +    
  
 Android Log & Debug Android Log & Debug
 ------------------- -------------------
  
-Print log written by SDL_Log() routine in your app:+Print log written by SDL_Log() routine in your app:
  
     adb logcat -s 'SDL/APP'     adb logcat -s 'SDL/APP'
  
-Check Android properties:+Check Android properties:
  
     adb shell getprop     adb shell getprop
  
-GDB Debug (off-topic)+GDB Debug (off-topic)
  
---+---
 aurelien.esnard@u-bordeaux.fr aurelien.esnard@u-bordeaux.fr
  
projtec/readme.md.1490282457.txt.gz · Last modified: 2024/03/18 15:05 (external edit)