简体   繁体   English

android jar导入到另一个项目的异常

[英]Exception with android jar imported to another project

I am writing an android app as well as a web-based interface for a project - both of which rely on AWS (SNS, SQS and S3). 我正在为项目编写一个android应用程序以及基于Web的界面-两者都依赖于AWS​​(SNS,SQS和S3)。 I created wrapper classes for AWS (SNS, SQS and S3), made it into a Java project, exported that into a JAR file - AWSCommons.jar and am now trying to leverage this jar file for both the web-interface and the android app for my project. 我为AWS(SNS,SQS和S3)创建了包装器类,将其包装到Java项目中,并将其导出到JAR文件-AWSCommons.jar中,现在正尝试将此jar文件用于Web界面和android应用程序为我的项目。

I did test that I was successfully able to use AWS from within the unit tests I had in my AWSCommons project. 我确实测试了我是否能够从我在AWSCommons项目中进行的单元测试中成功使用AWS。 But when I try to run my android app which uses the AWSCommons.jar jar file, I get this runtime exception: 但是,当我尝试运行使用AWSCommons.jar jar文件的android应用程序时,出现以下运行时异常:

FATAL EXCEPTION: main
E/AndroidRuntime(15957): java.lang.NoClassDefFoundError: 
E/AndroidRuntime(15957): java.lang.NoClassDefFoundError: com.amazonaws.auth.BasicAWSCredentials
E/AndroidRuntime(15957):    at com.raasio.communication.messaging.internet.AmazonClientManager.validateCredentialsAndInstantiateClient(AmazonClientManager.java:65)
E/AndroidRuntime(15957):    at com.raasio.communication.messaging.internet.AmazonClientManager.getSnsClient(AmazonClientManager.java:54)
E/AndroidRuntime(15957):    at com.raasio.communication.messaging.internet.AWSProxy.<init>(AWSProxy.java:32)
E/AndroidRuntime(15957):    at com.example.raasio.Raasio.onCreate(Raasio.java:79)
E/AndroidRuntime(15957):    at android.app.Activity.performCreate(Activity.java:4465)
E/AndroidRuntime(15957):    at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1049)
E/AndroidRuntime(15957):    at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:1920)
E/AndroidRuntime(15957):    at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:1981)

Also, this is what it reads on line 65 of my AWSCommons' AmazonClientManager.java: 另外,这就是我的AWSCommons的AmazonClientManager.java第65行上显示的内容:

AWSCredentials credentials = new BasicAWSCredentials(accessKey, secretKey);

...and i have imported the BasicAWSCredentails class as expected. ...并且我已经按预期导入了BasicAWSCredentails类。 Thanks for your help. 谢谢你的帮助。

You may be experiencing issues related to changes in ADT v22. 您可能遇到与ADT v22中的更改有关的问题。 You may find this blog post useful in correcting your problem: 您可能会发现此博客文章对纠正您的问题很有用:

Running AWS SDK for Android samples in Eclipse with ADT v22 使用ADT v22在Eclipse中运行适用于Android的AWS开发工具包示例

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

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