0

I am developing an app where I am using Amazon DynamoDB using DynamoDBmapper. I am getting the following error.

Following is a logcat:

E/AndroidRuntime: FATAL EXCEPTION: main 
java.lang.NoClassDefFoundError: com.amazonaws.org.apache.commons.logging.LogFactory
at com.amazonaws.mobileconnectors.dynamodbv2.dynamodbmapper.DynamoDBMapper.

Even after I did everything that is suggested here, I am not getting rid of the error.

Can someone help me?

I am using Android Studio. I added the commons-logging.jar in the libs folder.

I am not sure what else do I mention here. If you could ask particular question, I would be able to reply.

Guys.. please help. Already wasted a week trying find solution for this without any luck yet.

AWS Android SDK: 2.2.13

build.gradle:


apply plugin: 'com.android.application'

android {  
    compileSdkVersion 23  
    buildToolsVersion '23.0.3'  
    defaultConfig {  
        applicationId "com.example.lenovo.dynamodb6"  
        minSdkVersion 17  
        targetSdkVersion 23  
        versionCode 1  
        versionName "1.0"  
    }  
    buildTypes {  
        release {  
            minifyEnabled false  
            proguardFiles getDefaultProguardFile('proguard-android.txt'),  'proguard-rules.pro'  
        }  
    }  
    sourceSets {  
        main {  
            resources.srcDirs = ['src/main/java']  
        }  
    }  
    productFlavors {  
    }  

    repositories {  
        jcenter()  
    } }  

dependencies {  
    compile fileTree(dir: 'libs', include: ['*.jar'])  
    testCompile 'junit:junit:4.12'  
    compile files('libs/commons-logging-1.2.jar')  
    compile files('libs/commons-codec-1.6.jar')  
    compile files('libs/jackson-core-2.5.3.jar')  
    compile files('libs/httpcore-4.3.3.jar')  
    compile files('libs/httpclient-4.3.6.jar')  
    compile files('libs/jackson-annotations-2.5.0.jar')  
    compile 'com.android.support:appcompat-v7:23.1.1'  
    compile 'com.amazonaws:aws-android-sdk-core:2.2.13'  
    compile 'com.amazonaws:aws-android-sdk-ddb:2.2.13'  
    compile 'com.amazonaws:aws-android-sdk-ddb-mapper:2.1.8' } 

Community
  • 1
  • 1

1 Answers1

0

The problem is incorrect version of DynamoDB mapper. Please bump com.amazonaws:aws-android-sdk-ddb-mapper to 2.2.13 or later. The structure of AWS Android SDK libraries has been changed from 2.1.x to 2.2.x. Please don't not mix them.

PS: using Apache HttpClient 4.3 in an Android project may cause trouble, as Android has its legacy version of HttpClient.

Yangfan
  • 1,866
  • 1
  • 11
  • 13