java - AWS DynamoDB and Android Development (Put Item into table in DynamoDB) -
i having problem regarding getting items dynamodb table. tried code wrote apps crashed , lost of have below may codes references.
additem method
public void additem() { dynamodb db = new dynamodb(client); table table = db.gettable(tablename); map<string, attributevalue> add = new hashmap<string, attributevalue>(); // build item item item = new item() .withprimarykey("id_tesis", 206) .withstring("author_tesis", "20-bicycle 206") .withstring("program_tesis", "206 description") .withstring("super_tesis", "hybrid") .withstring("title_tesis", "brand-company c") .withint("title_tesis", 2004); // write item table table.putitem(item); }
mainactivity.java
public void onclick(view v) { dbclient.additem(); log.i("sys", "good"); }
logcat error:
06-04 13:26:26.749: e/androidruntime(17001): fatal exception: main 06-04 13:26:26.749: e/androidruntime(17001): process: com.afdal.ftsmtheses, pid: 17001 06-04 13:26:26.749: e/androidruntime(17001): java.lang.noclassdeffounderror: com.amazonaws.services.dynamodbv2.document.dynamodb 06-04 13:26:26.749: e/androidruntime(17001): @ com.afdal.ftsmtheses.update_table.additem(update_table.java:54) 06-04 13:26:26.749: e/androidruntime(17001): @ com.afdal.ftsmtheses.admin_page$2.onclick(admin_page.java:70) 06-04 13:26:26.749: e/androidruntime(17001): @ android.view.view.performclick(view.java:4478) 06-04 13:26:26.749: e/androidruntime(17001): @ android.view.view$performclick.run(view.java:18698) 06-04 13:26:26.749: e/androidruntime(17001): @ android.os.handler.handlecallback(handler.java:733) 06-04 13:26:26.749: e/androidruntime(17001): @ android.os.handler.dispatchmessage(handler.java:95) 06-04 13:26:26.749: e/androidruntime(17001): @ android.os.looper.loop(looper.java:149) 06-04 13:26:26.749: e/androidruntime(17001): @ android.app.activitythread.main(activitythread.java:5257) 06-04 13:26:26.749: e/androidruntime(17001): @ java.lang.reflect.method.invokenative(native method) 06-04 13:26:26.749: e/androidruntime(17001): @ java.lang.reflect.method.invoke(method.java:515) 06-04 13:26:26.749: e/androidruntime(17001): @ com.android.internal.os.zygoteinit$methodandargscaller.run(zygoteinit.java:793) 06-04 13:26:26.749: e/androidruntime(17001): @ com.android.internal.os.zygoteinit.main(zygoteinit.java:609) 06-04 13:26:26.749: e/androidruntime(17001): @ dalvik.system.nativestart.main(native method)
the reason see error because library aws-java-sdk-dynamodb isn't exported apk. if use eclipse, please check project properties -> java build path -> order , export.
the dynamodb document api offered aws java sdk, unavailable in aws sdk android. if plan use sdk on android, please consider aws sdk android tested on android , optimized android in terms of library size, method count number, , performance. see http://aws.amazon.com/mobile/sdk/ more information.
Comments
Post a Comment