java.lang.ExceptionInInitializerError in Android

前端 未结 5 912

I\'m trying to create an Android Application that can verify a face But when I try to run my app on my emulator (using Eclipse), I have this result in my logcat:


        
5条回答
  •  佛祖请我去吃肉
    2021-01-18 04:20

    Here are answers, so you know how to solve it now. But this is for others. Java have a great exception message handling where you are able to find almost everything what you need to fix it. This is only my opinion and advice: Everytime look at CAUSED BY: part.

    When you have exception, look at last caused by message. For example here is it: Caused by: java.lang.NoClassDefFoundError: com.sun.jna.Platform. Java have a lot of error classes. This one is error from Object->Throwable->Error->LinkageError. Error => Problem during runtime, No class Def Found Error is typical problem for classloader. All what you can need to explaining error is in java docs.


    Btw from your quetions in comments, here is solution to add external library.

    HOW TO ADD LIBRARY TO PROJECT IN ECLIPSE: Download jar which is decsribed by others here (jna.jar) and add it to lib folder and then you have to add it to build path (then classloader will be able to find it and it will solve your problem). If you are using Eclipse, you can import them directly via Eclipse to your lib folder (right click on project folder, select buildpath, libraries tab and add jar) or just copy jar directly to lib folder, then rightclick and Build Path -> Add to Buildpath.

自定义标题
段落格式
字体
字号
代码语言
提交回复
热议问题