diff options
author | Nanang Izzuddin <nanang@teluu.com> | 2016-12-21 08:33:57 +0000 |
---|---|---|
committer | Nanang Izzuddin <nanang@teluu.com> | 2016-12-21 08:33:57 +0000 |
commit | 9ab2ca6fb9463c9d942bd3f0af75acc28602334b (patch) | |
tree | eb2450b449315f1e1d0c523f70879e0b578502f8 | |
parent | 4396e6f8a065a9d400039d4c21fe359d0ae07399 (diff) |
Re #1986: Convert pjsua sample app Android project from Eclipse to Android Studio.
git-svn-id: http://svn.pjsip.org/repos/pjproject/trunk@5506 74dad513-b988-da41-8d7b-12977e46ad98
27 files changed, 353 insertions, 146 deletions
diff --git a/pjsip-apps/src/pjsua/android/.classpath b/pjsip-apps/src/pjsua/android/.classpath deleted file mode 100644 index d57ec025..00000000 --- a/pjsip-apps/src/pjsua/android/.classpath +++ /dev/null @@ -1,9 +0,0 @@ -<?xml version="1.0" encoding="UTF-8"?> -<classpath> - <classpathentry kind="con" path="com.android.ide.eclipse.adt.ANDROID_FRAMEWORK"/> - <classpathentry exported="true" kind="con" path="com.android.ide.eclipse.adt.LIBRARIES"/> - <classpathentry kind="src" path="src"/> - <classpathentry kind="src" path="gen"/> - <classpathentry exported="true" kind="con" path="com.android.ide.eclipse.adt.DEPENDENCIES"/> - <classpathentry kind="output" path="bin/classes"/> -</classpath> diff --git a/pjsip-apps/src/pjsua/android/.project b/pjsip-apps/src/pjsua/android/.project deleted file mode 100644 index 937a12d5..00000000 --- a/pjsip-apps/src/pjsua/android/.project +++ /dev/null @@ -1,33 +0,0 @@ -<?xml version="1.0" encoding="UTF-8"?> -<projectDescription> - <name>pjsua</name> - <comment></comment> - <projects> - </projects> - <buildSpec> - <buildCommand> - <name>com.android.ide.eclipse.adt.ResourceManagerBuilder</name> - <arguments> - </arguments> - </buildCommand> - <buildCommand> - <name>com.android.ide.eclipse.adt.PreCompilerBuilder</name> - <arguments> - </arguments> - </buildCommand> - <buildCommand> - <name>org.eclipse.jdt.core.javabuilder</name> - <arguments> - </arguments> - </buildCommand> - <buildCommand> - <name>com.android.ide.eclipse.adt.ApkBuilder</name> - <arguments> - </arguments> - </buildCommand> - </buildSpec> - <natures> - <nature>com.android.ide.eclipse.adt.AndroidNature</nature> - <nature>org.eclipse.jdt.core.javanature</nature> - </natures> -</projectDescription> diff --git a/pjsip-apps/src/pjsua/android/app/build.gradle b/pjsip-apps/src/pjsua/android/app/build.gradle new file mode 100644 index 00000000..35fa39c7 --- /dev/null +++ b/pjsip-apps/src/pjsua/android/app/build.gradle @@ -0,0 +1,23 @@ +apply plugin: 'com.android.application'
+
+android {
+ compileSdkVersion 15
+ buildToolsVersion "23.0.3"
+
+ defaultConfig {
+ applicationId "org.pjsip.pjsua"
+ minSdkVersion 15
+ targetSdkVersion 15
+
+ ndk {
+ moduleName "libpjsua"
+ }
+ }
+
+ buildTypes {
+ release {
+ minifyEnabled false
+ proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.txt'
+ }
+ }
+}
diff --git a/pjsip-apps/src/pjsua/android/AndroidManifest.xml b/pjsip-apps/src/pjsua/android/app/src/main/AndroidManifest.xml index 97da16d3..97da16d3 100644 --- a/pjsip-apps/src/pjsua/android/AndroidManifest.xml +++ b/pjsip-apps/src/pjsua/android/app/src/main/AndroidManifest.xml diff --git a/pjsip-apps/src/pjsua/android/src/org/pjsip/pjsua/MainActivity.java b/pjsip-apps/src/pjsua/android/app/src/main/java/org/pjsip/pjsua/MainActivity.java index 927a70b6..927a70b6 100644 --- a/pjsip-apps/src/pjsua/android/src/org/pjsip/pjsua/MainActivity.java +++ b/pjsip-apps/src/pjsua/android/app/src/main/java/org/pjsip/pjsua/MainActivity.java diff --git a/pjsip-apps/src/pjsua/android/res/drawable-hdpi/main_image.png b/pjsip-apps/src/pjsua/android/app/src/main/res/drawable-hdpi/main_image.png Binary files differindex a9c5328c..a9c5328c 100755..100644 --- a/pjsip-apps/src/pjsua/android/res/drawable-hdpi/main_image.png +++ b/pjsip-apps/src/pjsua/android/app/src/main/res/drawable-hdpi/main_image.png diff --git a/pjsip-apps/src/pjsua/android/res/drawable-ldpi/main_image.png b/pjsip-apps/src/pjsua/android/app/src/main/res/drawable-ldpi/main_image.png Binary files differindex 969971f8..969971f8 100755..100644 --- a/pjsip-apps/src/pjsua/android/res/drawable-ldpi/main_image.png +++ b/pjsip-apps/src/pjsua/android/app/src/main/res/drawable-ldpi/main_image.png diff --git a/pjsip-apps/src/pjsua/android/res/drawable-mdpi/main_image.png b/pjsip-apps/src/pjsua/android/app/src/main/res/drawable-mdpi/main_image.png Binary files differindex 8312fcf2..8312fcf2 100755..100644 --- a/pjsip-apps/src/pjsua/android/res/drawable-mdpi/main_image.png +++ b/pjsip-apps/src/pjsua/android/app/src/main/res/drawable-mdpi/main_image.png diff --git a/pjsip-apps/src/pjsua/android/res/drawable-xhdpi/main_image.png b/pjsip-apps/src/pjsua/android/app/src/main/res/drawable-xhdpi/main_image.png Binary files differindex 9978b0af..9978b0af 100755..100644 --- a/pjsip-apps/src/pjsua/android/res/drawable-xhdpi/main_image.png +++ b/pjsip-apps/src/pjsua/android/app/src/main/res/drawable-xhdpi/main_image.png diff --git a/pjsip-apps/src/pjsua/android/res/layout/activity_main.xml b/pjsip-apps/src/pjsua/android/app/src/main/res/layout/activity_main.xml index 24a13372..24a13372 100644 --- a/pjsip-apps/src/pjsua/android/res/layout/activity_main.xml +++ b/pjsip-apps/src/pjsua/android/app/src/main/res/layout/activity_main.xml diff --git a/pjsip-apps/src/pjsua/android/res/values-v11/styles.xml b/pjsip-apps/src/pjsua/android/app/src/main/res/values-v11/styles.xml index d408cbc3..d408cbc3 100644 --- a/pjsip-apps/src/pjsua/android/res/values-v11/styles.xml +++ b/pjsip-apps/src/pjsua/android/app/src/main/res/values-v11/styles.xml diff --git a/pjsip-apps/src/pjsua/android/res/values-v14/styles.xml b/pjsip-apps/src/pjsua/android/app/src/main/res/values-v14/styles.xml index 1c089a78..1c089a78 100644 --- a/pjsip-apps/src/pjsua/android/res/values-v14/styles.xml +++ b/pjsip-apps/src/pjsua/android/app/src/main/res/values-v14/styles.xml diff --git a/pjsip-apps/src/pjsua/android/res/values/strings.xml b/pjsip-apps/src/pjsua/android/app/src/main/res/values/strings.xml index dd5ee690..dd5ee690 100644 --- a/pjsip-apps/src/pjsua/android/res/values/strings.xml +++ b/pjsip-apps/src/pjsua/android/app/src/main/res/values/strings.xml diff --git a/pjsip-apps/src/pjsua/android/res/values/styles.xml b/pjsip-apps/src/pjsua/android/app/src/main/res/values/styles.xml index 4dba0d0a..4dba0d0a 100644 --- a/pjsip-apps/src/pjsua/android/res/values/styles.xml +++ b/pjsip-apps/src/pjsua/android/app/src/main/res/values/styles.xml diff --git a/pjsip-apps/src/pjsua/android/build.gradle b/pjsip-apps/src/pjsua/android/build.gradle new file mode 100644 index 00000000..88c89a9a --- /dev/null +++ b/pjsip-apps/src/pjsua/android/build.gradle @@ -0,0 +1,15 @@ +// Top-level build file where you can add configuration options common to all sub-projects/modules.
+buildscript {
+ repositories {
+ jcenter()
+ }
+ dependencies {
+ classpath 'com.android.tools.build:gradle:2.2.3'
+ }
+}
+
+allprojects {
+ repositories {
+ jcenter()
+ }
+}
diff --git a/pjsip-apps/src/pjsua/android/gradle/wrapper/gradle-wrapper.jar b/pjsip-apps/src/pjsua/android/gradle/wrapper/gradle-wrapper.jar Binary files differnew file mode 100644 index 00000000..13372aef --- /dev/null +++ b/pjsip-apps/src/pjsua/android/gradle/wrapper/gradle-wrapper.jar diff --git a/pjsip-apps/src/pjsua/android/gradle/wrapper/gradle-wrapper.properties b/pjsip-apps/src/pjsua/android/gradle/wrapper/gradle-wrapper.properties new file mode 100644 index 00000000..04e285f3 --- /dev/null +++ b/pjsip-apps/src/pjsua/android/gradle/wrapper/gradle-wrapper.properties @@ -0,0 +1,6 @@ +#Mon Dec 28 10:00:20 PST 2015 +distributionBase=GRADLE_USER_HOME +distributionPath=wrapper/dists +zipStoreBase=GRADLE_USER_HOME +zipStorePath=wrapper/dists +distributionUrl=https\://services.gradle.org/distributions/gradle-2.14.1-all.zip diff --git a/pjsip-apps/src/pjsua/android/gradlew b/pjsip-apps/src/pjsua/android/gradlew new file mode 100644 index 00000000..9d82f789 --- /dev/null +++ b/pjsip-apps/src/pjsua/android/gradlew @@ -0,0 +1,160 @@ +#!/usr/bin/env bash + +############################################################################## +## +## Gradle start up script for UN*X +## +############################################################################## + +# Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script. +DEFAULT_JVM_OPTS="" + +APP_NAME="Gradle" +APP_BASE_NAME=`basename "$0"` + +# Use the maximum available, or set MAX_FD != -1 to use that value. +MAX_FD="maximum" + +warn ( ) { + echo "$*" +} + +die ( ) { + echo + echo "$*" + echo + exit 1 +} + +# OS specific support (must be 'true' or 'false'). +cygwin=false +msys=false +darwin=false +case "`uname`" in + CYGWIN* ) + cygwin=true + ;; + Darwin* ) + darwin=true + ;; + MINGW* ) + msys=true + ;; +esac + +# Attempt to set APP_HOME +# Resolve links: $0 may be a link +PRG="$0" +# Need this for relative symlinks. +while [ -h "$PRG" ] ; do + ls=`ls -ld "$PRG"` + link=`expr "$ls" : '.*-> \(.*\)$'` + if expr "$link" : '/.*' > /dev/null; then + PRG="$link" + else + PRG=`dirname "$PRG"`"/$link" + fi +done +SAVED="`pwd`" +cd "`dirname \"$PRG\"`/" >/dev/null +APP_HOME="`pwd -P`" +cd "$SAVED" >/dev/null + +CLASSPATH=$APP_HOME/gradle/wrapper/gradle-wrapper.jar + +# Determine the Java command to use to start the JVM. +if [ -n "$JAVA_HOME" ] ; then + if [ -x "$JAVA_HOME/jre/sh/java" ] ; then + # IBM's JDK on AIX uses strange locations for the executables + JAVACMD="$JAVA_HOME/jre/sh/java" + else + JAVACMD="$JAVA_HOME/bin/java" + fi + if [ ! -x "$JAVACMD" ] ; then + die "ERROR: JAVA_HOME is set to an invalid directory: $JAVA_HOME + +Please set the JAVA_HOME variable in your environment to match the +location of your Java installation." + fi +else + JAVACMD="java" + which java >/dev/null 2>&1 || die "ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. + +Please set the JAVA_HOME variable in your environment to match the +location of your Java installation." +fi + +# Increase the maximum file descriptors if we can. +if [ "$cygwin" = "false" -a "$darwin" = "false" ] ; then + MAX_FD_LIMIT=`ulimit -H -n` + if [ $? -eq 0 ] ; then + if [ "$MAX_FD" = "maximum" -o "$MAX_FD" = "max" ] ; then + MAX_FD="$MAX_FD_LIMIT" + fi + ulimit -n $MAX_FD + if [ $? -ne 0 ] ; then + warn "Could not set maximum file descriptor limit: $MAX_FD" + fi + else + warn "Could not query maximum file descriptor limit: $MAX_FD_LIMIT" + fi +fi + +# For Darwin, add options to specify how the application appears in the dock +if $darwin; then + GRADLE_OPTS="$GRADLE_OPTS \"-Xdock:name=$APP_NAME\" \"-Xdock:icon=$APP_HOME/media/gradle.icns\"" +fi + +# For Cygwin, switch paths to Windows format before running java +if $cygwin ; then + APP_HOME=`cygpath --path --mixed "$APP_HOME"` + CLASSPATH=`cygpath --path --mixed "$CLASSPATH"` + JAVACMD=`cygpath --unix "$JAVACMD"` + + # We build the pattern for arguments to be converted via cygpath + ROOTDIRSRAW=`find -L / -maxdepth 1 -mindepth 1 -type d 2>/dev/null` + SEP="" + for dir in $ROOTDIRSRAW ; do + ROOTDIRS="$ROOTDIRS$SEP$dir" + SEP="|" + done + OURCYGPATTERN="(^($ROOTDIRS))" + # Add a user-defined pattern to the cygpath arguments + if [ "$GRADLE_CYGPATTERN" != "" ] ; then + OURCYGPATTERN="$OURCYGPATTERN|($GRADLE_CYGPATTERN)" + fi + # Now convert the arguments - kludge to limit ourselves to /bin/sh + i=0 + for arg in "$@" ; do + CHECK=`echo "$arg"|egrep -c "$OURCYGPATTERN" -` + CHECK2=`echo "$arg"|egrep -c "^-"` ### Determine if an option + + if [ $CHECK -ne 0 ] && [ $CHECK2 -eq 0 ] ; then ### Added a condition + eval `echo args$i`=`cygpath --path --ignore --mixed "$arg"` + else + eval `echo args$i`="\"$arg\"" + fi + i=$((i+1)) + done + case $i in + (0) set -- ;; + (1) set -- "$args0" ;; + (2) set -- "$args0" "$args1" ;; + (3) set -- "$args0" "$args1" "$args2" ;; + (4) set -- "$args0" "$args1" "$args2" "$args3" ;; + (5) set -- "$args0" "$args1" "$args2" "$args3" "$args4" ;; + (6) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" ;; + (7) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" ;; + (8) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" ;; + (9) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" "$args8" ;; + esac +fi + +# Split up the JVM_OPTS And GRADLE_OPTS values into an array, following the shell quoting and substitution rules +function splitJvmOpts() { + JVM_OPTS=("$@") +} +eval splitJvmOpts $DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS +JVM_OPTS[${#JVM_OPTS[*]}]="-Dorg.gradle.appname=$APP_BASE_NAME" + +exec "$JAVACMD" "${JVM_OPTS[@]}" -classpath "$CLASSPATH" org.gradle.wrapper.GradleWrapperMain "$@" diff --git a/pjsip-apps/src/pjsua/android/gradlew.bat b/pjsip-apps/src/pjsua/android/gradlew.bat new file mode 100644 index 00000000..aec99730 --- /dev/null +++ b/pjsip-apps/src/pjsua/android/gradlew.bat @@ -0,0 +1,90 @@ +@if "%DEBUG%" == "" @echo off
+@rem ##########################################################################
+@rem
+@rem Gradle startup script for Windows
+@rem
+@rem ##########################################################################
+
+@rem Set local scope for the variables with windows NT shell
+if "%OS%"=="Windows_NT" setlocal
+
+@rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
+set DEFAULT_JVM_OPTS=
+
+set DIRNAME=%~dp0
+if "%DIRNAME%" == "" set DIRNAME=.
+set APP_BASE_NAME=%~n0
+set APP_HOME=%DIRNAME%
+
+@rem Find java.exe
+if defined JAVA_HOME goto findJavaFromJavaHome
+
+set JAVA_EXE=java.exe
+%JAVA_EXE% -version >NUL 2>&1
+if "%ERRORLEVEL%" == "0" goto init
+
+echo.
+echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
+echo.
+echo Please set the JAVA_HOME variable in your environment to match the
+echo location of your Java installation.
+
+goto fail
+
+:findJavaFromJavaHome
+set JAVA_HOME=%JAVA_HOME:"=%
+set JAVA_EXE=%JAVA_HOME%/bin/java.exe
+
+if exist "%JAVA_EXE%" goto init
+
+echo.
+echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME%
+echo.
+echo Please set the JAVA_HOME variable in your environment to match the
+echo location of your Java installation.
+
+goto fail
+
+:init
+@rem Get command-line arguments, handling Windowz variants
+
+if not "%OS%" == "Windows_NT" goto win9xME_args
+if "%@eval[2+2]" == "4" goto 4NT_args
+
+:win9xME_args
+@rem Slurp the command line arguments.
+set CMD_LINE_ARGS=
+set _SKIP=2
+
+:win9xME_args_slurp
+if "x%~1" == "x" goto execute
+
+set CMD_LINE_ARGS=%*
+goto execute
+
+:4NT_args
+@rem Get arguments from the 4NT Shell from JP Software
+set CMD_LINE_ARGS=%$
+
+:execute
+@rem Setup the command line
+
+set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar
+
+@rem Execute Gradle
+"%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %CMD_LINE_ARGS%
+
+:end
+@rem End local scope for the variables with windows NT shell
+if "%ERRORLEVEL%"=="0" goto mainEnd
+
+:fail
+rem Set variable GRADLE_EXIT_CONSOLE if you need the _script_ return code instead of
+rem the _cmd.exe /c_ return code!
+if not "" == "%GRADLE_EXIT_CONSOLE%" exit 1
+exit /b 1
+
+:mainEnd
+if "%OS%"=="Windows_NT" endlocal
+
+:omega
diff --git a/pjsip-apps/src/pjsua/android/jni/Android.mk b/pjsip-apps/src/pjsua/android/jni/Android.mk deleted file mode 100644 index 6e2be1e8..00000000 --- a/pjsip-apps/src/pjsua/android/jni/Android.mk +++ /dev/null @@ -1,63 +0,0 @@ -# $Id$ - -LOCAL_PATH := $(call my-dir) -include $(CLEAR_VARS) - -# Get PJ build settings -include ../../../../build.mak -include $(PJDIR)/build/common.mak - -# Path to SWIG -MY_SWIG := swig - -MY_MODULE_PATH := $(PJDIR)/pjsip-apps/build/output/pjsua-$(TARGET_NAME) -MY_MODULES := $(MY_MODULE_PATH)/pjsua_app.o \ - $(MY_MODULE_PATH)/pjsua_app_cli.o \ - $(MY_MODULE_PATH)/pjsua_app_common.o \ - $(MY_MODULE_PATH)/pjsua_app_config.o \ - $(MY_MODULE_PATH)/pjsua_app_legacy.o - -# Constants -MY_JNI_WRAP := pjsua_wrap.cpp -MY_JNI_DIR := jni - -# Android build settings -LOCAL_MODULE := libpjsua -LOCAL_CFLAGS := -Werror $(APP_CFLAGS) -LOCAL_LDFLAGS := $(APP_LDFLAGS) -LOCAL_LDLIBS := $(MY_MODULES) $(APP_LDLIBS) -LOCAL_SRC_FILES := $(MY_JNI_WRAP) pjsua_app_callback.cpp -LOCAL_CPP_FEATURES += exceptions rtti - -# Copy Java Camera helper components from pjmedia/src/pjmedia-videodev/android -src/org/pjsip/PjCamera.java: -ifneq (,$(findstring PJMEDIA_VIDEO_DEV_HAS_ANDROID=1,$(ANDROID_CFLAGS))) - @echo "Copying Android camera helper components..." - cp $(PJDIR)/pjmedia/src/pjmedia-videodev/android/PjCamera*.java src/org/pjsip -endif - -# Invoke SWIG -$(MY_JNI_DIR)/$(MY_JNI_WRAP): src/org/pjsip/PjCamera.java - @echo "Invoking SWIG..." - $(MY_SWIG) -c++ -o $(MY_JNI_DIR)/$(MY_JNI_WRAP) -package org.pjsip.pjsua -outdir src/org/pjsip/pjsua -java $(MY_JNI_DIR)/pjsua.i - -.PHONY: $(MY_JNI_DIR)/$(MY_JNI_WRAP) - -include $(BUILD_SHARED_LIBRARY) - - -# Add prebuilt libopenh264, if configured -ifneq (,$(OPENH264_LDFLAGS)) -include $(CLEAR_VARS) -LOCAL_MODULE := libopenh264 -LOCAL_SRC_FILES := $(subst -L,,$(filter -L%,$(OPENH264_LDFLAGS)))/libopenh264.so -include $(PREBUILT_SHARED_LIBRARY) -endif - -# Add prebuilt libyuv, if configured -ifneq (,$(LIBYUV_LDFLAGS)) -include $(CLEAR_VARS) -LOCAL_MODULE := libyuv -LOCAL_SRC_FILES := $(subst -L,,$(filter -L%,$(LIBYUV_LDFLAGS)))/libyuv.so -include $(PREBUILT_SHARED_LIBRARY) -endif diff --git a/pjsip-apps/src/pjsua/android/jni/Application.mk b/pjsip-apps/src/pjsua/android/jni/Application.mk deleted file mode 100644 index 2d8a9edc..00000000 --- a/pjsip-apps/src/pjsua/android/jni/Application.mk +++ /dev/null @@ -1,2 +0,0 @@ -# It might be necessary to define APP_ABI if you are using other than armeabi, e.g: arm64-v8a -# APP_ABI := arm64-v8a diff --git a/pjsip-apps/src/pjsua/android/jni/Makefile b/pjsip-apps/src/pjsua/android/jni/Makefile new file mode 100644 index 00000000..1ce34921 --- /dev/null +++ b/pjsip-apps/src/pjsua/android/jni/Makefile @@ -0,0 +1,56 @@ +include ../../../../../build.mak
+include ../../../../../build/common.mak
+
+MY_MODULE_PATH := $(PJDIR)/pjsip-apps/build/output/pjsua-$(TARGET_NAME)
+MY_MODULES := $(MY_MODULE_PATH)/pjsua_app.o \
+ $(MY_MODULE_PATH)/pjsua_app_cli.o \
+ $(MY_MODULE_PATH)/pjsua_app_common.o \
+ $(MY_MODULE_PATH)/pjsua_app_config.o \
+ $(MY_MODULE_PATH)/pjsua_app_legacy.o
+
+OUT_DIR := ../build/jni
+LIBPJSUA_SO := ../app/src/main/jniLibs/armeabi/libpjsua.so
+
+# Env settings, e.g: path to SWIG, JDK, java(.exe), javac(.exe)
+MY_SWIG := swig
+MY_JNI_CFLAGS := -D__ANDROID__
+MY_JNI_LDFLAGS := -Wl,-soname,libpjsua.so
+SWIG_FLAGS := -D__ANDROID__ -c++
+
+# Build settings
+MY_CFLAGS := $(PJ_CXXFLAGS) $(CFLAGS)
+MY_LDFLAGS := $(PJ_LDXXFLAGS) $(PJ_LDXXLIBS) $(LDFLAGS)
+MY_PACKAGE_NAME := org.pjsip.pjsua
+MY_PACKAGE_PATH := ../app/src/main/java/$(subst .,/,$(MY_PACKAGE_NAME))
+
+all: $(LIBPJSUA_SO) java
+
+$(LIBPJSUA_SO): $(OUT_DIR)/pjsua_wrap.o
+ mkdir -p ../app/src/main/jniLibs/armeabi
+ $(PJ_CXX) -shared -o $(LIBPJSUA_SO) \
+ $(OUT_DIR)/pjsua_wrap.o $(OUT_DIR)/pjsua_app_callback.o \
+ $(MY_MODULES) \
+ $(MY_CFLAGS) $(MY_LDFLAGS)
+
+$(OUT_DIR)/pjsua_wrap.o: $(OUT_DIR)/pjsua_wrap.cpp pjsua_app_callback.cpp Makefile
+ $(PJ_CXX) -c $(OUT_DIR)/pjsua_wrap.cpp -o $(OUT_DIR)/pjsua_wrap.o \
+ $(MY_CFLAGS)
+ $(PJ_CXX) -c pjsua_app_callback.cpp -o $(OUT_DIR)/pjsua_app_callback.o \
+ $(MY_CFLAGS)
+
+$(OUT_DIR)/pjsua_wrap.cpp: pjsua.i
+ mkdir -p $(MY_PACKAGE_PATH)
+ mkdir -p $(OUT_DIR)
+ swig $(SWIG_FLAGS) -java -package $(MY_PACKAGE_NAME) \
+ -outdir $(MY_PACKAGE_PATH) \
+ -o $(OUT_DIR)/pjsua_wrap.cpp pjsua.i
+
+clean distclean realclean:
+ rm -rf $(LIBPJSUA_SO) $(OUT_DIR)/* \
+ $(MY_PACKAGE_PATH)/*.java
+
+java:
+ifneq (,$(findstring PJMEDIA_VIDEO_DEV_HAS_ANDROID=1,$(ANDROID_CFLAGS)))
+ @echo "Copying Android camera helper components..."
+ cp $(PJDIR)/pjmedia/src/pjmedia-videodev/android/PjCamera*.java $(MY_PACKAGE_PATH)/..
+endif
diff --git a/pjsip-apps/src/pjsua/android/jni/pjsua.i b/pjsip-apps/src/pjsua/android/jni/pjsua.i index 28f76d7e..e98954a4 100755 --- a/pjsip-apps/src/pjsua/android/jni/pjsua.i +++ b/pjsip-apps/src/pjsua/android/jni/pjsua.i @@ -1,8 +1,8 @@ %module (directors="1") pjsua %{ -#include "pjsua_app_callback.h" -#include "../../pjsua_app.h" +#include "../../jni/pjsua_app_callback.h" +#include "../../../pjsua_app.h" #if defined(PJMEDIA_HAS_VIDEO) && PJMEDIA_HAS_VIDEO!=0 # include <android/native_window_jni.h> diff --git a/pjsip-apps/src/pjsua/android/lint.xml b/pjsip-apps/src/pjsua/android/lint.xml deleted file mode 100644 index ee0eead5..00000000 --- a/pjsip-apps/src/pjsua/android/lint.xml +++ /dev/null @@ -1,3 +0,0 @@ -<?xml version="1.0" encoding="UTF-8"?> -<lint> -</lint>
\ No newline at end of file diff --git a/pjsip-apps/src/pjsua/android/proguard-project.txt b/pjsip-apps/src/pjsua/android/proguard-project.txt deleted file mode 100644 index f2fe1559..00000000 --- a/pjsip-apps/src/pjsua/android/proguard-project.txt +++ /dev/null @@ -1,20 +0,0 @@ -# To enable ProGuard in your project, edit project.properties -# to define the proguard.config property as described in that file. -# -# Add project specific ProGuard rules here. -# By default, the flags in this file are appended to flags specified -# in ${sdk.dir}/tools/proguard/proguard-android.txt -# You can edit the include path and order by changing the ProGuard -# include property in project.properties. -# -# For more details, see -# http://developer.android.com/guide/developing/tools/proguard.html - -# Add any project specific keep options here: - -# If your project uses WebView with JS, uncomment the following -# and specify the fully qualified class name to the JavaScript interface -# class: -#-keepclassmembers class fqcn.of.javascript.interface.for.webview { -# public *; -#} diff --git a/pjsip-apps/src/pjsua/android/project.properties b/pjsip-apps/src/pjsua/android/project.properties deleted file mode 100644 index 9b84a6b4..00000000 --- a/pjsip-apps/src/pjsua/android/project.properties +++ /dev/null @@ -1,14 +0,0 @@ -# This file is automatically generated by Android Tools. -# Do not modify this file -- YOUR CHANGES WILL BE ERASED! -# -# This file must be checked in Version Control Systems. -# -# To customize properties used by the Ant build system edit -# "ant.properties", and override values to adapt the script to your -# project structure. -# -# To enable ProGuard to shrink and obfuscate your code, uncomment this (available properties: sdk.dir, user.home): -#proguard.config=${sdk.dir}/tools/proguard/proguard-android.txt:proguard-project.txt - -# Project target. -target=android-16 diff --git a/pjsip-apps/src/pjsua/android/settings.gradle b/pjsip-apps/src/pjsua/android/settings.gradle new file mode 100644 index 00000000..d3db1092 --- /dev/null +++ b/pjsip-apps/src/pjsua/android/settings.gradle @@ -0,0 +1 @@ +include ':app'
|