Javah class access fail - android

I wanna use tesseract library with my application so i need to implement ndk.i download it add its path to my bash_profile.
export ANDROID_ADB=/Users/gokhanaliccii/Library/Android/sdk/platform-tools
export ANDROID_NDK=/android_ndk/android-ndk-r10d
export PATH=$PATH:$ANDROID_ADB:$ANDROID_NDK
My problem is appeared when i run -javah command at studio terminal. My command is
javah -d jni -classpath /Users/gokhanaliccii/Library/Android/sdk/platforms/android-19/android.jar:/Users/gokhanaliccii/Documents/gokhan_private/android_ocr/NDK_TEST/app/build/intermediates/classes/debug gokhanaliccii.kou.ndk_test.MainActivity
after i got this error i tried to add support libraries
I tried to solved it but i coulndt find solution i'm really exhausted i hope someone know how to solve it
My project is at /Users/gokhanaliccii/Documents/gokhan_private/android_ocr/NDK_TEST

Dont need cp for javah
Run javac on source that includes file with native headers.
Cd to path that is parent of the root of where the ".class" files are.
On cli or in terminal run the javah ( no cp needed )
If stuvk do the ndk samples and it will make sense . They walk u thru javah sample

After lot of researches and training i solved my problem.
javah -classpath /Users/gokhanaliccii/Library/Android/sdk/platforms/android-19/android.jar:/Users/gokhanaliccii/Library/Android/sdk/extras/android/support/v7/appcompat/libs/android-support-v4.jar:/Users/gokhanaliccii/Library/Android/sdk/extras/android/support/v7/appcompat/libs/android-support-v7-appcompat.jar:../../build/intermediates/classes/debug -d jni gokhanaliccii.kou.ndk_test.MainActivit
My result command is above.I tried it at android studio,classes files are at build/intermediadtes/classes/debug if you want try it at eclipse it is under bin folder.

Related

How to compile PJSIP for Android?

