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