0
votes

We're looking to implement our AWS API Gateway generated Android SDK in our app.

When we try to build our client class, we get the following error:

java.lang.NoClassDefFoundError: Failed resolution of:Lcom/amazonaws/util/json/DateDeserializer;

Here's how we create our client instance:

ApiClientFactory factory = new ApiClientFactory();
final CigarSocialClient client = factory.build(CigarSocialClient.class);

We have been searching for a solution but haven't found anything yet. The best solution seems to ditch the generated sdk and invoke our api gateway via web requests.

Any help is appreciated!

UPDATE:

We're using the following aws tutorial

Here is our build.gradle file for the app

apply plugin: 'com.android.application'

android {
    compileSdkVersion 23
    buildToolsVersion '24.0.1'
    defaultConfig {
        applicationId "com.example"
        minSdkVersion 14
        targetSdkVersion 24
        versionCode 1
        versionName "1.0"
    }
    buildTypes {
        release {
            minifyEnabled false
            proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
        }
    }
}
dependencies {
    compile fileTree(include: ['*.jar'], dir: 'libs')
    compile fileTree(include: ['*.jar'], dir: 'app/libs')
    testCompile 'junit:junit:4.12'
    compile 'com.android.support:appcompat-v7:24.2.0'
    compile 'com.android.support:recyclerview-v7:23.4.0'
    compile 'com.android.support:design:24.2.0'
    compile 'com.android.volley:volley:1.0.0'
    compile 'com.android.support:support-v4:23.4.0'
    compile 'com.amazonaws:aws-android-sdk-core:2.2.+'
    compile 'com.amazonaws:aws-android-sdk-cognitoidentityprovider:2.2.+'
}

And here is the stack trace:

D/Error: ERR: stack=java.lang.NoClassDefFoundError: Failed resolution of: Lcom/amazonaws/util/json/DateDeserializer; at com.amazonaws.mobileconnectors.apigateway.ApiClientHandler.(ApiClientHandler.java:59) at com.amazonaws.mobileconnectors.apigateway.ApiClientFactory.getHandler(ApiClientFactory.java:145) at com.amazonaws.mobileconnectors.apigateway.ApiClientFactory.build(ApiClientFactory.java:123) at com.example.API.testApiGatwaySdk(API.java:125) at com.example.ListFragment$override.onCreateView(ListFragment.java:60) at com.example.ListFragment$override.access$dispatch(ListFragment.java) at com.example.ListFragment.onCreateView(ListFragment.java:0) at android.support.v4.app.Fragment.performCreateView(Fragment.java:2080) at android.support.v4.app.FragmentManagerImpl.moveToState(FragmentManager.java:1108) at android.support.v4.app.FragmentManagerImpl.moveToState(FragmentManager.java:1290) at android.support.v4.app.FragmentManagerImpl.moveToState(FragmentManager.java:1272) at android.support.v4.app.FragmentManagerImpl.dispatchActivityCreated(FragmentManager.java:2149) at android.support.v4.app.FragmentController.dispatchActivityCreated(FragmentController.java:201) at android.support.v4.app.FragmentActivity.onStart(FragmentActivity.java:600) at android.support.v7.app.AppCompatActivity.onStart(AppCompatActivity.java:178) at android.app.Instrumentation.callActivityOnStart(Instrumentation.java:1256) at android.app.Activity.performStart(Activity.java:6929) at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2910) at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:3008) at android.app.ActivityThread.handleRelaunchActivity(ActivityThread.java:4974) at android.app.ActivityThread.-wrap21(ActivityThread.java) at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1656) at android.os.Handler.dispatchMessage(Handler.java:102) at android.os.Looper.loop(Looper.java:154) at android.app.ActivityThread.main(ActivityThread.java:6688) at java.lang.reflect.Method.invoke(Native Method) at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:1468) at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1358) Caused by: java.lang.ClassNotFoundException: Didn't find class "com.amazonaws.util.json.DateDeserializer" on path: DexPathList[[dex file "/data/data/com.example/files/instant-run/dex/slice-support-annotations-24.2.0_f4e9ad562a860d98fa5881a52f2737573a46b23e-classes.dex", dex file "/data/data/com.example/files/instant-run/dex/slice-slice_9-classes.dex", dex file "/data/data/com.example/files/instant-run/dex/slice-slice_8-classes.dex", dex file "/data/data/com.example/files/instant-run/dex/slice-slice_7-classes.dex", dex file "/data/data/com.example/files/instant-run/dex/slice-slice_6-classes.dex", dex file "/data/data/com.example/files/instant-run/dex/slice-slice_5-classes.dex", dex file "/data/data/com.example/files/instant-run/dex/slice-slice_4-classes.dex", dex file "/data/data/com.example/files/instant-run/dex/slice-slice_3-classes.dex", dex file "/data/data/com.example/files/instant-run/dex/slice-slice_2-classes.dex", dex file "/data/data/com.example/files/instant-run/dex/slice-slice_1-classes.dex", dex file "/data/data/com.example/files/instant-run/dex/slice-slice_0-classes.dex", dex file "/data/data/com.example/files/instant-run/dex/slice-internal_impl-24.2.0_d08c5958e93c18231cddf69dc14d83b8ae6d3fa3-classes.dex", dex file "/data/data/com.example/files/instant-run/dex/slice-internal_impl-24.2.0_ce51fbf88aa3b5412a363fc449e8164899b38118-classes.dex", dex file "/data/data/com.example/files/instant-run/dex/slice-internal_impl-24.2.0_982f26845e74cf0a28b29b365

1
Release or debug build?Ivan Milisavljevic
I believe this is a debug build. I'm a bit new to android but I can see the output apk has the app-debug.apk filename.njgrisafi
Ok can you add you build.gradle file pleaseIvan Milisavljevic
Updated the question with the build.gradle file. Our sdk is inside our app/libs folder.njgrisafi
And full stacktrace please :)Ivan Milisavljevic

1 Answers

0
votes

You are using a version of aws-android-sdk-core that is very old and not compatible with the altest clients generated by API gateway. Please update the sdk to the latest.