Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Javah: Error: cannot access android.support.v7.app.ActionBarActivity

I have a problem with javah, I have read about 4 or 5 stakcoverflow posts with the error "solved" but anything works for me.

My problem:

When i execute the javah command i have this error:

Error: cannot access android.support.v7.app.ActionBarActivity
  class file for android.support.v7.app.ActionBarActivity not found

What I have tried:

This is the command that I have tested:

C:\Users\MyUser\workspace3\PruebaApp\jni\include>javah -classpath ../../bin/classes;C:\Users\MyUser\AppData\Local\Android\sdk\platforms\android-14\android.jar -o ACK.h com.test.prueba.ACK

I have tried too the same command with only "/" and only "\" for separating direcotries.

I have tried it with android-11, android-14, and android-21.

I have tried to add the following external jars to my project: "android-support-v4.jar" and "android-support-v7-appcompat.jar"

I have tried to do it creating a external build configuration with eclipse, like here: Javah Error android.app.Activity not found

Tools I'm using

I'm working with eclipse juno, on windows 8.1.

The folder from which I executed the command is {project_dir}/jni/include. I have tried it from different folders, modifying the command correctly.

The .java file that contains the native function is "ACK.java" in the package: "com.test.prueba"

In the project, the android library that I'm using is android 5.0.1

What can I do? Thanks in advance.

like image 734
Dan Avatar asked Dec 20 '22 07:12

Dan


2 Answers

The native methods declared in your java class is enough for generating JNI header. In your example, the command javah's option -classpath is not very useful. Suppose com/test/prueba/ACK.java is the class you process to generate JNI header. You can change the working directory to {project_dir}\src, execute the command

javah com.test.prueba.ACK

the corresponding JNI header file com_test_prueba_ACK.h will be created in the current directory.

like image 131
alijandro Avatar answered Dec 21 '22 19:12

alijandro


You should write full path of android-support-v7-appcompat.jar and android-support-v4.jar in classpath parameter.

like image 32
Alex Avatar answered Dec 21 '22 21:12

Alex