1

我已经下载了一个 android 应用程序源代码,这是唯一的活动:

package net.itskewpie.freerdp;

import android.app.Activity;
import android.os.Bundle;

public class FreeRDPActivity extends Activity {
   /** Called when the activity is first created. */
   @Override
   public void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.main);
        System.out.println("111111111111111111111");
        String b = test();
        System.out.println(b);

        }

   static{     
       System.loadLibrary("freerdp");
      }
   public native String test();

}

当我尝试运行它时,我得到了这个:

08-13 14:15:34.307: W/dalvikvm(335): Exception Ljava/lang/UnsatisfiedLinkError; thrown  while initializing Lnet/itskewpie/freerdp/FreeRDPActivity;
08-13 14:15:34.317: W/dalvikvm(335): Class init failed in newInstance call (Lnet/itskewpie/freerdp/FreeRDPActivity;)
08-13 14:15:34.317: D/AndroidRuntime(335): Shutting down VM
08-13 14:15:34.317: W/dalvikvm(335): threadid=1: thread exiting with uncaught exception  (group=0x40015560)
08-13 14:15:34.357: E/AndroidRuntime(335): FATAL EXCEPTION: main
....

有什么问题?

4

1 回答 1

3

该异常ExceptionInInitializerError是在类的静态初始化期间抛出(并且未捕获)未经检查的异常时抛出的致命错误。

堆栈跟踪指示正在引发的异常是UnsatisfiedLinkError. 这很可能被抛出,因为:

  • 运行时找不到本机代码库freerdp,或者
  • 该库未定义与native方法声明匹配的方法实现FreeRDPActivity.text()
于 2013-08-13T14:31:25.847 回答