我正在使用AWS Android SDK开发Android应用程序,特别是使用S3,我开始收到以下错误:
Source not found - The JAR of this class file belongs to container
'Android private libraries' which does not allow modifications to source attachments
on its entries.
发生在该行
s3Client = new AmazonS3Client(credentials);
当我尝试创建一个连接到S3的新客户端时。
我必须使用较新版本(2.1.0)替换旧版本的SDK(1.7.1.1)才能使用PersistableDownload类暂停/恢复下载。我不明白为什么会发生这种情况,因为我并没有尝试更改库。我记得做的事:
- Removed the old library
- Added the new one
- Removed and added again several imports on the start of .java files
- Using an older device for the weekend (android API level 8)
这是代码的扩展部分。这可能有所帮助。
AWSCredentials credentials = new BasicAWSCredentials(ACCESS_KEY_ID, SECRET_KEY);
Region region = Region.getRegion(regions);
AmazonS3Client s3Client = null;
try {
s3Client = new AmazonS3Client(credentials);
s3Client.setRegion(region);
} catch (Exception e) {
e.printStackTrace();
}
return s3Client;
任何帮助都可以解决这个问题。谢谢!
编辑:我忘了说我试图回滚旧库,这给了我同样的错误。最令人讨厌的部分是它之前的工作。
答案 0 :(得分:0)
我认为这与Android版本有关。在周末我使用版本为2.2.3的单元格,现在我正在使用4.4.4版本的其他设备。
SDK的1.7.1版与Android 2.2.3没有S3问题。已经在gitHub项目上发布了一个问题,如果/当开发人员回复时我会更新此内容。
答案 1 :(得分:0)
Android SDK的最低版本是API级别10,即2.3.3。此外,昨天我们刚刚发布了一个新版本,该版本被认为是我们的通用可用性版本,我们将SDK的第2版从开发者预览中删除!我已经向GitHub添加了一个帖子,以澄清那边的问题!