I'm trying to compile PJSIP for Android. I follow official tutorial from this site: https://trac.pjsip.org/repos/wiki/Getting-Started/Android.
Unfortunately when I execute command "make dep" I get this error:
/Applications/Xcode.app/Contents/Developer/usr/bin/make -f Samples.mak dependmake[2]: Nothing to be done for `depend'.
My steps:
- I cloned repo from svn. Also tried release package.
- I added config_site.h. Exactly the same as in tutorial.
- Android NDK export is defined in bash_profile.
- Execution of ./configure-android goes without any problems.
I'm using MacOS for building. I also tried on Ubuntu but I get the same error...
In MacOS I also have SWIG installed throught brew package manager.
Any ideas why I get this error?
Thanks in advance for any help.
Ok, I found out how to make it work. You have to modify Makefile in (project_root)/pjsip-apps/build and move line:
$(MAKE) -f Samples.mak $#
to saparate section without "depend":
clean realclean:
$(MAKE) -f Samples.mak $#

Error while Including third party module in kivy app

I am trying to import some third party module like pygoogle in my app when i run app in computer using kivy it works fine but when i make apk using buildozer it crashes every time then i find that i have to go in python-for-android and run this command to include module ./distribute.sh -m "pil ffmpeg kivy" but i still get error that
root#kali:~# cd ~/.buildozer/android/platform/python-for-android
root#kali:~/.buildozer/android/platform/python-for-android# ls
COPYING dist docs README.rst src
cythonizer.py distribute.sh LICENSE recipes tools
root#kali:~/.buildozer/android/platform/python-for-android# ./distribute.sh -m "pil ffmpeg kivy"
Check build dependencies for Kali
Avoid check build dependencies, unknow platform Kali
Check environment
No ANDROIDSDK environment set, abort
root#kali:~/.buildozer/android/platform/python-for-android#
I am using KAli Linux and please solve this someone ...it will be very helpfull to me
Try pasting the pygoogle folder in your app's directory, at the same level as main.py. Also, from the error, it looks like you need to set the ANDROIDSDK environment variable. See the docs.
I had a similar problem, and simply setting the ANDROIDSDK environment variable didn't sort it, but the following did.
Try the following and then run the ./distribute.sh -m "pil ffmpeg kivy" command from the same terminal(as the environment vars will only have been set for that terminal and any child processes), or alternatively, add these lines to your ~/.bashrc file for them to be permanent:
export ANDROIDSDK=/path/to/android-sdk
export ANDROIDNDK=/path/to/android-ndk
export ANDROIDNDKVER=rX
export ANDROIDAPI=X
# example
export ANDROIDSDK="/home/tito/code/android/android-sdk-linux_86"
export ANDROIDNDK="/home/tito/code/android/android-ndk-r7"
export ANDROIDNDKVER=r7
export ANDROIDAPI=14
Examples taken from here. I recommend having a look.

How to use Javah in Ubuntu14.04 for HelloNDK?

I am using Ubuntu14.04, Eclipse Luna.
I am referring Hello World Example given link
http://www.ntu.edu.sg/home/ehchua/programming/android/Android_NDK.html
My project name is HelloNDK.
My project path is /home/androiddev/workspace_luna/HelloNDK
In AndroidManifest.xml
I can see package which I use is named as: com.delta.hellondk
Android.jar which automatically added in project which is under Android 5.0.1 & its location shown as
/home/androiddev/Applications/Android_sdk/sdk/platforms/android-21/android.jar
When I use javah command, I got error.
I use following line in terminal.
javah -jni -classpath /home/androiddev/workspace_luna/HelloNDK/bin/classes/;/home/androiddev/Applications/Android_sdk/sdk/platforms/android-21/android.jar -o HelloJNI.h com.delta.hellondk
&
javah -jni -classpath /home/androiddev/workspace_luna/HelloNDK/bin/classes/JNIActivity.class;/home/androiddev/Applications/Android_sdk/sdk/platforms/android-21/android.jar -o HelloJNI.h com.delta.hellondk
when I use following command, I got error as follows:
Error: No classes were specified on the command line. Try -help.
bash: /home/androiddev/Applications/Android_sdk/sdk/platforms/android-21/android.jar: cannot execute binary file: Exec format error
Now I search lots of keywords in google, stackoverflow regarding how to generate HelloJNI.h automatically.
But i failed.
Please guide me!
I know its repeate question should be get negative vote, should be 'On Hold'. But then also i doesn’t get any clue so i asked without hesitate.

Building webrtc library

I am trying to build webrtc android demo application. I was following README applied by the project. First thing was mentioned about gclient but when i tried to run it "no external or internal command". Then i got this link according to the this link i cloned the depot_tool repository but when at the step when i try to run gclient i got this
So after hours of trying i am not able to run it. if any one has experience with this WebRTC library please provide some help. Any guidance? Any Hlep will be appreciated
I heard few things were changed from svn to GIT. We tried building webRTC to windows7 using visual studio. See if you can use any parts on this.
Get depot_tools software and extract to a location (set this path in environment variable).
cd to depot_tools directory and hit 'gclient' (this should take sometime)
Install python 2.7 and put it path.
create a folder of your choice for webRTC and open command prompt there.
Now hit, gclient config http://webrtc.googlecode.com/svn/trunk
then, gclient sync.
Then set GYP_GENERATORS=msvs environment variable (use ninja if you want that).
Also set msvs_version=2012 (depending on your visual studio version)
now run, gclient runhooks --force
This should generate solutions files for your folder. fireup the libjingle/webrtc.sln files and start building it. I'm not sure if it builds as is. But we had hicupps with that.
See this link on WebRTC native development if you haven't already. From my personal experience building this tricky job initially.
Also note that links might be deprecated as they moved to git, don't know if they are still maintaining it.
How to compile WEBRTC On ubuntu
download script and run:
https://cs.chromium.org/chromium/src/build/install-build-deps.sh
./build/install-build-deps.sh --no-chromeos-fonts
Now download depot tools
$ git clone --depth 1 https://chromium.googlesource.com/chromium/tools/depot_tools.git
Put it in Path
$ export PATH=`pwd`/depot_tools:"$PATH"
Define your settings:
export GYP_DEFINES="target_arch=x64 host_arch=x64 build_with_chromium=0 use_openssl=0 use_gtk=0 use_x11=0 include_examples=0 include_tests=1 fastbuild=1 remove_webcore_debug_symbols=1 include_pulse_audio=0 include_internal_video_render=0 clang=1 "
make file to download the source
mkdir webrtc-checkout
cd webrtc-checkout
I chose branch 50 you can change it
gclient config https://chromium.googlesource.com/external/webrtc.git#branch-heads/50 --name=src
gclient sync --force --with_branch_heads
gclient sync --force --with_branch_heads --nohooks
cd src
git checkout branch-heads/50
gclient runhooks
ninja -C ./out/Release
Collect your LIB & Include file to use it in your project
mkdir ../lib/
find ./ -name "*.o" -and -not -name do_not_use -and -not -name protoc -and -not -name genperf -exec ar crs ../lib/libwebrtc.a {} +
mkdir ../include
find ./ -name *.h -exec cp --parents '{}' ../include ';'

Creating Project Cocos2d-x-3.1.1

I have downloaded Cocos2d-x-3.1.1 but it does not include #create-android-project.bat and #create-android-project.sh then i download these 2 files from the internet and i tried to create project i receive the error. anyone have any idea please kindly help.
.............
Resolved location library project to C:\ADT\cocos2d-x\cocos2dx\platform\android\java
Error: Project folder 'C:\ADT\cocos2d-x\cocos2dx\platform\android\java' is not valid directory
Error: No Android manifest at: C:\ADT\cocos2d-x\cocos2dx\platform\android\java
Error!!!
Don't run in cygwin. You should run corresponding bat.
Press any key to continue.
$ cocos new ProjName -p com.compnyName.ProjName -l cpp
You should use cocos2d-console for creating project.
$ cocos2d-x-3.1.1/tools/cocos2d-console/bin/cocos new -d . -p com.example.testproject -l cpp TestProject

Categories

Resources