Question:

Android NDK could not find class file when Javah command generated. H header file

            

The first solution:

  1. Win +R to enter CMD, go to any directory, this directory determines the generated. H file location; The subsequent.h files are in whatever directory you type, as shown below: my CMD goes to C: Users\Administrator >, and the resulting.h file is in C: Users\Administrator

  1. javah  -classpath   F:\Demo\Test\app\src\main\java com.ang.test.ndk.Java2CJni

F: \ Demo \ Test \ app \ SRC/main/Java to generate. H file the full path of a class of com. Ang. Test. The NDK. Java2CJni is a package name + the name of the class

    

  1. Running results:

    

Generate header files in any directory:

For example: in _F packing directory _ input: javah – classpath F: \ Demo \ Test \ app \ SRC \ main \ Java com ang. Test. The NDK. Java2CJni

      

Results:

The corresponding. H file is generated in the root directory of drive F

         

The second solution:

F:\Demo\Test\app\ SRC \main\ Java = F:\Demo\Test\app\ SRC \main\ Java

           

2. Input the javah – classpath. – jni com. Ang. Test. The NDK. Java2CJni note: behind the classpath a before and after “. “there are Spaces

Com. Ang. Test. The NDK. Java2CJni is oneself want to convert. H file the full path name of a class;

          

3. Running result

F:\Demo\Test\app\ SRC \main\ Java directory generates the corresponding. H file: