运行应用程序时出错:java.lang.exceptionininitializererror

时间:2013-08-13 14:22:47

标签: java android exception

我已经下载了一个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
....

有什么问题?

1 个答案:

答案 0 :(得分:3)

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

stacktrace表示抛出的异常是UnsatisfiedLinkError。这很可能是因为:

  • 运行时无法找到本机代码库freerdp
  • 该库未定义与native方法声明FreeRDPActivity.text()匹配的方法实现。