AWS DynamoDB教程不导入某些类 [英] AWS DynamoDB tutorial does not import certain classes

查看:606
本文介绍了AWS DynamoDB教程不导入某些类的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想遵循AWS网站DynamoDB教程: http://aws.amazon.com /用品/ 7439603059327617 我下载的文件,其导入到Eclipse,进口的所有必要的库(或从字面上看,所有与GitHub的文件传来库),但DynamoDBManager.java会继续给我这个可怕的进口com.amazon ...不能要解决的错误以下行:

I am trying to follow a tutorial for DynamoDB on AWS website : http://aws.amazon.com/articles/7439603059327617 I downloaded the file, imported it to Eclipse, imported all the necessary libraries (or literally, all the libraries that came with the github file), but DynamoDBManager.java would keep giving me the dreaded "The import com.amazon... cannot be resolved" error for the following lines:

import com.amazonaws.services.dynamodbv2.model.DynamoDBAttribute;
import com.amazonaws.services.dynamodbv2.model.DynamoDBHashKey;
import com.amazonaws.services.dynamodbv2.model.DynamoDBMapper;
import com.amazonaws.services.dynamodbv2.model.DynamoDBScanExpression;
import com.amazonaws.services.dynamodbv2.model.DynamoDBTable;
import com.amazonaws.services.dynamodbv2.model.PaginatedScanList;

但库是进口的所有其他类,如

But library is imported for all other classes such as

import com.amazonaws.services.dynamodbv2.model.AttributeDefinition;
import com.amazonaws.services.dynamodbv2.model.CreateTableRequest;
import com.amazonaws.services.dynamodbv2.model.DeleteTableRequest;
import com.amazonaws.services.dynamodbv2.model.DescribeTableRequest;
import com.amazonaws.services.dynamodbv2.model.DescribeTableResult;
import com.amazonaws.services.dynamodbv2.model.KeySchemaElement;
import com.amazonaws.services.dynamodbv2.model.KeyType;
import com.amazonaws.services.dynamodbv2.model.ProvisionedThroughput;
import com.amazonaws.services.dynamodbv2.model.ResourceNotFoundException;
import com.amazonaws.services.dynamodbv2.model.ScalarAttributeType;

难道没有其他人遇到类似的问题?能否请你直接叫我在正确的方向?!

Did anyone else run into a similar problem? Could you please direct me in a right direction?!

感谢您提前和放大器;阅读!

Thank you in advance & for reading!

推荐答案

我碰到了类似的问题,以下相关的教程,而 的http://mobile.awsblog.com/post/Tx1U4RV2QI1MVWS/Amazon-DynamoDB-on-Mobile-Part-1-Loading-Datahttps://github.com/awslabs/aws-sdk-android-samples/tree/master/DynamoDBMapper_User$p$pference

I came across a similar issue while following a related tutorial http://mobile.awsblog.com/post/Tx1U4RV2QI1MVWS/Amazon-DynamoDB-on-Mobile-Part-1-Loading-Data https://github.com/awslabs/aws-sdk-android-samples/tree/master/DynamoDBMapper_UserPreference

我使用的是Android工作室(0.8.1)和AWS的SDK为Android(1.7.1.1)的最新版本。它看起来像你使用了错误的包路径。

I'm using the latest version of Android Studio (0.8.1) and AWS SDK for Android (1.7.1.1). It looks like you're using the wrong package path.

有关

import com.amazonaws.services.dynamodbv2.model.DynamoDBAttribute;
import com.amazonaws.services.dynamodbv2.model.DynamoDBHashKey;
import com.amazonaws.services.dynamodbv2.model.DynamoDBMapper;
import com.amazonaws.services.dynamodbv2.model.DynamoDBScanExpression;
import com.amazonaws.services.dynamodbv2.model.DynamoDBTable;
import com.amazonaws.services.dynamodbv2.model.PaginatedScanList;

您使用的是 com.amazonaws.services.dynamodbv.model 当它应该是 com.amazonaws.services.dynamodbv2.datamodeling 。欲了解更多证明/文档有关的包,你可以看看dynmodbv2 <一href="http://docs.aws.amazon.com/AWSAndroidSDK/latest/javadoc/com/amazonaws/services/dynamodbv2/datamodeling/package-summary.html"相对=nofollow>这里看到他们不是去precated 。改变你的包路径以反映这一点:

you're using com.amazonaws.services.dynamodbv.model when it should be com.amazonaws.services.dynamodbv2.datamodeling. For more proof/documentation about the packages you can look at dynmodbv2 here to see that they are not deprecated. Change your package path to reflect this:

import com.amazonaws.services.dynamodbv2.datamodeling.DynamoDBAttribute;
import com.amazonaws.services.dynamodbv2.datamodeling.DynamoDBHashKey;
import com.amazonaws.services.dynamodbv2.datamodeling.DynamoDBMapper;
import com.amazonaws.services.dynamodbv2.datamodeling.DynamoDBScanExpression;
import com.amazonaws.services.dynamodbv2.datamodeling.DynamoDBTable;
import com.amazonaws.services.dynamodbv2.datamodeling.PaginatedScanList;

和你应该希望只需要使用下列之一:

