Changes between Version 69 and Version 70 of Getting-Started/Android


Ignore:
Timestamp:
01/18/17 07:15:21 (3 months ago)
Author:
nanang
Comment:

Replaced Eclipse with Android Studio

Legend:

Unmodified
Added
Removed
Modified
  • Getting-Started/Android

    v69 v70  
    99 
    1010 * 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): 
    1212  * [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] 
    1415  * Telnet application to interact with PJSUA command line. If you are not familiar with telnet, please find a tutorial suitable for your development platform. 
    1516 
     
    144145     }}} 
    145146    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}}}. 
    155152 1. Run it. 
    156153 
    157154=== Log output === 
    158155 
    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'') 
     156The pjsua2 sample application will write log messages to '''!LogCat''' window. 
    160157 
    161158 
     
    163160 
    164161For 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]. 
    167162 
    168163 1. First, build {{{pjproject}}} libraries as described above. 
     
    170165 1. Create Android application outside the PJSIP sources for your project. 
    171166 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: 
    173168       {{{ 
    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 . 
    176171 
    177172# Cleanup excess pjsua2 application sources. 
    178 $ rm -r src/org/pjsip/pjsua2/app 
     173$ rm -r org/pjsip/pjsua2/app 
    179174       }}} 
    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: 
    181176       {{{ 
    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 . 
    184179       }}} 
    185180 1. Start writing your application, please check [http://www.pjsip.org/docs/book-latest/html/index.html pjsua2 docs] for reference. 
     
    192187Follow these steps to build pjsua: 
    193188 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: 
    196191     {{{ 
    197192$ cd /path/to/your/pjsip/dir 
    198 $ cd pjsip-apps/src/pjsua/android 
    199 $ ndk-build 
     193$ cd pjsip-apps/src/pjsua/android/jni 
     194$ make 
    200195     }}} 
    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}}}. 
    206197 1. Run it. 
    207198 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. 
    208199 
     200 
     201{{{#!comment 
    209202 
    210203== Debugging native code with Eclipse == #debug-native 
     
    234227     }}} 
    235228 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 
    236232 
    237233== OpenSSL Support ==