1

我在運行舊版Android應用程序時遇到問題,因爲嘗試實例化CognitoCachingCredentialsProvider時出現錯誤。Android AWS CognitoCachingCredentialsProvider在API 17中崩潰應用程序 - JellyBean

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 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) 
+1

找到解決方案。這是因爲MultiDex不適用於較舊版本的Android(在棒棒糖之前)。 這裏是解決方案的任何人有這個問題的鏈接: http://stackoverflow.com/questions/15209831/unable-to-execute-dex-method-id-not-in-0-0xffff-65536/26196397#26196397 – Nickmccomb

+2

您可以將此信息作爲您的問題的答案發布:http://stackoverflow.com/help/self-answer –

回答