How to successfully run the demo of SDL's officially available Android platformRain Date: 2014-4-30
Write notes:SDL's official provided a anroid demo template sdlactivity, unable to run directly, according to the official document operation process will also encounter many problems, here I successfully compiled and run the process of recording down, I hope to be helpful!
SDL Introduction:SDL is simple directmedia layer abbreviation, it is a set of open source C language cross-platform multimedia Development Library, provides a variety of control images, sound and other interfaces, widely used in games, media players, simulator development.
Basic Environment:1. Operating system: Windows7 64-bit; 2. Android SDK Development environment: ADT-BUNDLE-WINDOWS-X86_64-20130729.ZIP3. Android NDK Development Kit: Android-ndk-r9d-windows-x86_64.zip
Operation steps:The
first step: Prepare the SDL source code package;1. Go to http://www.libsdl.org/official website to download the latest version of Sdl2-2.0.3.tar.gz;2. After extracting, you can find the Android-project directory and readme-android.txt in the root directory, which is an Android project template, which is a document description of how to use the project. 3. Adjust the directory to make it a compiled project: (1) Cut the Android-project directory to a directory similar to sdl2-2.0.3; (2) then copy the sdl2-2.0.3 directory to the Android-project\jni directory and rename it to SDL;
Step Two: Add the main function to SDL(1) MAINHTTP://WIKI.LIBSDL.ORG/TUTORIALS#ANDROID.C file can be used from http://www.dinomage.com/wp-content/uploads/2013/01/ MAIN.C Download, (2) after downloading it into the ANDROID-PROJECT\JNI\SRC directory, (3) Add MAIN.C to Android-project\jni\src\android.mk: In Android.mk, there is a yoursourcehere.c, which is replaced by MAIN.C.
Step Three: Compiling libsdl2.so and libmain.soNote: Make sure that the Ndk Bin directory has been configured to the environment variable path, open the cmd Command window, go to the Android-project directory, and then execute the "ndk-build" command to compile. After successful compilation, the Libs directory is generated under the Android-project root directory, and the following two so files are required for each platform.
Fourth Step: ModifyBuild target
configuration fileThe default project is to use the =android-12, you must make this target consistent with your system configuration, otherwise the compilation will fail. Specific configurations are located in Android-project/project.properties and Android-project/default.properties. Since the Adt-bundle-windows-x86_64-20130729.zip package corresponds to android-18, it is necessary to change the configuration in all two files to android-18.
Fifth step: import Eclipse RunSelect File->new->android->android Project from Existing Code, and then select the Android-project directory to import the project file into eclipse. Then choose to follow the normal Android project to run. This time the program flashed nothing, because no resources were added. A BMP image can be downloaded and placed in Android-project/assets, which is automatically generated by eclipse. You can then run to see the images rendered through SDL. Here is an official document that mentions the BMP address: http://www.dinomage.com/wp-content/uploads/2013/01/image.bmp. The entire project source code can go to my github to download, address: https://github.com/dennishucd/SDLActivity
Rain, reprint Please specify Source: http://blog.csdn.net/gobitan/article/details/24771311
References:1. Http://wiki.libsdl.org/Tutorials#Android 2. Http://www.dinomage.com/2013/01/howto-sdl-on-android/
How to successfully run the demo of the SDL's officially available Android platform