Blog 2.0

All Posts (1165)

Hello Friends,

Recently I got an opportunity to work on a POC of porting G711 Codec library written in C to android using JNI on linux platform.

I learnt quite a new things while working on this project. This article is just to share with you those experiences so that you will have minimum difficulties in future if you want to port a C/c++ library on android.

 First and foremost I will introduce some basic concepts that are required.


JNI(Java Native Interface):- JNI is nothing but programming in native languages(C/C++) for java that is used when 

  • one needs to access core device features that cannot be accessed using available APIs in Java.   
  • you already have developed a module in another language and want to make use of it in java.
  • there is a performance critical requirement.


Android NDK(Native Development Kit):- This is a toolset provided by Android to write JNI code for android. Using NDK one can build activities, handle user input and performance critical and time critical operations. Go through the link below for more information on NDK.


Make:- As most of you know, make is a tool used to compile the source code in c/c++.


Note:- I modified the existing Hello-JNI application present in samples folder of the NDK. Hence you will find references to this application in some steps. The samples folder is present in the NDK folder .



I went through the above concepts initially and found out that in broad I needed to do the following things.


1) Create a static library file(having .a extension, static files in linux have .a extension) from the G711 source code. But you have to create it using android related compilers, in short using cross compiler toolchain.

 2) Use this lib as a module.

3) Import this module inside our Hello-JNI application.

4) Create some wrapper functions that will call the actual methods in the codec lib.


 1) Create a lib file from the G711 source code using cross compiler toolchain :-

When I received the source code, it was producing the output in .exe format. This exe was of no use as we needed actual methods. So I decided to create a static library file out of this source code. I added the following command in the make file to change the output to a .a file(static library file as said above)


