我怎样才能解决这个致命的异常?

Atu*_*ash 5 android cygwin gnu-make android-ndk

我使用NDK将我的C/C++代码移植到Android游戏中,但是我无法入门.

我从developer.android.com下载了NDK-r5b,我已经安装了Cygwin.

我甚至无法运行Hello-jniNDK样本中提供的程序.

当我跑:

$ cd /cygdrive/c/android/android-ndk-r5b/samples/hello-jni 
$ ndk-build 
Run Code Online (Sandbox Code Playgroud)

我得到了ERROR: You are using a non-Cygwin compatible Make program.

我尝试安装GNUMake 3.81,但问题仍然存在.


我试图HELLO-JNI通过Eclipse IDE在NDK中运行示例程序.Android AVD上有一个强制关闭,logcat显示如下异常:

04-08 12:32:11.609: ERROR/AndroidRuntime(274): FATAL EXCEPTION: main 
04-08 12:32:11.609: ERROR/AndroidRuntime(274): 
java.lang.ExceptionInInitializerError 
04-08 12:32:11.609: ERROR/AndroidRuntime(274):     at 
java.lang.Class.newInstanceImpl(Native Method) 
04-08 12:32:11.609: ERROR/AndroidRuntime(274):     at 
java.lang.Class.newInstance(Class.java:1429) 
04-08 12:32:11.609: ERROR/AndroidRuntime(274):     at 
android.app.Instrumentation.newActivity(Instrumentation.java:1021) 
04-08 12:32:11.609: ERROR/AndroidRuntime(274):     at 
android.app.ActivityThread.performLaunchActivity(ActivityThread.java: 
2577) 
04-08 12:32:11.609: ERROR/AndroidRuntime(274):     at 
android.app.ActivityThread.handleLaunchActivity(ActivityThread.java: 
2679) 
04-08 12:32:11.609: ERROR/AndroidRuntime(274):     at 
android.app.ActivityThread.access$2300(ActivityThread.java:125) 
04-08 12:32:11.609: ERROR/AndroidRuntime(274):     at 
android.app.ActivityThread$H.handleMessage(ActivityThread.java:2033) 
04-08 12:32:11.609: ERROR/AndroidRuntime(274):     at 
android.os.Handler.dispatchMessage(Handler.java:99) 
04-08 12:32:11.609: ERROR/AndroidRuntime(274):     at 
android.os.Looper.loop(Looper.java:123) 
04-08 12:32:11.609: ERROR/AndroidRuntime(274):     at 
android.app.ActivityThread.main(ActivityThread.java:4627) 
04-08 12:32:11.609: ERROR/AndroidRuntime(274):     at 
java.lang.reflect.Method.invokeNative(Native Method) 
04-08 12:32:11.609: ERROR/AndroidRuntime(274):     at 
java.lang.reflect.Method.invoke(Method.java:521) 
04-08 12:32:11.609: ERROR/AndroidRuntime(274):     at 
com.android.internal.os.ZygoteInit 
$MethodAndArgsCaller.run(ZygoteInit.java:868) 
04-08 12:32:11.609: ERROR/AndroidRuntime(274):     at 
com.android.internal.os.ZygoteInit.main(ZygoteInit.java:626) 
04-08 12:32:11.609: ERROR/AndroidRuntime(274):     at 
dalvik.system.NativeStart.main(Native Method) 
04-08 12:32:11.609: ERROR/AndroidRuntime(274): Caused by: 
java.lang.UnsatisfiedLinkError: Library hello-jni not found 
04-08 12:32:11.609: ERROR/AndroidRuntime(274):     at 
java.lang.Runtime.loadLibrary(Runtime.java:461) 
04-08 12:32:11.609: ERROR/AndroidRuntime(274):     at 
java.lang.System.loadLibrary(System.java:557) 
04-08 12:32:11.609: ERROR/AndroidRuntime(274):     at 
com.example.hellojni.HelloJni.<clinit>(HelloJni.java:67) 
04-08 12:32:11.609: ERROR/AndroidRuntime(274):     ... 15 more 
04-08 12:32:11.678: WARN/ActivityManager(59):   Force finishing 
activity com.example.hellojni/.HelloJni 
04-08 12:32:12.340: WARN/ActivityManager(59): Activity pause timeout 
for HistoryRecord{44f925c8 com.example.hellojni/.HelloJni} 
Run Code Online (Sandbox Code Playgroud)

我怎样才能做到这一点?

小智 3

我遇到了这个问题。事实证明,当我安装 Cygwin 时,GNU 工具链并未安装,并且 make 是从我的构建机器上安装的另一个 SDK 中获取的。修复方法是重新安装 Cygwin 并检查 Gnu 工具是否已安装。(我认为Cygwin设置中的标题是“Devel”。默认不安装,更改为“install”)。华泰