question

hiramxu avatar image
hiramxu asked

java.lang.IllegalArgumentException: Invalid API Key

hello,i've finished all the guide lines of GameCircle,but appeared a warning and an error when init the GameCircle client. 01-30 14:29:17.161: W/com.amazon.identity.auth.device.appid.APIKeyDecoder(26796): Failed to decode: Decoding fails: certificate fingerprint can't be verified! 01-30 14:29:17.161: W/com.amazon.identity.auth.device.appid.APIKeyDecoder(26796): java.lang.SecurityException: Decoding fails: certificate fingerprint can't be verified! 01-30 14:29:17.161: W/com.amazon.identity.auth.device.appid.APIKeyDecoder(26796): at com.amazon.identity.auth.device.appid.APIKeyDecoder.verifyPayload(APIKeyDecoder.java:332) 01-30 14:29:17.161: W/com.amazon.identity.auth.device.appid.APIKeyDecoder(26796): at com.amazon.identity.auth.device.appid.APIKeyDecoder.doDecode(APIKeyDecoder.java:127) 01-30 14:29:17.161: W/com.amazon.identity.auth.device.appid.APIKeyDecoder(26796): at com.amazon.identity.auth.device.appid.APIKeyDecoder.decode(APIKeyDecoder.java:91) 01-30 14:29:17.161: W/com.amazon.identity.auth.device.appid.APIKeyDecoder(26796): at com.amazon.identity.auth.device.appid.AbstractAppIdentifier.getAppInfo(AbstractAppIdentifier.java:85) 01-30 14:29:17.161: W/com.amazon.identity.auth.device.appid.APIKeyDecoder(26796): at com.amazon.identity.auth.device.authorization.api.AmazonAuthorizationManager. (AmazonAuthorizationManager.java:123) 01-30 14:29:17.161: W/com.amazon.identity.auth.device.appid.APIKeyDecoder(26796): at com.amazon.ags.api.AmazonGamesClient.initialize(AmazonGamesClient.java:131) 01-30 14:29:17.161: W/com.amazon.identity.auth.device.appid.APIKeyDecoder(26796): at org.cocos2dx.lib.Cocos2dxActivity.onResume(Cocos2dxActivity.java:1064) 01-30 14:29:17.161: W/com.amazon.identity.auth.device.appid.APIKeyDecoder(26796): at android.app.Instrumentation.callActivityOnResume(Instrumentation.java:1185) 01-30 14:29:17.161: W/com.amazon.identity.auth.device.appid.APIKeyDecoder(26796): at android.app.Activity.performResume(Activity.java:5182) 01-30 14:29:17.161: W/com.amazon.identity.auth.device.appid.APIKeyDecoder(26796): at android.app.ActivityThread.performResumeActivity(ActivityThread.java:2732) 01-30 14:29:17.161: W/com.amazon.identity.auth.device.appid.APIKeyDecoder(26796): at android.app.ActivityThread.handleResumeActivity(ActivityThread.java:2771) 01-30 14:29:17.161: W/com.amazon.identity.auth.device.appid.APIKeyDecoder(26796): at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2235) 01-30 14:29:17.161: W/com.amazon.identity.auth.device.appid.APIKeyDecoder(26796): at android.app.ActivityThread.access$600(ActivityThread.java:141) 01-30 14:29:17.161: W/com.amazon.identity.auth.device.appid.APIKeyDecoder(26796): at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1234) 01-30 14:29:17.161: W/com.amazon.identity.auth.device.appid.APIKeyDecoder(26796): at android.os.Handler.dispatchMessage(Handler.java:99) 01-30 14:29:17.161: W/com.amazon.identity.auth.device.appid.APIKeyDecoder(26796): at android.os.Looper.loop(Looper.java:137) 01-30 14:29:17.161: W/com.amazon.identity.auth.device.appid.APIKeyDecoder(26796): at android.app.ActivityThread.main(ActivityThread.java:5041) 01-30 14:29:17.161: W/com.amazon.identity.auth.device.appid.APIKeyDecoder(26796): at java.lang.reflect.Method.invokeNative(Native Method) 01-30 14:29:17.161: W/com.amazon.identity.auth.device.appid.APIKeyDecoder(26796): at java.lang.reflect.Method.invoke(Method.java:511) 01-30 14:29:17.161: W/com.amazon.identity.auth.device.appid.APIKeyDecoder(26796): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:817) 01-30 14:29:17.161: W/com.amazon.identity.auth.device.appid.APIKeyDecoder(26796): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:584) 01-30 14:29:17.161: W/com.amazon.identity.auth.device.appid.APIKeyDecoder(26796): at dalvik.system.NativeStart.main(Native Method) 01-30 14:29:17.271: E/GameCircleClient(26796): Unable to read api key. GameCircle requires an api key to be included in 'assets/ api_key.txt'. GameCircle will not initialize. 01-30 14:29:17.271: E/GameCircleClient(26796): java.lang.IllegalArgumentException: Invalid API Key 01-30 14:29:17.271: E/GameCircleClient(26796): at com.amazon.identity.auth.device.authorization.api.AmazonAuthorizationManager. (AmazonAuthorizationManager.java:126) 01-30 14:29:17.271: E/GameCircleClient(26796): at com.amazon.ags.api.AmazonGamesClient.initialize(AmazonGamesClient.java:131) 01-30 14:29:17.271: E/GameCircleClient(26796): at org.cocos2dx.lib.Cocos2dxActivity.onResume(Cocos2dxActivity.java:1064) 01-30 14:29:17.271: E/GameCircleClient(26796): at android.app.Instrumentation.callActivityOnResume(Instrumentation.java:1185) 01-30 14:29:17.271: E/GameCircleClient(26796): at android.app.Activity.performResume(Activity.java:5182) 01-30 14:29:17.271: E/GameCircleClient(26796): at android.app.ActivityThread.performResumeActivity(ActivityThread.java:2732) 01-30 14:29:17.271: E/GameCircleClient(26796): at android.app.ActivityThread.handleResumeActivity(ActivityThread.java:2771) 01-30 14:29:17.271: E/GameCircleClient(26796): at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2235) 01-30 14:29:17.271: E/GameCircleClient(26796): at android.app.ActivityThread.access$600(ActivityThread.java:141) 01-30 14:29:17.271: E/GameCircleClient(26796): at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1234) 01-30 14:29:17.271: E/GameCircleClient(26796): at android.os.Handler.dispatchMessage(Handler.java:99) 01-30 14:29:17.271: E/GameCircleClient(26796): at android.os.Looper.loop(Looper.java:137) 01-30 14:29:17.271: E/GameCircleClient(26796): at android.app.ActivityThread.main(ActivityThread.java:5041) 01-30 14:29:17.271: E/GameCircleClient(26796): at java.lang.reflect.Method.invokeNative(Native Method) 01-30 14:29:17.271: E/GameCircleClient(26796): at java.lang.reflect.Method.invoke(Method.java:511) 01-30 14:29:17.271: E/GameCircleClient(26796): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:817) 01-30 14:29:17.271: E/GameCircleClient(26796): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:584) 01-30 14:29:17.271: E/GameCircleClient(26796): at dalvik.system.NativeStart.main(Native Method) Message was edited by: hiramxu
10 |5000

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

