简体   繁体   English

外部jar库上的JAVA NoClassDefFoundError

[英]JAVA NoClassDefFoundError on external jar library

I'm writing an Android app in JAVA using this library for formatting phone numbers. 我正在使用库在JAVA编写一个Android应用来格式化电话号码。 I am receiving the following exception: 我收到以下异常:

java.lang.NoClassDefFoundError: Failed resolution of: Lcom/google/i18n/phonenumbers/PhoneNumberUtil;

Here: 这里:

public class InvocationTargetException extends ReflectiveOperationException  {
...
public InvocationTargetException(Throwable exception) {
    super(null, exception);
    target = exception;
}
...
}

When executing the command: 执行命令时:

PhoneNumberUtil phoneUtil = PhoneNumberUtil.getInstance();

I have imported the com.google.i18n.phonenumbers lib, but I cant figure out what is the L in the exception description. 我已经导入了com.google.i18n.phonenumbers库,但是我无法弄清楚异常描述中的L是什么。

L is added for internal JVM objectype representation, but it is actually looking for com/google/i18n/phonenumbers/PhoneNumberUtil class. 为内部JVM objectype表示法添加了L ,但实际上是在寻找com/google/i18n/phonenumbers/PhoneNumberUtil类。

It seems the library is missing in your Runtime classpath . 看来您的Runtime classpath缺少该库。

Field Descriptions Documentation. 字段描述文档。

Did you add the jar file to your class path? 您是否将jar文件添加到类路径? Are you using Android Studio? 您正在使用Android Studio吗? In that case you can add the entry to the app/build.gradle file. 在这种情况下,您可以将条目添加到app / build.gradle文件中。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM