Mercurial > sdl-ios-xcode
comparison README.android @ 4965:91d0085b7560
Added the Android project and lots of info to README.android
author | Sam Lantinga <slouken@libsdl.org> |
---|---|
date | Thu, 06 Jan 2011 17:12:31 -0800 |
parents | 6c645018741e |
children | f74a3f94c408 |
comparison
equal
deleted
inserted
replaced
4964:6c645018741e | 4965:91d0085b7560 |
---|---|
1 ================================================================================ | 1 ================================================================================ |
2 Simple DirectMedia Layer for Android | 2 Simple DirectMedia Layer for Android |
3 ================================================================================ | 3 ================================================================================ |
4 | 4 |
5 Requirements: Android SDK and Android NDK r4 or later | 5 Requirements: |
6 http://developer.android.com/ | 6 |
7 Android SDK | |
8 http://developer.android.com/sdk/index.html | |
9 | |
10 Android NDK r4 or later | |
11 http://developer.android.com/sdk/ndk/index.html | |
7 | 12 |
8 ================================================================================ | 13 ================================================================================ |
9 How the port works | 14 How the port works |
10 ================================================================================ | 15 ================================================================================ |
11 | 16 |
20 ================================================================================ | 25 ================================================================================ |
21 Building an app | 26 Building an app |
22 ================================================================================ | 27 ================================================================================ |
23 | 28 |
24 Instructions: | 29 Instructions: |
25 1. Copy the android-project directory wherever you want your Android project to go | 30 1. Copy the android-project directory wherever you want to keep your projects and rename it to the name of your project. |
26 2. Move this SDL directory into the <project>/jni directory | 31 2. Move this SDL directory into the <project>/jni directory |
27 3. Place your application source files in the <project>/jni/src directory | 32 3. Place your application source files in the <project>/jni/src directory |
28 4. Edit <project>/jni/src/Android.mk to include your source files | 33 4. Edit <project>/jni/src/Android.mk to include your source files |
29 5. Run 'ndk-build' (a script provided by the NDK). This compiles the C source | 34 5. Run 'ndk-build' (a script provided by the NDK). This compiles the C source |
30 | 35 |
33 6. Edit <project>/local.properties to point to the Android SDK directory | 38 6. Edit <project>/local.properties to point to the Android SDK directory |
34 7. Run 'ant debug' in android/project. This compiles the .java and eventually | 39 7. Run 'ant debug' in android/project. This compiles the .java and eventually |
35 creates a .apk with the native code embedded | 40 creates a .apk with the native code embedded |
36 8. 'ant install' will push the apk to the device or emulator (if connected) | 41 8. 'ant install' will push the apk to the device or emulator (if connected) |
37 | 42 |
43 Here's an explanation of the files in the Android project, so you can customize them: | |
44 | |
45 android-project/ | |
46 AndroidManifest.xml - package manifest, do not modify | |
47 build.properties - empty | |
48 build.xml - build description file, used by ant | |
49 default.properties - holds the ABI for the application, currently android-4 which corresponds to the Android 1.6 system image | |
50 local.properties - holds the SDK path, you should change this to the path to your SDK | |
51 jni/ - directory holding native code and Android.mk | |
52 jni/Android.mk - Android makefile that includes all subdirectories | |
53 jni/SDL/ - directory holding the SDL library files | |
54 jni/SDL/Android.mk - Android makefile for creating the SDL shared library | |
55 jni/src/ - directory holding your application source | |
56 jni/src/Android.mk - Android makefile that you should customize to include your source code and any library references | |
57 res/ - directory holding resources for your application | |
58 res/drawable-* - directories holding icons for different phone hardware | |
59 res/layout/main.xml - place holder for the main screen layout, overridden by the SDL video output | |
60 res/values/strings.xml - strings used in your application, including the application name shown on the phone. | |
61 src/org/libsdl/app/SDLActivity.java - the Java class handling the initialization and binding to SDL. Be very careful changing this, as the SDL library relies on this implementation. | |
62 | |
63 | |
64 ================================================================================ | |
65 Additional documentation | |
66 ================================================================================ | |
67 | |
68 The documentation in the NDK docs directory is very helpful in understanding the build process and how to work with native code on the Android platform. | |
69 | |
70 The best place to start is with docs/OVERVIEW.TXT | |
71 | |
38 | 72 |
39 ================================================================================ | 73 ================================================================================ |
40 Using Eclipse | 74 Using Eclipse |
41 ================================================================================ | 75 ================================================================================ |
42 | 76 |
43 NEED CONTENT | 77 First make sure that you've installed Eclipse and the Android extensions as described here: |
78 http://developer.android.com/sdk/eclipse-adt.html | |
79 | |
80 Once you've copied the SDL android project and customized it, you can create an Eclipse project from it: | |
81 * File -> New -> Other | |
82 * Select the Android -> Android Project wizard and click Next | |
83 * Enter the name you'd like your project to have | |
84 * Select "Create project from existing source" and browse for your project directory | |
85 * Make sure the Build Target is set to Android 1.6 | |
86 * Click Finish | |
44 | 87 |
45 | 88 |
46 ================================================================================ | 89 ================================================================================ |
47 Loading files | 90 Loading files and resources |
48 ================================================================================ | 91 ================================================================================ |
49 | 92 |
50 NEED CONTENT | 93 NEED CONTENT |
51 | 94 |
52 | 95 |
53 ================================================================================ | 96 ================================================================================ |
54 Troubleshooting | 97 Troubleshooting |
55 ================================================================================ | 98 ================================================================================ |
56 | 99 |
57 NEED CONTENT | 100 You can create and run an emulator from the Eclipse IDE: |
101 * Window -> Android SDK and AVD Manager | |
102 | |
103 You can see if adb can see any devices with the following command: | |
104 adb devices | |
105 | |
106 You can see the output of log messages on the default device with: | |
107 adb logcat | |
108 | |
109 You can push files to the device with: | |
110 adb push local_file remote_path_and_file | |
111 | |
112 You can push files to the SD Card at /sdcard, for example: | |
113 adb push moose.dat /sdcard/moose.dat | |
58 | 114 |
59 | 115 |
60 ================================================================================ | 116 ================================================================================ |
61 Known issues | 117 Known issues |
62 ================================================================================ | 118 ================================================================================ |