我的projectPath: C:\Users\harsh.bhavsar\Downloads\Android-NDK-Sample-Test-master\NDKexe
SDK路径android jar路径: D:\ANDROID-SDK\Sdk\platforms\android-23
Java在环境路径中设置。我现在没有制作c文件,如此tutorial第一个自动生成头文件中所示,我收到了错误。我没有找到错误显示的类。主要是
以下是我在项目终端中运行的命令
C:\Users\harsh.bhavsar\Downloads\Android-NDK-Sample-Test-master\NDKexe>javah C:\Users\harsh.bhavsar\Downloads\Android-NDK-Sample-Test- master\NDKexe\app\src\main\java\com\example\harshbhavsar\ndkexe ../../bin/classes;D:\ANDROID-SDK\Sdk\platforms\android-23 - o HelloJNI.h -o C:\Users\harsh.bhavsar\Downloads\Android-NDK-Sample-Test-master\NDKexe\app\build\intermediates\classes\debug\com\example\harshbhavsar\ndkexe\com.example.harshbhavsar.ndkexe.MainActivity
任何人都可以一步一步解释这个问题。
Exception in thread main java.IllegalArgumentException: not a valid class name
at com.sun.tools.javac.api.JavacTool.getTask<JavacTool.java:177>
at com.sun.tools.javac.api.JavacTool.getTask<JavacTool.java:68>
at com.sun.tools.javah.api.JavachTask.run<JavahTask.java:509>
at com.sun.tools.javah.api.JavachTask.run<JavahTask.java:335>
at com.sun.tools.javah.Main.main<Main.java:46>
这是我的 MainActivity
public class MainActivity extends AppCompatActivity {
static {
System.loadLibrary("myjni");
}
public native String getMessage();
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
}
}
Android.mk 文件
LOCAL_PATH := $(call my-dir)
include $(CLEAR_VARS)
LOCAL_MODULE := myjni
LOCAL_SRC_FILES := HelloJNI.c
include $(BUILD_SHARED_LIBRARY)