Changes between Version 69 and Version 70 of Getting-Started/Android
- Timestamp:
- Jan 18, 2017 1:15:21 PM (8 years ago)
Legend:
- Unmodified
- Added
- Removed
- Modified
-
Getting-Started/Android
v69 v70 9 9 10 10 * Besides the [http://developer.android.com/sdk/index.html Android SDK], you will also need the [http://developer.android.com/tools/sdk/ndk/index.html Android NDK] (minimum version r8b). 11 * Optional if you want to build and and run the sample application PJSUA:11 * Optional if you want to build and and run the sample applications (i.e: pjsua2 and pjsua): 12 12 * [http://www.swig.org/download.html SWIG] (minimum version 2.0.5) 13 * Eclipse with [http://developer.android.com/tools/sdk/eclipse-adt.html ADT Plugin]. 13 * ~~Eclipse with [http://developer.android.com/tools/sdk/eclipse-adt.html ADT Plugin]~~ (deprecated since 2.6) 14 * [https://developer.android.com/studio/index.html Android Studio] 14 15 * Telnet application to interact with PJSUA command line. If you are not familiar with telnet, please find a tutorial suitable for your development platform. 15 16 … … 144 145 }}} 145 146 This step should produce: 146 - native library {{{libpjsua2.so}}} in {{{pjsip-apps/src/swig/java/android/libs/armeabi}}} 147 - note: if you are building for other target ABI, you'll need to manually move {{{libpjsua2.so}}} to the appropriate target ABI directory, e.g: {{{libs/armeabi-v7a}}}, please check [https://developer.android.com/ndk/guides/abis.html#am here] for target ABI directory names. 148 - pjsua2 Java interface (a lot of {{{.java}}} files) in {{{pjsip-apps/src/swig/java/android/src/org/pjsip/pjsua2}}} 149 1. Make sure any library dependencies are copied to {{{pjsip-apps/src/swig/java/android/libs/armeabi}}} (or the appropriate target ABI directory), e.g: {{{libyuv.so & libopenh264.so}}} for video support. 150 1. Create Android project from pjsua. In Eclipse: 151 a. From menu: '''File''' --> '''New''' --> '''Project''' 152 a. Select '''Android Project from Existing Code''', press '''Next''' 153 a. In ''Root Directory'', put the location of '''pjsua2''' source code (i.e. {{{$PJDIR/pjsip-apps/src/swig/java/android}}}) and press '''Finish''' 154 1. You may need to select different Android SDK than what is configured in pjsua2. You can do this from the project's '''Properties'''. 147 - native library {{{libpjsua2.so}}} in {{{pjsip-apps/src/swig/java/android/app/src/main/jniLibs/armeabi}}} 148 - note: if you are building for other target ABI, you'll need to manually move {{{libpjsua2.so}}} to the appropriate target ABI directory, e.g: {{{jniLibs/armeabi-v7a}}}, please check [https://developer.android.com/ndk/guides/abis.html#am here] for target ABI directory names. 149 - pjsua2 Java interface (a lot of {{{.java}}} files) in {{{pjsip-apps/src/swig/java/android/app/src/main/java/org/pjsip/pjsua2}}} 150 1. Make sure any library dependencies are copied to {{{pjsip-apps/src/swig/java/android/app/src/main/jniLibs/armeabi}}} (or the appropriate target ABI directory), e.g: {{{libopenh264.so}}} for video support. 151 1. Open pjsua2 app project in Android Studio, it is located in {{{pjsip-apps/src/swig/java/android}}}. 155 152 1. Run it. 156 153 157 154 === Log output === 158 155 159 The pjsua2 sample application will write log messages to '''!LogCat''' window (to show !LogCat window, from Eclipse menu: '''Window''' --> '''Show View''' --> '''Other''' --> type ''!LogCat'')156 The pjsua2 sample application will write log messages to '''!LogCat''' window. 160 157 161 158 … … 163 160 164 161 For developing Android application, you should use [http://www.pjsip.org/docs/book-latest/html/index.html pjsua2 API] whose Java interface available via SWIG Java binding. 165 166 Note that this has only been tested using [http://developer.android.com/tools/help/adt.html Eclipse with ADT], however it might also be applicable for [http://developer.android.com/tools/studio/index.html Android Studio].167 162 168 163 1. First, build {{{pjproject}}} libraries as described above. … … 170 165 1. Create Android application outside the PJSIP sources for your project. 171 166 1. Get pjsua2 Java interface and native library from pjsua2 sample application: 172 1. Copy pjsua2 Java interface files from {{{pjsip-apps/src/swig/java/android/ src}}} to your project's {{{src}}} folder:167 1. Copy pjsua2 Java interface files from {{{pjsip-apps/src/swig/java/android/app/src/main/java}}} to your project's {{{app/src/main/java}}} folder, e.g: 173 168 {{{ 174 $ cd $YOUR_PROJECT_DIR 175 $ cp -r $PJSIP_DIR/pjsip-apps/src/swig/java/android/ src.169 $ cd $YOUR_PROJECT_DIR/app/src/main/java 170 $ cp -r $PJSIP_DIR/pjsip-apps/src/swig/java/android/app/src/main/java . 176 171 177 172 # Cleanup excess pjsua2 application sources. 178 $ rm -r src/org/pjsip/pjsua2/app173 $ rm -r org/pjsip/pjsua2/app 179 174 }}} 180 1. Copy native library {{{libpjsua2.so}}} from {{{pjsip-apps/src/swig/java/android/ libs}}} to your project's {{{libs}}} folder:175 1. Copy native library {{{libpjsua2.so}}} from {{{pjsip-apps/src/swig/java/android/app/src/main/jniLibs}}} to your project's {{{app/src/main/jniLibs}}} folder: 181 176 {{{ 182 $ cd $YOUR_PROJECT_DIR 183 $ cp -r $PJSIP_DIR/ pjsip-apps/src/swig/java/android/libs .177 $ cd $YOUR_PROJECT_DIR/app/src/main/jniLibs 178 $ cp -r $PJSIP_DIR/{pjsip-apps/src/swig/java/android/app/src/main/jniLibs . 184 179 }}} 185 180 1. Start writing your application, please check [http://www.pjsip.org/docs/book-latest/html/index.html pjsua2 docs] for reference. … … 192 187 Follow these steps to build pjsua: 193 188 1. Make sure SWIG is in the build environment PATH. 194 - Alternatively, update SWIG path in {{{$PJDIR/pjsip-apps/src/pjsua/android/jni/ Android.mk}}} file.195 1. Run {{{ ndk-build}}} from directory {{{$PJDIR/pjsip-apps/src/pjsua/android}}} (note that the Android NDK root should be in the PATH), e.g:189 - Alternatively, update SWIG path in {{{$PJDIR/pjsip-apps/src/pjsua/android/jni/Makefile}}} file. 190 1. Run {{{make}}} from directory {{{$PJDIR/pjsip-apps/src/pjsua/android/jni}}} (note that the Android NDK root should be in the PATH), e.g: 196 191 {{{ 197 192 $ cd /path/to/your/pjsip/dir 198 $ cd pjsip-apps/src/pjsua/android 199 $ ndk-build193 $ cd pjsip-apps/src/pjsua/android/jni 194 $ make 200 195 }}} 201 1. Create Android project from pjsua. In Eclipse: 202 a. From menu: '''File''' --> '''New''' --> '''Project''' 203 a. Select '''Android Project from Existing Code''', press '''Next''' 204 a. In ''Root Directory'', put the location of '''pjsua''' source code (i.e. {{{$PJDIR/pjsip-apps/src/pjsua/android}}}) and press '''Finish''' 205 1. You may need to select different Android SDK than what is configured in pjsua. You can do this from the project's '''Properties'''. 196 1. Open pjsua2 app project in Android Studio, it is located in {{{pjsip-apps/src/pjsua/android}}}. 206 197 1. Run it. 207 198 1. You will see telnet instructions on the device's screen. Telnet to this address to operate the application. See [wiki:PJSUA-CLI PJSUA CLI Manual] for command reference. 208 199 200 201 {{{#!comment 209 202 210 203 == Debugging native code with Eclipse == #debug-native … … 234 227 }}} 235 228 1. Load the PJSIP project to Eclipse (if not yet), and try put breakpoint anywhere in the PJSIP code before launching the Android application debug configuration in Eclipse. 229 230 }}} 231 236 232 237 233 == OpenSSL Support ==