Api Gateway Android SDK NoClassDefFoundError

问题描述 投票:0回答:1

我们希望在我们的应用中实施我们的AWS API Gateway生成的Android SDK。

当我们尝试构建我们的客户端类时,我们收到以下错误:

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

以下是我们创建客户端实例的方法:

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

我们一直在寻找解决方案,但还没有找到任何解决方案。最好的解决方案似乎放弃了生成的sdk并通过Web请求调用我们的api网关。

任何帮助表示赞赏!

更新:

我们正在使用以下aws tutorial

这是我们的应用程序的build.gradle文件

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.+'
}

这是堆栈跟踪:

D /错误:错误:stack = java.lang.NoClassDefFoundError:解析失败:Lcom / amazonaws / util / json / DateDeserializer;在com.amazonaws.mobileconnectors.apigateway.ApiClientHandler。(ApiClientHandler.java:59)com.amazonaws.mobileconnectors.apigateway.ApiClientFactory.getHandler(ApiClientFactory.java:145)com.amazonaws.mobileconnectors.apigateway.ApiClientFactory.build( ApiClientFactory.java:123)com.example.ListFragment $ overlay.onCreateView(ListFragment.java:60)com.example.ListFragment $ override.access $ dispatch的com.example.API.testApiGatwaySdk(API.java:125) (ListFragment.java)位于android.support.v4.app.FragmentManagerImpl的android.support.v4.app.Fragment.performCreateView(Fragment.java:2080)的com.example.ListFragment.onCreateView(ListFragment.java:0)。在android.support.v4上的android.support.v4.app.FragmentManagerImpl.moveToState(FragmentManager.java:1290)上的moveToState(FragmentManager.java:1108) android.support.v4.app.FragmentC上的.v4.app.FragmentManagerImpl.dispatchActivityCreated(FragmentManager.java:2149)在android.support.v4.app.FragmentActivity.onStart(FragmentActivity.java:600)上的android.spupport.vs上有一个ontroller.dispatchActivityCreated(FragmentController.java:201),android.support.v7.app.AppCompatActivity.onStart(AppCompatActivity.java:178) .app.Instrumentation.callActivityOnStart(Instrumentation.java:1256)位于android.app.ActivityThread的android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2910)的android.app.Activity.performStart(Activity.java:6929)。 handleLaunchActivity(ActivityThread.java:3008)位于android.app.A活动中的android.app.ActivityThread.handleRelaunchActivity(ActivityThread.java:4974),android.app.ActivityThread $ H.handleMessage(ActivityThread。)的android.app.ActivityThread.-wrap21(ActivityThread.java)。 java:1656)在android.os.Handler.dispatchMessage(Handler.java:102)的android.app.Looper.loop(Looper.java:154)在android.app.ActivityThread.main(ActivityThread.java:6688)at com.android.internal.os.ZygoteInit上的java.lang.reflect.Method.invoke(Native Method)$ MethodAndArgsCaller.run(ZygoteI) nit.java:1468)at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1358)引起:java.lang.ClassNotFoundException:未找到类“com.amazonaws.util.json.DateDeserializer”在路径上: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文件“/data/data/com.example/files/instant-run/dex/slice-slice_7-classes.dex”,dex文件“/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 /数据/ com。示例/文件/即时运行/ DEX /片,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/切片internal_impl-24.2.0_982f26845e74cf0a28b29b365

android amazon-web-services aws-sdk aws-api-gateway
1个回答
0
投票

您使用的是非常旧的aws-android-sdk-core版本,与API网关生成的替换客户端不兼容。请将sdk更新为最新版本。

© www.soinside.com 2019 - 2024. All rights reserved.