How to building and running apjsua sample application - android

I wanted to try PJSIP on an Android AVD.
I performed the following steps :
Now, the next step says :
Building and running apjsua sample application
We have apjsua sample application located under pjsip-apps/src/apjsua. It is not built by default, and you need SWIG to build it.
Follow these steps to build apjsua:
Make sure SWIG is in the build environment PATH. Alternatively, update
SWIG path in $PJDIR/pjsip-apps/src/apjsua/jni/Android.mk file. Run
ndk-build from directory $PJDIR/pjsip-apps/src/apjsua, note that the
Android NDK root should be in the PATH, e.g:
Create Android project from apjsua. In Eclipse: From menu: File -->
New --> Project Select Android Project from Existing Code, press Next
In Root Directory, put the location of apjsua source code (i.e.
$PJDIR/pjsip-apps/src/apjsua) and press Finish You may need to select
different Android SDK than what is configured in apjsua. You can do
this from the project's Properties. You can modify
apjsua/res/raw/config.txt for apjsua's config file. Run it.
My question is :
How to use swig? I am very confused.

Don't worry about swig. You should compile it, and add it to the environment path.
ndk-build will call swig application. You can add it to the PATH by typing in terminal
PATH=$PATH:/path/to/swig , where /path/to/swig is location on your computer of swig app.

Related

Develop app specifically for my custom android ROM

I have a custom ROM with some modified classes and a few new ones, and I need to develop an app which uses this modified version of the android API. How can i achieve that? In other words, how can i import new classes (and use new methods in the old classes) from the custom ROM in my app development environment (eclipse and android sdk)?
If you're using eclipse, you can achieve that by creating a jar of all the android framework classes, including your new classes, than add it as a library in your project.
The ADT plugin will automatically add it to the "Android Dependencies" which is exported with your APK. But you propbably don't want to include it in your final APK.
So, in your project's properties window, go into "Java Build Path", then select the tab "Order and Export", then uncheck the "Android Dependencies", and check all libraries that you may be using in your app that was in the group and you want exported.
I found 2 options to do this:
-> Find out the jar to substitute in the sdk platform in use, instead of making the jar file myself:
out/target/common/obj/JAVA_LIBRARIES/android_stubs_current_intermediates/classes.jar
(Did not tested this one, the first worked fine for me)
-> Do the following steps to build the sdk:
1. Use repo init -g all ; repo sync to get some dependencies in the aosp root directory;
2. source build/envsetup.sh;
3. lunch sdk-eng;
4. make sdk A directory will be created somewhere inside "out" directory, with a name like "android-sdk_eng.USERNAME_linux-x86";
5. In Eclipse: Preferences > Android, select SDK Location and point to the new directory created;
You can copy the directory to somewhere else before point eclipse to it.
Some links to the source of that information: here and here

Tesseract OCR Android in Windows

I've read all of questions forums and blogs about it but i still have a problem. Firstly, i ticked tess-two as a library also my project's using tess-two as a library. I downloaded Android-NDK and from my project's properties i clicked Builders and then new -> Program then i choose ndk's ndk-build file. By the way my project is Gautam Gupta's project. He'd given project. Link: https://github.com/GautamGupta/Simple-Android-OCR. When i run that project in my phone, application starts and captures photo but when i press save then application gives error below. http://t1307.hizliresim.com/1c/l/qg0rl.png
Looks like you need to download only TessTwo, make sure you have properly setup the environments variables (ANT_HOME, ANDROID_HOME and ANDROID_NDK) so these point to where you have Ant and Android SDKs.
Then it's a matter of building the project by following TessTwo guidance. That you set up the library-project that can be imported.
Don't forget that the line commands must be performed in CygWin. Once the library project is built you should have correct .so files in libs/*. In order to actually use these, you could start with this link.
#Burak:
I have solved my problem. For Windows;
Write the codes below to Cygwin
a.cd <project-path'i>/tess-two
b.export TESSERACT_PATH=${PWD}/external/tesseract-3.01
c.export LEPTONICA_PATH=${PWD}/external/leptonica-1.68
d.export LIBJPEG_PATH=${PWD}/external/libjpeg
e./cygdrive/<ndk-directory>/ndk-build
Write the codes below to CMD
f.android update project --target 1 --path .
g. ant release
Don't forget the "." at step f.

How to setup cocos2dx for android on MacOs Lion?

