DynamoDbMapperException: No method annotated?(DynamoDbMapperException:没有方法注释?)
问题描述
在我的 Android 应用程序中,我使用 DynamoDb.我创建了一个类,它与一个数据库表映射.应用程序在调试中正常运行.但是如果我导出 apk 并运行应用程序,我会得到 DynamoDbMapperException:
In my android app, I use DynamoDb. I create a class, which is mapped with a table of database. App runs normally in debug. But if I export apk and run app, I get the DynamoDbMapperException:
Caused by: com.amazonaws.mobileconnectors.dynamodbv2.dynamodbmapper.DynamoDBMappingException: No method annotated with interface com.amazonaws.mobileconnectors.dynamodbv2.dynamodbmapper.DynamoDBHashKey for class class com.example.myclass.
我使用 Eclipse 和 proguard 来导出 apk.我猜 proguard 会导致问题,因为没有 proguard 的 apk 可以正常工作.这是我的 Proguard 配置:
I use Eclipse and proguard to export apk. I guess proguard causes the problem, because the apk without proguard works fine. Here is my Proguard config:
-keepattributes *Annotation*
-keep public class com.example.myclass
请帮帮我!我不知道如何解决这个问题.
Please help me! I don't know how to solve the problem.
推荐答案
你使用的是 DynamoDB 表吗?
Are you using a DynamoDB table?
你需要一个类的哈希键,你应该用@DynamoDBHashKey
注释字段,你是否不小心将它注释为@DynamoDBIndexHashKey
?如果是这样,你应该把它改回来.
You need to have a hash key for the class, you should annotate the field with @DynamoDBHashKey
, do you accidentally annotated it as @DynamoDBIndexHashKey
? If so, you should change it back.
类似的参考可以在这里找到
A similar reference can be found here
Android Amazon DynamoDb 基本操作错误
尝试改变
-keep public class com.example.myclass
到
-keep public class com.example.myclass {
*;
}
这篇关于DynamoDbMapperException:没有方法注释?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持编程学习网!
本文标题为:DynamoDbMapperException:没有方法注释?


基础教程推荐
- 当从同一个组件调用时,两个 IBAction 触发的顺序是什么? 2022-01-01
- Kivy Buildozer 无法构建 apk,命令失败:./distribute.sh -m “kivy"d 2022-01-01
- android 应用程序已发布,但在 google play 中找不到 2022-01-01
- 如何在 UIImageView 中异步加载图像? 2022-01-01
- UIWebView 委托方法 shouldStartLoadWithRequest:在 WKWebView 中等效? 2022-01-01
- 如何在 iPhone 上显示来自 API 的 HTML 文本? 2022-01-01
- Android:对话框关闭而不调用关闭 2022-01-01
- 如何在没有IB的情况下将2个按钮添加到右侧的UINavigationbar? 2022-01-01
- 如何让对象对 Cocos2D 中的触摸做出反应? 2022-01-01
- 在 gmail 中为 ios 应用程序检索朋友的朋友 2022-01-01