This question already has answers here:
Closed 6 years ago.
I found already about 5 answers, tried all of them and didn't get it working.
Env: Ubuntu 12.04/ Indigo
Run->External Tools->External Tools Configuration...
Created new Program
Location: /usr/bin/javah /*$ which javah gives /usr/bin/javah */
Working directory: ${workspace_loc:/MyProject/bin/classes}
Attributes: -d ${workspace_loc:/MyProject/jni} com.myproject.MyActivity
Result of RUN: Could not find class file for 'com.myproject.MyActivity'
Run from terminal gives same result
maxim@ubuntu:~/workspace/MyProject/bin/classes$ javah -jni com.myproject.MyActivity
Error: cannot access android.app.Activity
class file for android.app.Activity not found
maxim@ubuntu:~/workspace/MyProject/bin/classes$
SDK/NDK installed, external paths added.
How to add missing parts? Thanks everybody.
Edited Jul 3
Moving native lib loading to a separate class solved the problem
I had a very similar problem on linux too . it turned out that i didn't do it on the right folder.
Try to read it and see if it helps: Using javah on linux.
Elaborating on this post also mentioned in android developer's answer:
As you can see by the screen shot below, set up the external tools like this:
In the Eclipse ADT, click on "Run", hover on the last option of the menu - "External Tools" and choose "External Tools Configurations"
Set the paths up to the following:
2.1. Location: wherever you installed Java
C:\Program Files\Java\jdk1.7.0_13\bin\javah.exe
2.2. Working Directory: your project's /bin/classes/ directory
${workspace_loc:/MyProject/bin/classes}
2.3. Arguments:
-jni ${java_type_name}
Click on run (note that you have to have the java class selected)
Using your file browser, check the /bin/classes/ directory - you should find the .h header file there.
Hope this helps someone.
Based on Enke's answer I added more argument for convenience.
1.You don't have to set working dir correctly by using "-classpath ".(You can ignore the working dir setting in the pic.)
2.You can get verbose info from integrated console in Eclipse.
3.You can specify output dir by using "-d " parameter.
*Don't forget to replace the project directory name in this pic.("MyProject")