I am beginner with Android and I have to make a voip app and after searching I found that the better opensource library for that is PJSIP.
I download the below things to build the PJSIP library:
PJSIP from here
Android NDK
SWIG
...But I don't know how to start. I checked this link for the official PJSIP website but I didn't make any progress.
Which Directory do I have to put the Android NDK into?
How to use SWIG to build the PJSIP?!
which Directory i have to put the Android NDK ?
Put it where you want, later you will setup the path to it
$ export ANDROID_NDK_ROOT=/path_to_android_ndk_dir
how to use SWIG to build the PJSIP ?!
You don't need SWIG to compile the PJSIP sources, it's needed only if you want to build and and run the sample application PJSUA.
Updated
The steps to build sources are
Download sources from PJSIP site. Pay attention if you will compile on Windows machine download .zip file, if on Unix machine (including OS X) then download .bz2 file.
Go to pjlib/include/pj/ from the downloaded sources. Create (or overwrite) a file called config_site.h. Copy the following code snippet
#define PJ_CONFIG_ANDROID 1
#include <pj/config_site_sample.h>
Open Cmd or Terminal
Go to pjsip root folder (the downloaded sources)
$ cd /path/to/your/pjsip/dir
Export bash var ANDROID_NDK_ROOT as a environment variable. Variable value should be the path of android ndk directory.
$ export ANDROID_NDK_ROOT=/path_to_android_ndk_dir (Unix)
SET ANDROID_NDK_ROOT=/path_to_android_ndk_dir (Windows)
Perform build for target armeabi
$ ./configure-android
If you need to perform build for
target arm64-v8a do $ TARGET_ABI=armeabi-v8a ./configure-android --use-ndk-cflags
target armeabi-v7a do $ TARGET_ABI=armeabi-v7a ./configure-android --use-ndk-cflags
target x86 do $ TARGET_ABI=x86 ./configure-android --use-ndk-cflags
Compile sources
$ make dep && make clean && make
Related
I am using ijkplayer in my android app that I compile using
compile 'tv.danmaku.ijk.media:ijkplayer-java:0.4.5'
compile 'tv.danmaku.ijk.media:ijkplayer-armv7a:0.4.5'
It works perfectly loading http urls but if I try to load https urls I get this error
https protocol not found, recompile FFmpeg with openssl, gnutls, or securetransport enabled.
and can't load my video. I don't know if it makes any difference but the url I am trying to load is a .m3u8 but if it is http works fine.
How can I recompile ffmpeg in this lib?
Hi Petro i am not proffesional but hope this tutorial would help.
You have to compile ijkplayer with openssl support to open https links,
to do that follow this steps:
Grab latest version of IjkPlayer from github:
$ git clone https://github.com/Bilibili/ijkplayer.git
Open just downloaded folder ijkplayer
Remove symlinks to module.sh and create symlink to module-lite.sh
$ cd config
$ rm module.sh
$ ln -s module-lite.sh module.sh
Do initialisation of OpenSSL (getting ready to download and compile openssl first)
$ cd ..
$ ./init-android-openssl.sh
Make sure you have pointed for your SDK and NDK path.
(NDK r10e preffered - I am not sure if SDK is needed but just in case i did exported it)
NOTE: make sure you have changed your path properly that is only example of path what i have used.
export ANDROID_SDK="/home/ZiomusGorliczanin/SDK"
export ANDROID_NDK="/home/ZiomusGorliczanin/NDK"
Open IjkPlayer/android/contrib folder and fire up compile-openssl.sh clean and all command (that will compile openssl for all processors).
$ cd android/contrib
$ ./compile-openssl.sh clean
$ ./compile-openssl.sh all
Compilation might take a while 10 min.
Compile FFMpeg with OPENSSL for all processors:
$ cd android/contrib
$ ./compile-ffmpeg.sh clean
$ ./compile-ffmpeg.sh all
Finally compile IjkPlayer with all above as a liblary.
$ cd ..
$ ./compile-ijk.sh all
After all this steps you should have liblaries in those folders (Three *.so files):
ijkplayer/ijkplayer-armv5/src/main/libs
ijkplayer/ijkplayer-armv7a/src/main/libs
ijkplayer/ijkplayer-arm64/src/main/libs
ijkplayer/ijkplayer-x86/src/main/libs
Try to import gradle project to your Android Studio and Run Ijk-Example for testing.
If you got this error
./compile-ijk.sh profiler build: NO
It is because of security policy of Apple in MacBook, so there is alternative solution for this to go to Apple menu-->System Preferences-->Security & Policy and Allow anyway it will prompt there.
I would like to compile and deploy on an Android device a simple helloworld program written using Qt purely using vi/emacs and the OS X command line, without using QtCreator or Android Studio.
This page describes how to fill in values for ANDROID_SDK_ROOT, ANDROID_NDK_ROOT, etc, before compiling Qt5. I have in the past used QtCreator to compile for Android without having to compile Qt itself, and I'm now wondering whether it's possible to use a command-line toolchain to do the same.
The steps I've taken so far are:
Installed the Android SDK.
Installed the Android NDK.
Installed Qt5 by sudo port install qt5-mac.
After this last step, I duly see /opt/local/share/qt5/mkspecs/android-g++, which suggests that the first step ought to be qmake -spec android-g++.
Have you successfully compiled on OS X and deployed to Android a Qt project from the command line without having to compile Qt itself?
Update
Running sudo port install qt5-mac on OS X appears not to install Qt-for-android. Download instead qt-opensource-mac-x64-1.6.0-8-online.dmg. Mount/run. Click until Select Components. Make sure Android armv7 is selected.
What you need:
- Java JDK
- Apache ANT
- Android SDK
- Android NDK
- Qt for Android
Set the environment variables (change accordingly):
export ANDROID_HOME=/Path/To/AndroidSDK
export ANDROID_NDK_HOST=linux-x86
export ANDROID_NDK_PLATFORM=android-12
export ANDROID_NDK_ROOT=/Path/To/AndroidNDK
export ANDROID_NDK_TOOLCHAIN_PREFIX=arm-linux-androideabi
export ANDROID_NDK_TOOLCHAIN_VERSION=4.8
export ANDROID_NDK_TOOLS_PREFIX=arm-linux-androideabi
export ANDROID_SDK_ROOT=/Path/To/AndroidSDK
export ANDROID_API_VERSION=android-12
export JAVA_HOME=/Path/To/JavaJDK
export PATH=$PATH:$ANDROID_HOME/tools:/Path/To/ApacheANT/bin:$JAVA_HOME/bin
If you're on OS X, use the following line instead:
export ANDROID_NDK_HOST=darwin-x86_64
Build for Android:
mkdir build_myproj_android
cd build_myproj_android
/Path/To/QtForAndroid/bin/qmake -r -spec android-g++ /Path/To/MyProject/MyProject.pro
make
make install INSTALL_ROOT=android
/Path/To/QtForAndroid/bin/androiddeployqt --output android --verbose --input android-libMyProject.so-deployment-settings.json
And finally, deploy using:
/Path/to/AndroidSDK/platform-tools/adb install /Path/to/build_myproj_android/android/bin/QtApp-debug.apk
Thanks Marian that has wrote a complete response. just if you are going to sign your package too, say it to androiddeployqt by:
/Path/To/QtForAndroid/bin/androiddeployqt --output android --verbose --input android-libMyProject.so-deployment-settings.json --sign <url/to/keystore> <alias> --storepass <password>
I tried to make a standalone Android NDK toolchain on Linux 64 bit:
~/build/android-ndk-r9/build/tools $ ./make-standalone-toolchain.sh --platform=android-14 --ndk-dir=/home/user/build/android-ndk-r9 --system=linux-x86_64 --install-dir=/home/user/build/android-14-toolchain
Auto-config: --toolchain=arm-linux-androideabi-4.6
Copying prebuilt binaries...
No files are actually copied. Something goes wrong. The NDK ist the latest release r9.
How can I run the script so that the files get copied to the installation directory?
A suggestion: Use the --verbose option if you haven't already done so; it will tell you in which stage the error occurs.
Here are the options I ran to make a standalone toolchain targeting android-14 and arm-linux-androideabi-4.7
sudo sh make-standalone-toolchain.sh --verbose --toolchain=x86-4.7\
--install-dir=/project/arm-cc --ndk-dir=/project/android/ndk/android-ndk-r9\
--platform=android-14
I am building Linphone application for android. I am using windows xp 32 bit.
1) Download android ndk
2) Installed the autotools: autoconf, automake, aclocal, libtoolize pkgconfig
3) run the ./prepare_sources.sh/
I got the output in terminal as
$ ./prepare_sources.sh /cygdrive/d/android/androidNdk/android-ndk-r8d
using /cygdrive/d/android/androidNdk/android-ndk-r8d as android NDK
./prepare_sources.sh: line 23: git: command not found
Applying patch to ffmpeg
can't find file to patch at input line 3
Perhaps you used the wrong -p or --strip option?
The text leading up to this was:
|--- submodules/externals/ffmpeg/libavcodec/arm/int_neon.S.orig 2011-09-30 19:43:21.935593025 +0200
|+++ submodules/externals/ffmpeg/libavcodec/arm/int_neon.S 2011-09-30 19:44:21.115168033 +0200
File to patch:
Any info, questions or anything really is highly appreciated
Part 1
The following steps can help you create and install the build on your device or emulator(Tested on Mac):
Step1: you need to have the Android SDK and NDK configured and istalled
Also install Autotools Mac users can use this link (Follow point 2.3 only in the link)
Other platform users please make sure you install it correctly.
Step2: Mac users open up your terminal and clone the git repo on any directory you want
to by running the following command: (Other users sorry i don't know how but i think you can figure it out that how you can get the git repo on your directory using command promt or whatever you are using)
$ git clone git://git.linphone.org/linphone-android.git --recursive
After you get the Repo copied into your directory now go to the directory and open the README file and read out the whole file.
Step3: Now we will follow as the instructions written in README file
First Go to root directory of the downloaded project using the following command on Terminal:
Mac users on terminal write cd and
then drag and drop the "linphone-android" folder on terminal
(when you drag and drop the folder terminal will get the path of the folder and then you can hit enter to get into the directory of that folder)
$ cd /Users/myname/Desktop/Android/linphone-android
or just use simple command cd to get into the folder
$ cd Desktop
$ cd Android
$ cd linphone-android
Now when you get into the directory on terminal then check your PATH of SDK & NDK installed on your Mac run
$ echo $PATH
if you see the path with SDK and NDK location then it's ok to proceed with Step4 and skip the below part and if not then you need to setup the PATH before you execute the make and make install script in Step 4:
To set up path use :
$ export PATH=/Users/myname/Documents/adt-bundle-mac-x86_64-20130729/sdk/platform-tools:/Users/myname/Documents/adt-bundle-mac-x86_64-20130729/sdk/tools:/Users/myname/Documents/android-ndk-r9:$PATH
it's like export PATH=(Path of your SDK platform tools folder):(Path of your SDK tools folder):(Path of your NDK folder):$PATH
This will set up the path and to confirm again run
$ echo $PATH
Now you will see that the path of SDK and NDK is there.
Step 4: Now if the Path is already setup you can simply run
$ make
Now connect your Device to you Mac/Pc and see if eclipse has detected it.
After the device is connected run:
$ make install
$ make generate-sdk (optional)
This will install the application into your phone. (you need to have an working SIP username and password to configure in the app)
This above steps worked for me and i was able to get the app running on my device.
Part 2
Importing into Eclipse :
After you have made your build then now you need to import it into eclipse.
Step1: Go to eclipse click on File Menu then Import then select
Existing Android Code into Workspace
Hit Next and Browse to the linphone-android project folder
And Only tick linphone-android folder and Leave Copy project into workspace untick.
Do this Like the below image:
And hit finish.
Now you right click on "linphone-android" (project name) and go to Properties and Java Build Path and then Order and Export and then reorder them as my image below and untick gcm.jar
Hit OK
And Boom No errors
Now just run it on device or emulator. (Make sure your minimum target SDK matches with your device or emulator.)
The above steps worked fine for me and it will work for you as well.
All the Best !!
According to README in root dir of linphone-android you don't need to run prepare_sources.sh, remaining steps for you is to run "make" and "make install":
LINPHONE for ANDROID
**************
To build liblinphone for Android, you must:
0) download the Android sdk with platform-tools and tools updated to latest revision (at least API 16 is needed), then add both 'tools' and 'platform-tools' folders in your path.
1) download the Android ndk (>=r8b) from google and add it to your path.
2) install the autotools: autoconf, automake, aclocal, libtoolize, pkgconfig
2bis) on some 64 bits systems you'll need the ia32-libs package
3) run the Makefile script in the top level directory. This will download iLBC source files and convert some assembly files in VP8 project.
$ make
4) To install the generated apk into a plugged device, run
$ make install
Existing answers shows how to build old linphone but to Build Latest Linphone for Android You can follow these Steps:
1) First Download Android SDK (at least API 16 is needed)
2) Then Download Android NDK(>=r9d) from Google.
3) Then Install cmake, python, yasm nasm Dependencies which is further required while installing Linphone. you can install these tool through Terminal.
4) Then You have to download source code of Linphone using following command:
git clone git://git.linphone.org/linphone-android.git --recursive
5) After Downloading Source code You have to set Path of Android SDK,NDK and also JDK
in Android SDK You have to give path upto Tools.
For Example : in console type following command
export SDK_PATH=/home/rajesh/android/adt_bundle/sdk
export NDK_PATH=/home/rajesh/android/android-ndk-r10c
export JDK_PATH=/usr/lib/jvm/java-7-openjdk-i386/
export PATH=$PATH:$NDK_PATH:$SDK_PATH/platform-tools:$SDK_PATH/tools:$JDK_PATH
6) After setting path you have to navigate through Linphone directory and type command “./prepare.py” then This will configure the build and generate a Makefile in the top level directory.
If you get following error: CMake Error Could not find the intltoolize program then
Refer
http://lists.nongnu.org/archive/html/linphone-users/2015-07/msg00092.html
7) After setting path you have to navigate through Linphone directory and type command “make” then it will generate apk for Linphone.
8) To generate a liblinphone SDK zip containing a full jar and native libraries, run
$ make liblinphone-android-sdk
I hope this helps.
similar questions have been asked:
How to run NDK samples?
Making Android NDK apps with NativeActivity?
I've got the command-line documentation down to the point where I can create an empty Android project, I do not know how to build-install-run the NDK examples, particularly the NativeActivity one, in a non-Eclipse build environment (Ubuntu 10.0.04).
So my questions are
does the NativeActivity example "just work" or do you have to do something besides just $adb -d shell "am start -a android.intent.action.MAIN -n com.example.nativeActivity"?
How do you build, install, run the NativeActivity example?
I can't answer about this specific example. But here's the general process for building and installing an Android application which uses the NDK.
cd to the root of its source code.
Run ndk-build. This builds the native code, and should result in some .so files being put into the libs directory.
android update project --path . --name something
ant debug (or similar). This will build the Java code and create an .apk. Crucially, the build process will pick up the .so files left within the libs directory and include them into the .apk.
adb install bin/name-of-project.apk
Then launch as normal using the Android GUI or using an am start command such as you give.