0

I am trying to implement Amazon AWS in my application but even the sample applications are not working so i wrote a simple code to get access. here it is:

package com.example.testapplication;

import com.amazonaws.auth.AWSCredentials;
import com.amazonaws.auth.BasicAWSCredentials;
import com.amazonaws.services.simpledb.AmazonSimpleDBClient;

import android.app.Activity;
import android.os.Bundle;

public class testclass extends Activity{

    String akey = "MY_A_KEY";
    String skey = "MY_S_KEY";



    @Override
    protected void onCreate(Bundle savedInstanceState) {
        // TODO Auto-generated method stub
        super.onCreate(savedInstanceState);
        AWSCredentials credentials = new BasicAWSCredentials( akey, skey );
        AmazonSimpleDBClient sdbClient = new AmazonSimpleDBClient( credentials);

        setContentView(R.layout.testview);
    }



}

here is my logcat:

03-30 21:20:01.209: E/dalvikvm(9144): Could not find class 'com.amazonaws.auth.BasicAWSCredentials', referenced from method com.example.testapplication.testclass.onCreate
03-30 21:20:01.209: W/dalvikvm(9144): VFY: unable to resolve new-instance 978 (Lcom/amazonaws/auth/BasicAWSCredentials;) in Lcom/example/testapplication/testclass;
03-30 21:20:01.209: D/dalvikvm(9144): VFY: replacing opcode 0x22 at 0x0003
03-30 21:20:01.210: D/dalvikvm(9144): DexOpt: unable to opt direct call 0x2035 at 0x09 in Lcom/example/testapplication/testclass;.onCreate
03-30 21:20:01.210: D/dalvikvm(9144): DexOpt: unable to opt direct call 0x2036 at 0x0e in Lcom/example/testapplication/testclass;.onCreate
03-30 21:20:01.217: D/AndroidRuntime(9144): Shutting down VM
03-30 21:20:01.218: W/dalvikvm(9144): threadid=1: thread exiting with uncaught exception (group=0x41708d40)
03-30 21:20:01.221: E/AndroidRuntime(9144): FATAL EXCEPTION: main
03-30 21:20:01.221: E/AndroidRuntime(9144): Process: com.example.testapplication, PID: 9144
03-30 21:20:01.221: E/AndroidRuntime(9144): java.lang.NoClassDefFoundError: com.amazonaws.auth.BasicAWSCredentials
03-30 21:20:01.221: E/AndroidRuntime(9144):     at com.example.testapplication.testclass.onCreate(testclass.java:21)
03-30 21:20:01.221: E/AndroidRuntime(9144):     at android.app.Activity.performCreate(Activity.java:5248)
03-30 21:20:01.221: E/AndroidRuntime(9144):     at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1110)
03-30 21:20:01.221: E/AndroidRuntime(9144):     at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2173)
03-30 21:20:01.221: E/AndroidRuntime(9144):     at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2269)
03-30 21:20:01.221: E/AndroidRuntime(9144):     at android.app.ActivityThread.access$800(ActivityThread.java:139)
03-30 21:20:01.221: E/AndroidRuntime(9144):     at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1210)
03-30 21:20:01.221: E/AndroidRuntime(9144):     at android.os.Handler.dispatchMessage(Handler.java:102)
03-30 21:20:01.221: E/AndroidRuntime(9144):     at android.os.Looper.loop(Looper.java:136)
03-30 21:20:01.221: E/AndroidRuntime(9144):     at android.app.ActivityThread.main(ActivityThread.java:5102)
03-30 21:20:01.221: E/AndroidRuntime(9144):     at java.lang.reflect.Method.invokeNative(Native Method)
03-30 21:20:01.221: E/AndroidRuntime(9144):     at java.lang.reflect.Method.invoke(Method.java:515)
03-30 21:20:01.221: E/AndroidRuntime(9144):     at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:785)
03-30 21:20:01.221: E/AndroidRuntime(9144):     at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:601)
03-30 21:20:01.221: E/AndroidRuntime(9144):     at dalvik.system.NativeStart.main(Native Method)
03-30 21:21:54.444: E/dalvikvm(9794): Could not find class 'com.amazonaws.auth.BasicAWSCredentials', referenced from method com.example.testapplication.testclass.onCreate
03-30 21:21:54.444: W/dalvikvm(9794): VFY: unable to resolve new-instance 978 (Lcom/amazonaws/auth/BasicAWSCredentials;) in Lcom/example/testapplication/testclass;
03-30 21:21:54.444: D/dalvikvm(9794): VFY: replacing opcode 0x22 at 0x0003
03-30 21:21:54.445: D/dalvikvm(9794): DexOpt: unable to opt direct call 0x2035 at 0x09 in Lcom/example/testapplication/testclass;.onCreate
03-30 21:21:54.446: D/dalvikvm(9794): DexOpt: unable to opt direct call 0x2036 at 0x0e in Lcom/example/testapplication/testclass;.onCreate
03-30 21:21:54.449: D/AndroidRuntime(9794): Shutting down VM
03-30 21:21:54.449: W/dalvikvm(9794): threadid=1: thread exiting with uncaught exception (group=0x41708d40)
03-30 21:21:54.464: E/AndroidRuntime(9794): FATAL EXCEPTION: main
03-30 21:21:54.464: E/AndroidRuntime(9794): Process: com.example.testapplication, PID: 9794
03-30 21:21:54.464: E/AndroidRuntime(9794): java.lang.NoClassDefFoundError: com.amazonaws.auth.BasicAWSCredentials
03-30 21:21:54.464: E/AndroidRuntime(9794):     at com.example.testapplication.testclass.onCreate(testclass.java:21)
03-30 21:21:54.464: E/AndroidRuntime(9794):     at android.app.Activity.performCreate(Activity.java:5248)
03-30 21:21:54.464: E/AndroidRuntime(9794):     at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1110)
03-30 21:21:54.464: E/AndroidRuntime(9794):     at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2173)
03-30 21:21:54.464: E/AndroidRuntime(9794):     at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2269)
03-30 21:21:54.464: E/AndroidRuntime(9794):     at android.app.ActivityThread.access$800(ActivityThread.java:139)
03-30 21:21:54.464: E/AndroidRuntime(9794):     at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1210)
03-30 21:21:54.464: E/AndroidRuntime(9794):     at android.os.Handler.dispatchMessage(Handler.java:102)
03-30 21:21:54.464: E/AndroidRuntime(9794):     at android.os.Looper.loop(Looper.java:136)
03-30 21:21:54.464: E/AndroidRuntime(9794):     at android.app.ActivityThread.main(ActivityThread.java:5102)
03-30 21:21:54.464: E/AndroidRuntime(9794):     at java.lang.reflect.Method.invokeNative(Native Method)
03-30 21:21:54.464: E/AndroidRuntime(9794):     at java.lang.reflect.Method.invoke(Method.java:515)
03-30 21:21:54.464: E/AndroidRuntime(9794):     at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:785)
03-30 21:21:54.464: E/AndroidRuntime(9794):     at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:601)
03-30 21:21:54.464: E/AndroidRuntime(9794):     at dalvik.system.NativeStart.main(Native Method)

