Problem
When using the javah instruction to generate the. h file under the Android project path, Javah-classpath bin/classes-d jni com.example.myhellojni.MainActivity
---> Error occurred: Unable to access Android.app.Activity android.app.Activity class file was not found.
Where-classpath bin: represents the road strength of the class
Where-D JNI: Represents the directory where the generated header file resides
Where Com.example.hellojni.HelloJni is the full class name
"Solution"
Enter the SRC directory, using javah-d. /JNI com.example.myhellojni.MainActivity directive instead.
Where-D: Create a directory.
Among them. /jni: The header file is generated under the Jni file of the parent directory.
Principle:. Java files are also not compiled to generate. h files directly.
Other:
Unable to access android.app.Activity is a description without introducing Android.jar package
You can look at the specific instructions inside the java-h.
There is a-bootclasspath parameter that allows him to point to the Android.jar package
Here's an example: Javah-classpath bin/classes-bootclasspath D:\Environment\android-sdk-windows\android-sdk-windows\ platforms\android-16\android.jar-d JNI com.jm.promedia.SecondActivity
Or:
Alternatively, you can also go to the SRC directory under javah-d. /jni com.jm.promedia.SecondActivity, but the file it generates is not as detailed as above .
Where-D is to create a directory to put the generated files in
Use Javah to generate the. h file, the resolution of an unreachable android.app,activity error occurs