Sujoy@Amazon avatar image
Sujoy@Amazon answered
Hi Hiramxu, Sorry for the late reply. Can you send us the complete log after you trigger init till exception occurs?
10 |5000

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

Sujoy@Amazon avatar image
Sujoy@Amazon answered
Also, Can you make sure that you have correct api key placed in the asstes. The api key key should be generated by using the package name and md5 fingerprint of your apps signing certificate in the security profile you have associated with the GameCircle in your account in developer portal. For you connivance I am sending a sample app integrated with GameCircle to your registered email address. Please check.
10 |5000

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

hiramxu avatar image
hiramxu answered
That's all the log while initialize GameCircle , 02-07 17:11:06.831: V/codec_audio_pad(1218): in normal mode, headset or speaker on,****LINE:54,FUNC:set_normal_path 02-07 17:11:06.831: I/ActivityManager(2100): START u0 {act=android.intent.action.MAIN cat=[android.intent.category.LAUNCHER] flg=0x10200000 cmp=com.amazon.example.gamecircle2/.MyActivity} from pid 3136 02-07 17:11:06.901: D/dalvikvm(12323): Late-enabling CheckJNI 02-07 17:11:06.901: I/ActivityManager(2100): Start proc com.amazon.example.gamecircle2 for activity com.amazon.example.gamecircle2/.MyActivity: pid=12323 uid=10070 gids={50070, 3003, 1028} 02-07 17:11:07.001: W/dalvikvm(12323): No implementation found for native Lcom/amazon/ags/jni/AGSJniHandler;.isLoaded:()V 02-07 17:11:07.001: I/AGSJniHandler(12323): AmazonGamesJni is not loaded, trying to load library 02-07 17:11:07.001: W/AGSJniHandler(12323): AmazonGamesJni not found. Java Native Interface will not be available 02-07 17:11:07.011: D/com.amazon.identity.auth.device.utils.MAPLog.PII(12323): Extracting verison incremental: 02-07 17:11:07.011: D/com.amazon.identity.auth.device.utils.MAPLog.PII(12323): Extracting flavor: 02-07 17:11:07.011: D/com.amazon.identity.auth.device.authorization.api.AmazonAuthorizationManager.PII(12323): AmazonAuthorizationManager:sdkVer=1.0.0 libVer=3.3.0: 02-07 17:11:07.011: I/com.amazon.identity.auth.device.authorization.api.AmazonAuthorizationManager(12323): Options bundle is null 02-07 17:11:07.011: I/com.amazon.identity.auth.device.appid.AbstractAppIdentifier(12323): getAppInfo : packageName=com.amazon.example.gamecircle2 02-07 17:11:07.011: I/com.amazon.identity.auth.device.appid.AbstractAppIdentifier(12323): Finding API Key for com.amazon.example.gamecircle2 02-07 17:11:07.011: I/com.amazon.identity.auth.device.utils.ThirdPartyResourceParser(12323): Attempting to parse API Key from assets directory 02-07 17:11:07.011: I/com.amazon.identity.auth.device.appid.APIKeyDecoder(12323): Begin decoding API Key for packageName=com.amazon.example.gamecircle2 02-07 17:11:07.031: D/com.amazon.identity.auth.device.appid.APIKeyDecoder.PII(12323): APIKey: 02-07 17:11:07.031: I/com.amazon.identity.auth.device.appid.APIKeyDecoder(12323): num sigs = 1 02-07 17:11:07.031: D/com.amazon.identity.auth.device.appid.APIKeyDecoder.PII(12323): Signature checking.: 02-07 17:11:07.031: D/com.amazon.identity.auth.device.appid.APIKeyDecoder.PII(12323): Fingerpirint checking: 02-07 17:11:07.041: W/com.amazon.identity.auth.device.appid.APIKeyDecoder(12323): Failed to decode: Decoding fails: certificate fingerprint can't be verified! 02-07 17:11:07.041: W/com.amazon.identity.auth.device.appid.APIKeyDecoder(12323): java.lang.SecurityException: Decoding fails: certificate fingerprint can't be verified! 02-07 17:11:07.041: W/com.amazon.identity.auth.device.appid.APIKeyDecoder(12323): at com.amazon.identity.auth.device.appid.APIKeyDecoder.verifyPayload(APIKeyDecoder.java:332) 02-07 17:11:07.041: W/com.amazon.identity.auth.device.appid.APIKeyDecoder(12323): at com.amazon.identity.auth.device.appid.APIKeyDecoder.doDecode(APIKeyDecoder.java:127) 02-07 17:11:07.041: W/com.amazon.identity.auth.device.appid.APIKeyDecoder(12323): at com.amazon.identity.auth.device.appid.APIKeyDecoder.decode(APIKeyDecoder.java:91) 02-07 17:11:07.041: W/com.amazon.identity.auth.device.appid.APIKeyDecoder(12323): at com.amazon.identity.auth.device.appid.AbstractAppIdentifier.getAppInfo(AbstractAppIdentifier.java:85) 02-07 17:11:07.041: W/com.amazon.identity.auth.device.appid.APIKeyDecoder(12323): at com.amazon.identity.auth.device.authorization.api.AmazonAuthorizationManager. (AmazonAuthorizationManager.java:123) 02-07 17:11:07.041: W/com.amazon.identity.auth.device.appid.APIKeyDecoder(12323): at com.amazon.ags.api.AmazonGamesClient.initialize(AmazonGamesClient.java:131) 02-07 17:11:07.041: W/com.amazon.identity.auth.device.appid.APIKeyDecoder(12323): at com.amazon.example.gamecircle2.MyActivity.onResume(MyActivity.java:141) 02-07 17:11:07.041: W/com.amazon.identity.auth.device.appid.APIKeyDecoder(12323): at android.app.Instrumentation.callActivityOnResume(Instrumentation.java:1185) 02-07 17:11:07.041: W/com.amazon.identity.auth.device.appid.APIKeyDecoder(12323): at android.app.Activity.performResume(Activity.java:5182) 02-07 17:11:07.041: W/com.amazon.identity.auth.device.appid.APIKeyDecoder(12323): at android.app.ActivityThread.performResumeActivity(ActivityThread.java:2732) 02-07 17:11:07.041: W/com.amazon.identity.auth.device.appid.APIKeyDecoder(12323): at android.app.ActivityThread.handleResumeActivity(ActivityThread.java:2771) 02-07 17:11:07.041: W/com.amazon.identity.auth.device.appid.APIKeyDecoder(12323): at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2235) 02-07 17:11:07.041: W/com.amazon.identity.auth.device.appid.APIKeyDecoder(12323): at android.app.ActivityThread.access$600(ActivityThread.java:141) 02-07 17:11:07.041: W/com.amazon.identity.auth.device.appid.APIKeyDecoder(12323): at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1234) 02-07 17:11:07.041: W/com.amazon.identity.auth.device.appid.APIKeyDecoder(12323): at android.os.Handler.dispatchMessage(Handler.java:99) 02-07 17:11:07.041: W/com.amazon.identity.auth.device.appid.APIKeyDecoder(12323): at android.os.Looper.loop(Looper.java:137) 02-07 17:11:07.041: W/com.amazon.identity.auth.device.appid.APIKeyDecoder(12323): at android.app.ActivityThread.main(ActivityThread.java:5041) 02-07 17:11:07.041: W/com.amazon.identity.auth.device.appid.APIKeyDecoder(12323): at java.lang.reflect.Method.invokeNative(Native Method) 02-07 17:11:07.041: W/com.amazon.identity.auth.device.appid.APIKeyDecoder(12323): at java.lang.reflect.Method.invoke(Method.java:511) 02-07 17:11:07.041: W/com.amazon.identity.auth.device.appid.APIKeyDecoder(12323): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:817) 02-07 17:11:07.041: W/com.amazon.identity.auth.device.appid.APIKeyDecoder(12323): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:584) 02-07 17:11:07.041: W/com.amazon.identity.auth.device.appid.APIKeyDecoder(12323): at dalvik.system.NativeStart.main(Native Method) 02-07 17:11:07.041: E/GameCircleClient(12323): Unable to read api key. GameCircle requires an api key to be included in 'assets/ api_key.txt'. GameCircle will not initialize. 02-07 17:11:07.041: E/GameCircleClient(12323): java.lang.IllegalArgumentException: Invalid API Key 02-07 17:11:07.041: E/GameCircleClient(12323): at com.amazon.identity.auth.device.authorization.api.AmazonAuthorizationManager. (AmazonAuthorizationManager.java:126) 02-07 17:11:07.041: E/GameCircleClient(12323): at com.amazon.ags.api.AmazonGamesClient.initialize(AmazonGamesClient.java:131) 02-07 17:11:07.041: E/GameCircleClient(12323): at com.amazon.example.gamecircle2.MyActivity.onResume(MyActivity.java:141) 02-07 17:11:07.041: E/GameCircleClient(12323): at android.app.Instrumentation.callActivityOnResume(Instrumentation.java:1185) 02-07 17:11:07.041: E/GameCircleClient(12323): at android.app.Activity.performResume(Activity.java:5182) 02-07 17:11:07.041: E/GameCircleClient(12323): at android.app.ActivityThread.performResumeActivity(ActivityThread.java:2732) 02-07 17:11:07.041: E/GameCircleClient(12323): at android.app.ActivityThread.handleResumeActivity(ActivityThread.java:2771) 02-07 17:11:07.041: E/GameCircleClient(12323): at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2235) 02-07 17:11:07.041: E/GameCircleClient(12323): at android.app.ActivityThread.access$600(ActivityThread.java:141) 02-07 17:11:07.041: E/GameCircleClient(12323): at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1234) 02-07 17:11:07.041: E/GameCircleClient(12323): at android.os.Handler.dispatchMessage(Handler.java:99) 02-07 17:11:07.041: E/GameCircleClient(12323): at android.os.Looper.loop(Looper.java:137) 02-07 17:11:07.041: E/GameCircleClient(12323): at android.app.ActivityThread.main(ActivityThread.java:5041) 02-07 17:11:07.041: E/GameCircleClient(12323): at java.lang.reflect.Method.invokeNative(Native Method) 02-07 17:11:07.041: E/GameCircleClient(12323): at java.lang.reflect.Method.invoke(Method.java:511) 02-07 17:11:07.041: E/GameCircleClient(12323): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:817) 02-07 17:11:07.041: E/GameCircleClient(12323): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:584) 02-07 17:11:07.041: E/GameCircleClient(12323): at dalvik.system.NativeStart.main(Native Method) 02-07 17:11:07.041: I/System.out(12323): com.amazon.example.gamecircle2.MyActivity.onServiceNotReady 02-07 17:11:07.051: D/dalvikvm(12323): GC_CONCURRENT freed 256K, 16% free 5480K/6460K, paused 5ms+2ms, total 22ms 02-07 17:11:07.071: D/libEGL(12323): loaded /vendor/lib/egl/ libEGL_POWERVR_SGX544_115.so 02-07 17:11:07.081: D/libEGL(12323): loaded /vendor/lib/egl/ libGLESv1_CM_POWERVR_SGX544_115.so 02-07 17:11:07.081: D/libEGL(12323): loaded /vendor/lib/egl/ libGLESv2_POWERVR_SGX544_115.so 02-07 17:11:07.151: D/OpenGLRenderer(12323): Enabling debug mode 0 02-07 17:11:07.211: I/ActivityManager(2100): Displayed com.amazon.example.gamecircle2/.MyActivity: +317ms 02-07 17:11:08.431: D/PowerManagerService(2100): mHoldBootFastWakeLock = true
10 |5000

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

Bipin@Amazon avatar image
Bipin@Amazon answered
I see --- Unable to read api key. GameCircle requires an api key to be included in 'assets/ api_key.txt'. GameCircle will not initialize. can you double check that api key is included while constructing an apk. You can unzip the apk and cross check that.
10 |5000

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

hiramxu avatar image
hiramxu answered
10 |5000

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.