I have done everything i can looked up google and exhausted it but i am not able to find the solution.

Things i have done so far: 1. downloaded sdk and sample apps 2 times 2. reinstalled eclipse 3. imported the simpledb libraries and all others even those i dont need.

user3439988
  • 593
  • 1
  • 6
  • 9
  • Have you checked all library and jars are added ? – Jitendra Prajapati Mar 30 '14 at 16:15
  • yes i have added aws-android-sdk-1.7.1.1-debug.jar and aws-android-sdk-1.7.1.1-sdb.jar to Referenced Libraries and imported the AWSCredentials and i am not getting any error in that. – user3439988 Mar 30 '14 at 16:20
  • If you have not done then do this thing put these jars in libs folder and then add it to build path by right clicking of the project – Jitendra Prajapati Mar 30 '14 at 16:23
  • i did that and i am getting this [2014-03-30 21:58:17 - Dex Loader] Unable to execute dex: Multiple dex files define Lcom/amazonaws/services/simpledb/AmazonSimpleDB; [2014-03-30 21:58:17 - testapplication] Conversion to Dalvik format failed: Unable to execute dex: Multiple dex files define Lcom/amazonaws/services/simpledb/AmazonSimpleDB; – user3439988 Mar 30 '14 at 16:29
  • Clean the project and try to resolve the error, I hope it will work – Jitendra Prajapati Mar 30 '14 at 16:32
  • this happened to me earlier as well but then it could be solved by unchecking the .jar in order and export in java build path. but now they are unchecked and i cant get around the problem. – user3439988 Mar 30 '14 at 16:49
  • also i read somewhere that importing the jar files to WEB-INF\lib might help but it didnt. – user3439988 Mar 30 '14 at 16:49
  • WEB-INF folder is not a part of andorid. Remove all jars from build path and again add these jars then clean the project. if not then clean library projects(if you have attached any) and try to resolve this problem – Jitendra Prajapati Mar 30 '14 at 16:54
  • i tried everything also tried [this](http://stackoverflow.com/questions/7870265/unable-to-execute-dex-multiple-dex-files-define-lcom-myapp-rarray) like i told you before but that doesnt help – user3439988 Mar 30 '14 at 18:36
  • Try by changing Android version to latest version and update your adt and sdk if it is showing any update available – Jitendra Prajapati Mar 31 '14 at 02:16
  • Did you find your solution ? – Jitendra Prajapati Mar 31 '14 at 15:12
  • no i did not but i switched to parse instead. – user3439988 Apr 01 '14 at 11:34
  • also i tried changing the android version to 17,18 and 19 still didnt work but now i have a similar error with parse, somehow i am not able to import the libraries correctly. – user3439988 Apr 01 '14 at 11:36
  • Does parse mean parse.com ? – Jitendra Prajapati Apr 03 '14 at 04:16

1 Answers1

0

Sounds like you are experiencing an issue documented on our blog. Please make sure you've selected the libraries for export in your project config.

Bob Kinney
  • 8,870
  • 1
  • 27
  • 35