我从 android 网络库中获取ExceptionInInitializerError
, 然后。NoClassDefFoundError
https://github.com/bclymer/bc-rest-client/blob/master/src/com/bclymer/rest/BcRestClient.java
那是导致抛出异常的文件,但正如您所见,它找不到的类,com/bclymer/rest/BcRestClient$DownloadWebSourceTask
,就在方法的正下方performRequest
。从我读到的内容ExceptionInInitializerError
会导致NoClassDefFoundError
被抛出,但我找不到类无法正确初始化的任何原因。
这个异常也很少被抛出,它发生了 21 次,有 7 个用户,在同一网络库的约 10,000 次使用中,在 MusicService 中的同一方法中使用了约 4,000 次。
Fatal Exception java.lang.NoClassDefFoundError
com/bclymer/rest/BcRestClient$DownloadWebSourceTask
BcRestClient.java line 140
com.bclymer.rest.BcRestClient.performRequest
BcRestClient.java line 139
com.bclymer.rest.BcRestClient.access$3
BcRestClient.java line 415
com.bclymer.rest.BcRestClient$Builder.executeAsync
MusicService.java line 436
com.xxx.xxx.media.MusicService$5.run
ThreadPoolExecutor.java line 1076
java.util.concurrent.ThreadPoolExecutor.runWorker
Thread.java line 856
java.lang.Thread.run
我正在向图书馆提出请求:
new BcRestClient.Builder("http://www.validurl.com", RequestType.GET)
.setCastClass(SetResponse.class)
.setRestClientCallback(new BcRestClientCallback<SetResponse>() {
@Override
public void onPreExecute() {
}
@Override
public void onPostExecute() {
}
@Override
public void onSuccess(BcRestClientResponse<SetResponse> response) {
}
@Override
public void onFailure(BcRestClientResponse<SetResponse> response) {
}
}).executeAsync();
如果您需要更多代码,请告诉我。