and you should hopefully only need to use one of the following:

  • AWS-Android的SDK-VERSION.jar。包含所有必要的文件(包括 第三方依赖)的所有受支持的AWS服务。所有类 文件被编译没有调试选项。
  • AWS-Android的SDK-版本debug.jar。包含所有必要的调试文件(包括第三方的依赖性)。在code与上保留了所有的符号调试选项进行编译。
  • aws-android-sdk-VERSION.jar. Contains all necessary files (including third-party dependencies) for all supported AWS services. All class files were compiled without the debug option.
  • aws-android-sdk-VERSION-debug.jar. Contains all files (including third-party dependencies) necessary for debugging. The code was compiled with the debug option on with all symbols retained.

有关更多的AWS SDK为Android坛子里看到正式文件的这里

For more on the jars in the AWS SDK for Android see the official documentation here

(只应相关AWS SDK为1.7.1.1及以下,如果错误没有得到固定在未来转)

(Should only be relevant for AWS SDK for 1.7.1.1 and below if the bug doesn't get fixed in the next rev)

我的问题是不同的,即使我有正确的包路径为每个文档,机器人工作室的的IntelliJ找不到 dynamodbv2.datamodeling 也就是打字的时候进口com.amazonaws.services.dynamodbv2。它并未暗示datamodeling,仅公用事业和模型。尝试进口com.amazonaws.services.dynamodbv2。* 未解决问题,无论是。正因为如此似乎datamodeling包不包装成上述两个包这在理论上应该是无所不包。为了得到datamodeling和解决问题,我曾在关于不被发现(DynamoDBAttribute,DynamoDBHashKey等)相同的对象,我不得不添加为库/文件相关 AWS-Android的SDK-1.7.1.1 -ddb-mapper.jar AWS-Android的SDK-1.7.1.1-ddb.jar 和清理我的项目在这一点上的IntelliJ可以看到打字进口和示例项目可以编译时datamodeling。

My issue was different in that even though I had the correct package path as per documentation, Android Studio's Intellij couldn't find dynamodbv2.datamodeling that is, when typing import com.amazonaws.services.dynamodbv2. it didn't suggest datamodeling, only utility and model. Trying import com.amazonaws.services.dynamodbv2.* didn't fix the issue either. Because of this it seems that the datamodeling package isn't wrapped into the two above mentioned packages which in theory are supposed to be all encompassing. To get datamodeling and fix the issue I had in regards to the same objects not being found (DynamoDBAttribute, DynamoDBHashKey, etc.) I had to add as library/file dependencies aws-android-sdk-1.7.1.1-ddb-mapper.jar and aws-android-sdk-1.7.1.1-ddb.jar and cleaned my project at which point Intellij could see datamodeling when typing import and the sample project could compile.

我想你知道如何导入库在你的平台上,你提到的导入,但要确保它的只有你所需要的各个文件和你不包括 AWS-Android的SDK-1.7.1.1 -debug.jar AWS-Android的SDK-1.7.1.1.jar 他们。因此,例如,我的机器人工作室模块摇篮构建文件相关的样子:

I imagine you know how to import libraries in your platform as you mentioned importing, but make sure it's only the individual files you need and you don't include aws-android-sdk-1.7.1.1-debug.jar or aws-android-sdk-1.7.1.1.jar with them. So for example, my Android Studio module gradle build file dependencies looks like:

dependencies {
    compile files('libs/aws-android-sdk-1.7.1.1-ddb-mapper.jar')
    compile files('libs/aws-android-sdk-1.7.1.1-ddb.jar')
    compile files('libs/aws-android-sdk-1.7.1.1-autoscaling.jar')
    compile files('libs/aws-android-sdk-1.7.1.1-cloudwatch.jar')
    compile files('libs/aws-android-sdk-1.7.1.1-core.jar')
    compile files('libs/aws-android-sdk-1.7.1.1-ec2.jar')
    compile files('libs/aws-android-sdk-1.7.1.1-elb.jar')
    compile files('libs/aws-android-sdk-1.7.1.1-s3.jar')
    compile files('libs/aws-android-sdk-1.7.1.1-sdb.jar')
    compile files('libs/aws-android-sdk-1.7.1.1-ses.jar')
    compile files('libs/aws-android-sdk-1.7.1.1-sns.jar')
    compile files('libs/aws-android-sdk-1.7.1.1-sqs.jar')
    compile files('libs/aws-android-sdk-1.7.1.1-sts.jar')
}

我有这个问题似乎是在那里DDB和DDB映射器不包括在什么应该是无所不包 AWS-Android的SDK-1.7.1.1-debug.jar AWS-Android的SDK-1.7.1.1.jar 。因此,我已报告在GitHub( https://github.com/aws/ AWS-SDK-的Andr​​oid /问题/ 18 ),并希望在未来转速会解决这个问题,这将不再是相关的,你应该只需要 AWS-Android的SDK-1.7.1.1 -debug.jar AWS-Android的SDK-1.7.1.1.jar

The issue I had seems to be a bug where ddb and ddb-mapper weren't included in what should be the all encompassing aws-android-sdk-1.7.1.1-debug.jar and aws-android-sdk-1.7.1.1.jar. As such, I have reported on GitHub (https://github.com/aws/aws-sdk-android/issues/18) and hopefully the next rev will fix this issue and it will no longer be relevant and you should only need aws-android-sdk-1.7.1.1-debug.jar or aws-android-sdk-1.7.1.1.jar

这篇关于AWS DynamoDB教程不导入某些类的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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