NoClassDefFoundError的运行仿真器/手机应用程序时, [英] NoClassDefFoundError when running app in emulator/phone

查看:94
本文介绍了NoClassDefFoundError的运行仿真器/手机应用程序时,的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我使用Eclipse来管理我的Andr​​oid项目,它使用亚马逊的Andr​​oid库AWS。我加了库JAR文件到./libs文件夹,从中我添加库到我的Java构建路径(项目属性 - > Java构建路径 - >库 - >添加JARS ...)。我的应用程序编译正确的,但是当我在模拟器上或在手机上运行它,我得到一个NoClassDefFoundError错误。据我所知,这个错误通常是抛出当应用程序正确编译,但库最终从导出的apk文件丢失。

我错过了一步?

编辑:

下面是堆栈跟踪到地步我的应用程序引用它。

  java.lang.NoClassDefFoundError的:org.apache.commons.httpclient.params.HttpClientParams
   在com.amazonaws.http.HttpClient.configureHttpClient(来源不明)
   在com.amazonaws.http.HttpClient< INIT>(来源不明)
   在com.amazonaws.AmazonWebServiceClient< INIT>(来源不明)
   在com.amazonaws.services.simpledb.AmazonSimpleDBClient< INIT>(来源不明)
   在com.amazonaws.services.simpledb.AmazonSimpleDBClient< INIT>(来源不明)
   在lee.medical.icu.dataentry.MainMenuActivity.connectToDb(MainMenuActivity.java:121)
 

解决方案

事实证明,在AWS SDK的jar文件没有正确地建立。看来他们错过了就不再公开发布一个旧的Apache库。亚马逊已经更新下载和图书馆不再抛出一个NoClassDefFoundError的。

资料来源:AWS移动开发论坛论坛发帖

I'm using Eclipse to manage my Android project, which uses Amazon's Android libraries for AWS. I have added the library jar files to a ./libs folder, from which I added the libraries to my Java Build Path (Project properties -> Java Build Path -> Libraries -> Add JARS...). My app compiles correctly, but when I run it on an emulator or on a phone, I get a NoClassDefFoundError. I understand that this error is usually thrown when the application is compiled correctly but the libraries end up missing from the exported apk file.

Did I miss a step?

Edit:

Here's the stack trace up to the point where my application references it.

java.lang.NoClassDefFoundError: org.apache.commons.httpclient.params.HttpClientParams
   at com.amazonaws.http.HttpClient.configureHttpClient(Unknown Source)
   at com.amazonaws.http.HttpClient.<init>(Unknown Source)
   at com.amazonaws.AmazonWebServiceClient.<init>(Unknown Source)
   at com.amazonaws.services.simpledb.AmazonSimpleDBClient.<init>(Unknown Source)
   at com.amazonaws.services.simpledb.AmazonSimpleDBClient.<init>(Unknown Source)
   at lee.medical.icu.dataentry.MainMenuActivity.connectToDb(MainMenuActivity.java:121)

解决方案

Turns out, the jar files in the AWS SDK weren't properly built. It appears that they missed an old Apache library that is no longer publicly distributed. Amazon has updated the download, and the libraries no longer throw a NoClassDefFoundError.

Source: Forum post on AWS mobile dev forums

这篇关于NoClassDefFoundError的运行仿真器/手机应用程序时,的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