ar -rs g711llc.a $(foreach dir,$(SUBDIRS),$(wildcard $(dir)/*.o))



g711llc.a is the output file name. 'foreach' loops through all the subdirectories and gets the list of all object files required as an input to this command.

 Next task is to make a Cross compiler toolchain. Cross compiler toolchain is needed when you need to compile the code for a different platform. If you don't do this step, the make file will take default GCC compiler for compilation & will create the library for your desktop m/cs which we can't use for android.


To make the cross compiler toolchain, follow the guidelines given in "Standalone Toolchain" page of the Android NDK Docs.


As mentioned in the document, add the new compiler toolchain path and new compiler name in the bash file in linux(env. variables in windows).

 This is to let the make command know that from next time onwards use this compiler instead of normal GCC.

 Also, set the following flags in the makefile after that.


export CFLAGS=-O2 -DDEBUG -DANDROID //android related flags for compiling


export CXXFLAGS=-O2 -DDEBUG -DANDROID //flags for compiling cpp source files


export LDFLAGS='-Wl,--fix-cortex-a8' //Linking flags


export SYSROOT=/home/tech/JAVA/android-ndk-r5b/platforms/android-8/arch-arm //This is the platform for which I need to build this library.


Note:- By default android executes the files that are compiled for thumb architecture. So in CFLAGS and CXXFLAGS, you also need to add "-mthumb"option. Somehow this option was not identified in my m/c so I could not use it and made the library file for arm architecture. In the next section, I will tell you how I used it in android.


 2) Use this lib as a module.

To make use of the library file created in the step 1 we need to import it as a module in our application. To understand this , first read the guidelines given in "IMPORT-MODULE"  & "PREBUILTS" pages of the Android NDK Docs.

 This module directory will contain a subdirectory called 'lib' that contains the library file created above, an 'include' subdirectory that will contain the header files that are required & a "" file which will be parsed by the NDk toolset. This is like a configuration file which defines the module and its details. Following is the content of the file that I used.

  LOCAL_PATH := $(call my-dir)


include $(CLEAR_VARS)


LOCAL_MODULE := g711lib


LOCAL_SRC_FILES := lib/g711llc.a


LOCAL_EXPORT_C_INCLUDES := $(LOCAL_PATH)/include/g711llc $(LOCAL_PATH)/include/utility $(LOCAL_PATH)/include/basicop












Note that in 'LOCAL_EXPORT_C_INCLUDES', I have mentioned the header files' path that are needed.


Since the library I made was for arm architecture, I explicitly added "LOCAL_ARM_MODE := arm" as flag option in the make file in order to use it in android. You will get detailed information for each flag in the document pages mentioned above so please go through them.


"LOCAL_MODULE" defines the module name as g711lib.



3) Import this module inside our Hello-JNI application.

Once the above step is done, next task is to make use of this module inside our JNI code.


To call this module, add the following lines inside the file of Hello-JNI  application.

 LOCAL_PATH := $(call my-dir)


include $(CLEAR_VARS)


LOCAL_MODULE    := hello-jni


LOCAL_SRC_FILES := hello-jni.c














$(call import-module,g711lib)




The most important statement in above mentioned lines is the last one which imports the g711lib module into this application. This is the same module we have defined in the step 2

At compile time, the lib file present in folder g711lib/lib is loaded by this make file and linked against the related method calls made.


Finally follow the procedures for how to compile any NDk application given in NDK introduction page on android dev site and compile the code.




3) Create some wrapper functions that will call the actual methods in the codec lib:-


The encode method in my "hello-jni.c" file looks like below:-




Java_com_example_hellojni_HelloJni_encodeSoundFile( JNIEnv* env, jobject this )




    jstring str, returnstr;


    jint num = 160;


    jboolean ismutype = 0;


    jboolean verbose = 1;


    char numbuf[40];




    FILE* inputfileptr = fopen("/sdcard/windows.wav","r+");


    FILE* outputfileptr = fopen("/sdcard/test.pcm","w+");




    /*Following is the method present in lib file we loaded*/


    jint no = g711llc_encode_file(inputfileptr, outputfileptr, ismutype, num, verbose);



    str = (*env)->NewStringUTF(env, "Hello from JNI !");


    sprintf(numbuf,"return value after encoding is %d", no);


    returnstr = (*env)->NewStringUTF(env,numbuf);   


    return returnstr;






Following are the links that are really helpful. Specially the first one.


Also most important, read the documents given in doc section in NDK toolset.


Finally, even though this article is written from a developers perspective, I hope the concepts and idea is fairly understood. You can share this article with your developer friends.

Any comments or queries, suggestions are always welcome.









Read more…

testing tools

Hi All

Am new member on this great site,and i hope to be a good friend to your group ,

before i ask what i want, i am a new for this career QA, i have less than 3 years experience,

now my company requested from me a tools help us to increase quality of all application 

and system we worked on.

I am Ask about any testing tools automated  help me on my work like : black box test(positive)

or negative test specially reg ration test. for banking application on mobile

all the platform mobile (android ,blackberry,I phone, nokia,,etc)


any one can help me please contact me, i well be a glad 

thank all


osama shahrour

Read more…

Browser extension testing

HiTill now I was into website testing, now our company is moving towards development of Browser extensions which will benefit our users.May I know if there are some different rules/ procedures to be followed in Browser extension testing or it will be same as website testing.We are currently concentrating on Firefox, IE and Chrome. Any kind of help/input is appreciated.
Read more…


GoConnect is a Mobile application launched by Nokia in partnership with Intuit an US based MNC.This is a SMS based service through which small business units can keep their customers updated. Small business unit owners can send personalized messages to their customers from 1 to all at a time. This application is presently launched in Delhi and Chandigarh and soon it is supposed to be launched all over India.

For more information about the app visit:


Watch the video for GoConnect on Youtube:




Read more…

Android App Testing Documents

Hi Folks, im Anand working as Software QA in Hyderabad. Recently my organisation assigned me Android Testing Role, they want me to come up with Proof of concept and White papers on Android App Testing . Can any one share me if they have any kick off documents for Android App testing.? that would be of great help. Looking forward to hear from anyone. Kindly email me them to: Thanks Anand

Read more…

I remember the day when I was assuring the quality of some mobile applications. Some android and j2me applications where we faced some issues which could have been addressed from our side only if we guys could have some more knowledge about the development platform. As a Mobile Application Tester I think this is the time you should pretty good know about the platform on which you are going to test the application. Do not only perform Blackbox testing but discuss with developer and try to know about the code they are working on or how the internal flow is. Know about memory management, database in that particular platform for e.g. Android. Ask your developer or do R & D on knowing how this application works internally.

I know it is not possible to learn everything but surely this going to help all Mobile Application Testers. Not only this would sometime help you in cracking a interview the interviewers are pretty happy when they see a tester is having knowledge of some white box stuff also.

There are plenty of resources available from which you can learn about the platform. Learn about Mobile OS,Learn about the Architecture ...see you don’t need to code but knowing these things would help you communicate your development team.

When you will start doing this surely you will have edge over traditional Black Box Mobile Testers :)

Believe me people (recruiters) feel great when they know that a QA is having good knowledge about the platform and technology.

Read more…

A vulnerability in the Android browser that could allow attackers to download files stored on the mobile device's or tablet's SD card has been discovered by security expert Thomas Cannon, and details of which have already been shared with Google - who is testing a fix as we speak.

The flaw seemingly affects all versions of Android, and could be exploited if the users surfs onto a specially crafted malicious website, where a HTML file containing JavaScript is downloaded to the device without the user being asked permission.

The JavaScript makes the payload open automatically - again without prompting the user - and has access to the files in the SD card and, according to Cannon, "a limited range of other data and files stored on the phone."

"This is a simple exploit involving JavaScript and redirects, meaning it should also work on multiple handsets and multiple Android versions without any effort," he says, but luckily for the users, the attackers must know the name and path of the file they want to steal, and cannot exit Android's sandbox to steal data other than the aforementioned one.

Cannon says that the Android Security Team has responded immediately when he contacted them, and that they have already developed a fix that will be issued after they are done testing it. The also said the fix will be implemented in the maintenance release of Android's next version ("Gingerbread").

Cannon offered a few helpful tips on how to avoid becoming a victim in the meantime - disable JavaScript in the browser, use the Opera Mobile browser, possibly even unmount the SD card. But, according to Chester Wisniewski, the problem with Android use runs deeper. It is an open platform that can be customized by the various carriers and cell phone manufacturers to suit their needs - and that can impact the security updating process in such a way to leave lot of users vulnerable.


Read more…

Wanted Mobile Testing Professionals .
Location of requirement : Bangalore/Chennai/Hyderabad
Designation : Mobile Test Executive
Total experience : 3-5 yrs
Relevant experience : 2-3 yrs

Mandatory skills

1. Testing of mobile handset applications on different platforms – Symbian, Android, J2ME
2. Working knowledge in telecom/wireless - GSM/GPRS/3G
3. Test case design, development and execution
4. Having experience with test tools (Quality Center, Bugzilla,
SpiraTest, QTP, Selenium, SOAP UI, Load Runner), protocols (TCP, HTTP
and HTTPS), database concepts, cloud computing, and programming
languages (Unix, SQL and either C++, Java or XML, WSDL)

Good to have skills

1. Mobile domain knowledge which will help in designing and writing the test cases
2. Knowledge on distributed environment testing
3. Localization, Field, network, game, Emulator and content testing
4. Regression testing knowledge

Other Information (If Any)

1. Candidate should have advance level understanding of technical standards, procedures, test plans & checklists.
2. Should have at least 2+ year experience in Software Testing
3. Should have an advanced understanding of all tests that are necessary to complete projects
4. Should have good grasping power and communication skills
5. Should be able to learn the application without much help

Please send your resumes to : /
Contact us on : Tel. + 91 44 3065 3397

Read more…
Welcome to Mobile QA Zone, a Next Generation Software Testing Community.Invite your friends to join this community.Write to us to become a featured member.