Reputation: 3037
This is an update to this question that I asked earlier today.
Brief reiteration of the problem: I have an Android app that requires use of Amazon's Android SDK for AWS. I add the necessary libraries (JAR files) to my Eclipse build path. However, when I run the app, the app crashes with a NoClassDefFoundError.
After a bit of investigation, I have isolated the code that causes the error. I have made a simple dummy Android app that uses the apparently buggy code. The source code for the single Activity is here. And here is the logcat output.
I noticed a couple of odd things about this. If the library wasn't being added correctly, it should fail at line 34:
credentials = new BasicAWSCredentials( accessKeyId, secretKey );
But it doesn't. Instead, it fails at line 62, which chains up to line 48.
Line 62:
sdb = new AmazonSimpleDBClient( credentials );
Line 48 (with part of 47):
list.setAdapter(new ArrayAdapter<String>(this, R.layout.list_item, getInstance().listDomains().getDomainNames()));
The funny thing is, the sample project provided with the SDK works perfectly. Here is the code for SimpleDB, which is one of the source files. I have essentially copied and pasted some of the code calling for access to Amazon's SimpleDB, yet mine fails and the sample doesn't.
So, anyone have any ideas?
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 the AWS mobile dev forum
Upvotes: 0
Views: 478
Reputation: 745
In the most cases NoClassDefFoundError means that duplicate versions of the class are on the classpath. I think you should check your dependencies/libraries for duplicate .class files. Please check this file first in your jar-s: org.apache.commons.httpclient.params.HttpClientParams
Hope it helps!
Upvotes: 2