mercredi 3 juin 2015

AWS DynamoDB and Android Development (Put Item into table in DynamoDB)

I am having problem regarding getting the items into DynamoDB table. I tried the code i wrote but the Apps crashed and i am lost of what have I Below are may codes for 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 the 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 the item to the 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):    at com.afdal.ftsmtheses.Update_Table.AddItem(Update_Table.java:54)
06-04 13:26:26.749: E/AndroidRuntime(17001):    at com.afdal.ftsmtheses.Admin_Page$2.onClick(Admin_Page.java:70)
06-04 13:26:26.749: E/AndroidRuntime(17001):    at android.view.View.performClick(View.java:4478)
06-04 13:26:26.749: E/AndroidRuntime(17001):    at android.view.View$PerformClick.run(View.java:18698)
06-04 13:26:26.749: E/AndroidRuntime(17001):    at android.os.Handler.handleCallback(Handler.java:733)
06-04 13:26:26.749: E/AndroidRuntime(17001):    at android.os.Handler.dispatchMessage(Handler.java:95)
06-04 13:26:26.749: E/AndroidRuntime(17001):    at android.os.Looper.loop(Looper.java:149)
06-04 13:26:26.749: E/AndroidRuntime(17001):    at android.app.ActivityThread.main(ActivityThread.java:5257)
06-04 13:26:26.749: E/AndroidRuntime(17001):    at java.lang.reflect.Method.invokeNative(Native Method)
06-04 13:26:26.749: E/AndroidRuntime(17001):    at java.lang.reflect.Method.invoke(Method.java:515)
06-04 13:26:26.749: E/AndroidRuntime(17001):    at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:793)
06-04 13:26:26.749: E/AndroidRuntime(17001):    at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:609)
06-04 13:26:26.749: E/AndroidRuntime(17001):    at dalvik.system.NativeStart.main(Native Method)



Aucun commentaire:

Enregistrer un commentaire