I am trying to setup cocos2dx with eclipse on a MacOs Lion. I am following the tutorial below:
http://www.raywenderlich.com/11283/cocos2d-x-for-ios-and-android-getting-started
When I try and execute the ndk build shell tool i get the following error:
Davids-iMac:~ davidcavanagh$ /Users/davidcavanagh/Downloads/android-ndk-r8b/ndk-build ;
exit;
Android NDK: Could not find application project directory !
Android NDK: Please define the NDK_PROJECT_PATH variable to point to it.
/Users/davidcavanagh/Downloads/android-ndk-r8b/build/core/build-local.mk:130: *** Android
NDK: Aborting . Stop.
logout
[Process completed]
I have tried defining the NDK_PROJECT_PATH through the terminal by using
export NDK_PROJECT_PATH=/Users/davidcavanagh/Downloads/android-ndk-r8b/
This doesn't work. Can anyone help me as I have been stuck on this for ages. Is there a certain way of setting the path that I am not doing?
Thanks
Re-read and re-read again his tutorial. You shouldn't be executing the ndk-build script without supplying the arguments it needs for building your project.
He mentions using the create-android-project.sh script inside the cocos2d-x directory. Make sure you do that, and follow the steps there where you'll supply the project name, reverse-domain application ID (e.g. com.company.project), and so on. This will generate your project directory inside of the cocos2d-x directory, which you can easily & safely move to another location.
Once you have that project set up, you can import it into Eclipse, which, primarily, allows you to build the Android project, but does not refer to the C++ code directly. (You'd need to get CDT and the NDK plugin to actually hook your C++ code up inside of Eclipse).
Otherwise, what's worked for me so far is to run the build_native.sh script inside the project directory whenever I have new code that I want to test on my device. This script references the jni/Android.mk file, where you need to specify your header paths and *.cpp files (similar to how you'd have to specify all of your implementation files with g++ on the command line).
But before you do that, you need to make sure all the environment variables that build_native.sh uses are set up. You can either put them in your ~/.bashrc file, or you can just stick them in that project directory (up to you. bashrc will make them available to all projects whenever you launch a new terminal, whereas hardcoding them into build_native.sh will only offer them to that specific project). I think all you need is to assign the full paths to NDK_ROOT, COCOS2DX_ROOT, and APP_ROOT, and build_native.sh should run successfully.
If you look down at the bottom of build_native.sh, you'll notice an invocation of ndk-build, along with all the necessary parameters that you were missing in your terminal session.

Ant Build Android Project With Dependencies

I'm trying to build an app (let's call it android-app) with a dependency on an SDK (let's call it sdk) via Ant. Eclipse is not installed on this computer (for reasoning, it's a CI box with Jenkins).
Both projects are in two completely separate directories side by side. android-app is in the directory ~/.jenkins/jobs/android-app/workspace and sdk is in the directory ~/.jenkins/jobs/sdk/workspace.
Let's assume both projects are "vanilla" and have not been built with Ant before. I cd to the ../android-app/workspace directory and run android update project -p . --library ~/.jenkins/jobs/sdk/workspace which passes. I then cd to the ../sdk/workspace directory and run android update project -p . which also passes.
At this point I cd back to the ../android-app/workspace directory and run ant clean build. It fails with the error:
BUILD FAILED
/path/to/ant/build.xml:440:
/path/to/sdk/workspace resolve to a path with no project.properties file for
project /path/to/android-app/workspace
... where /path/to is the full path to the directories. I simplified it here.
If I cd to the sdk workspace and open project.properties, I receive the following:
# ProGuard
proguard.config=proguard.cfg
# Project target.
target=android-10
android.library=true
It does exist. So do all of these files:
So, why is this failing? What am I doing wrong? I tried to provide as many details as possible. Please let me know if I can provide anything additional.
Well, I encounter this problem too.
I use strace to find out what the hell is going on and found that the path you specified in project.properties will be appended with your current folder path as its prefix.
For example,
/home/myfolder/project > ant debug
And the library you specified in project.properties is /path/to/library
Then, the path will become
/home/myfolder/project/path/to/library
Just to fill in the answer gap here, my Java version was completely off. I'm super embarrassed.

New android SDK 17 issue in my app?

Today i was update my android sdk to new android adk-17 .
i am facing some problems in this, that is unable to show AddMob in my app, if i remove addmob in the code able to run the app without any errors otherwise not. what is the solution for this, is this bug in new sdk.
this is the Logcat information
Caused by: java.lang.ClassNotFoundException: com.google.ads.AdView in loader
dalvik.system.PathClassLoader[/data/app/com.veritra.iflipout-1.apk]
Maybe the ADK update has messed-up with your project's build-path.
Try removing the admob JAR and add it again to your libs folder, add it to your Build Path and do a Clean Project.
Anyway it's hard to help you without more details on the error you encounter.
EDIT following poster's comment about not having a libs folder:
You should try this:
Remove all references to the AdMob JAR in your project -> your code should not build without error anymore
Create à libs folder at the root of your project
Copy the AdMob JAR into the libs folder
Make sure this AdMob JAR is in your Build Path (this will allow your code to build wihtout error)
(If still not running OK) Right click your project > Android Tools > Fix Project Properties
The 'problem' here is that the SDK is a lot more strict about the libraries. If you do not check the library as 'exported' in eclipse, it is not added to your APK, leading to this nasty class not found exception. You should mark your libraries as exported.
Project Properties | Java Build Path | Order and Export
when I updated my SDK it was total mess. Well, the only I had to change was the PATH in Environment Variables.
http://developer.android.com/sdk/installing.html :
Adding both tools/ and platform-tools/ to your PATH lets you run command line tools without needing to supply the full path to the tool directories. Depending on your operating system, you can include these directories in your PATH in the following way:
On Windows, right-click on My Computer, and select Properties. Under the Advanced tab, hit the Environment Variables button, and in the dialog that comes up, double-click on Path (under System Variables). Add the full path to the tools/ and platform-tools/ directories to the path.
On Linux, edit your ~/.bash_profile or ~/.bashrc file. Look for a line that sets the PATH environment variable and add the full path to the tools/ and platform-tools/ directories to it. If you don't see a line setting the path, you can add one:
export PATH=${PATH}:/tools:/platform-tools
On a Mac OS X, look in your home directory for .bash_profile and proceed as for Linux. You can create the .bash_profile if you don't already have one.

Categories

Resources