我在旧版Android上运行我的应用时遇到问题,因为我在尝试实例化CognitoCachingCredentialsProvider时遇到错误。
CognitoCachingCredentialsProvider credentialsProvider = new CognitoCachingCredentialsProvider(
this,
this.getString(R.string.identity_pool_id),
Regions.DEFAULT_REGION);
这适用于Lollipop 5.0,虽然它在Jellybean 4.4.2(API 17)上崩溃了我的应用程序。我还没有尝试其他版本的Android,因为我需要它在Jellybean及以上版本上工作。
有谁知道为什么这会给我一个关于Jellybean而不是Lollipop的错误?代码不会转到Jellybean中的try / catch块,而只会杀死应用程序而Logcat会提供此错误:
10-12 05:48:53.271 1288-1288/? E/dalvikvm: Could not find class 'com.amazonaws.auth.CognitoCachingCredentialsProvider$1', referenced from method com.amazonaws.auth.CognitoCachingCredentialsProvider.<init>
10-12 05:48:53.271 1288-1288/? E/dalvikvm: Could not find class 'com.amazonaws.auth.CognitoCachingCredentialsProvider$1', referenced from method com.amazonaws.auth.CognitoCachingCredentialsProvider.<init>
10-12 05:48:53.271 1288-1288/? E/dalvikvm: Could not find class 'com.amazonaws.auth.CognitoCachingCredentialsProvider$1', referenced from method com.amazonaws.auth.CognitoCachingCredentialsProvider.<init>
10-12 05:48:53.271 1288-1288/? E/dalvikvm: Could not find class 'com.amazonaws.auth.CognitoCachingCredentialsProvider$1', referenced from method com.amazonaws.auth.CognitoCachingCredentialsProvider.<init>
10-12 05:48:53.271 1288-1288/? E/dalvikvm: Could not find class 'com.amazonaws.auth.CognitoCachingCredentialsProvider$1', referenced from method com.amazonaws.auth.CognitoCachingCredentialsProvider.<init>
10-12 05:48:53.271 1288-1288/? E/dalvikvm: Could not find class 'com.amazonaws.auth.CognitoCachingCredentialsProvider$1', referenced from method com.amazonaws.auth.CognitoCachingCredentialsProvider.<init>
10-12 05:48:53.271 1288-1288/? E/dalvikvm: Could not find class 'com.amazonaws.auth.CognitoCachingCredentialsProvider$1', referenced from method com.amazonaws.auth.CognitoCachingCredentialsProvider.<init>
10-12 05:48:53.271 1288-1288/? E/dalvikvm: Could not find class 'com.amazonaws.auth.CognitoCachingCredentialsProvider$1', referenced from method com.amazonaws.auth.CognitoCachingCredentialsProvider.<init>
10-12 05:48:53.271 1288-1288/? E/dalvikvm: Could not find class 'com.amazonaws.auth.CognitoCachingCredentialsProvider$1', referenced from method com.amazonaws.auth.CognitoCachingCredentialsProvider.<init>
10-12 05:48:53.283 1288-1288/? E/AndroidRuntime: FATAL EXCEPTION: main
10-12 05:48:53.283 1288-1288/? E/AndroidRuntime: java.lang.VerifyError: com/amazonaws/auth/CognitoCachingCredentialsProvider
10-12 05:48:53.283 1288-1288/? E/AndroidRuntime: at au.appsprout.com.dropmap.Start.onCreate(Start.java:38)
10-12 05:48:53.283 1288-1288/? E/AndroidRuntime: at android.app.Instrumentation.callApplicationOnCreate(Instrumentation.java:1000)
10-12 05:48:53.283 1288-1288/? E/AndroidRuntime: at android.app.ActivityThread.handleBindApplication(ActivityThread.java:4391)
10-12 05:48:53.283 1288-1288/? E/AndroidRuntime: at android.app.ActivityThread.access$1300(ActivityThread.java:141)
10-12 05:48:53.283 1288-1288/? E/AndroidRuntime: at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1294)
10-12 05:48:53.283 1288-1288/? E/AndroidRuntime: at android.os.Handler.dispatchMessage(Handler.java:99)
10-12 05:48:53.283 1288-1288/? E/AndroidRuntime: at android.os.Looper.loop(Looper.java:137)
10-12 05:48:53.283 1288-1288/? E/AndroidRuntime: at android.app.ActivityThread.main(ActivityThread.java:5041)
10-12 05:48:53.283 1288-1288/? E/AndroidRuntime: at java.lang.reflect.Method.invokeNative(Native Method)
10-12 05:48:53.283 1288-1288/? E/AndroidRuntime: at java.lang.reflect.Method.invoke(Method.java:511)
10-12 05:48:53.283 1288-1288/? E/AndroidRuntime: at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:793)
10-12 05:48:53.283 1288-1288/? E/AndroidRuntime: at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:560)
10-12 05:48:53.283 1288-1288/? E/AndroidRuntime: at dalvik.system.NativeStart.main(Native Method)
答案 0 :(得分:1)
找到解决方案。这与MultiDex没有在旧版Android(Lollipop之前)上工作有关。以下是针对此问题的任何人的解决方案链接:Unable to execute dex: method ID not in [0, 0xffff]: 65536