question

A. Pigg avatar image
A. Pigg asked

Getting started with GameCircle ... unable to read api_key.txt

Hi Im in the process of porting me game from Scoreloop to Gamecircle. Ive generated the api_key.txt and put it in the assets folder. Opening the apk file showss that it is in the right place. im signing the app with the same certificate, however, I get this error on startup: E/GameCircleClient(12308): Unable to read api key. GameCircle requires an api key to be included in 'assets/api_key.txt'. GameCircle will not initialize. Where am i going wrong? Thanks! Adam Starting remote process.D/dalvikvm(12308): Zygote::ForkAndSpecialize : 0 E/cutils (12308): to chown(/mnt/shell/emulated/0, 0, 0) E/cutils (12308): to chown(/mnt/shell/emulated/obb, 0, 0) E/cutils (12308): to chown(/storage/emulated/0/Android, 0, 0) E/cutils (12308): to chown(/storage/emulated/0/Android/obb, 0, 0) D/dalvikvm(12308): zygote get new systemTid : 12308 D/dalvikvm(12308): threadid=2: interp stack at 0x4f62f000 D/dalvikvm(12308): threadid=3: interp stack at 0x4f737000 D/dalvikvm(12308): Elevating priority from 0 to -8 D/dalvikvm(12308): threadid=4: interp stack at 0x4f83f000 D/dalvikvm(12308): zygote get thread init done D/dalvikvm(12308): create interp thread : stack size=32KB D/dalvikvm(12308): create new thread D/dalvikvm(12308): new thread created D/dalvikvm(12308): update thread list D/dalvikvm(12308): threadid=5: interp stack at 0x54480000 D/dalvikvm(12308): threadid=5: created from interp D/dalvikvm(12308): start new thread D/dalvikvm(12308): create interp thread : stack size=32KB D/dalvikvm(12308): create new thread D/dalvikvm(12308): new thread created D/dalvikvm(12308): update thread list D/dalvikvm(12308): threadid=5: notify debugger D/dalvikvm(12308): threadid=5 (ReferenceQueueDaemon): calling run() D/dalvikvm(12308): threadid=6: interp stack at 0x54588000 D/dalvikvm(12308): threadid=6: created from interp D/dalvikvm(12308): start new thread D/dalvikvm(12308): create interp thread : stack size=32KB D/dalvikvm(12308): create new thread D/dalvikvm(12308): new thread created D/dalvikvm(12308): update thread list D/dalvikvm(12308): threadid=7: interp stack at 0x54690000 D/dalvikvm(12308): threadid=7: created from interp D/dalvikvm(12308): start new thread D/dalvikvm(12308): threadid=6: notify debugger D/dalvikvm(12308): threadid=6 (FinalizerDaemon): calling run() D/dalvikvm(12308): threadid=7: notify debugger D/dalvikvm(12308): threadid=7 (FinalizerWatchdogDaemon): calling run() D/dalvikvm(12308): threadid=8: interp stack at 0x54a96000 D/dalvikvm(12308): threadid=9: interp stack at 0x54b9e000 D/dalvikvm(12308): open_cached_dex_file : /data/app/uk.co.piggz.galaxy_attack_hd-1.apk /data/dalvik-cache/data@app@uk.co.piggz.galaxy_attack_hd-1.apk@classes.dex E/My Application Starting(12308): ********** W/dalvikvm(12308): No implementation found for native Lcom/amazon/ags/jni/AGSJniHandler;.isLoaded:()V I/AGSJniHandler(12308): AmazonGamesJni is not loaded, trying to load library D/dalvikvm(12308): Trying to load lib /data/app-lib/uk.co.piggz.galaxy_attack_hd-1/libAmazonGamesJni.so 0x41574a18 D/dalvikvm(12308): Added shared lib /data/app-lib/uk.co.piggz.galaxy_attack_hd-1/libAmazonGamesJni.so 0x41574a18 D/AGSJni (12308): JNI_OnLoad called D/AGSLeaderboardJni(12308): JNI_OnLoad called D/LeaderboardToJavaInterface(12308): initializeClient - called D/LeaderboardToJavaInterface(12308): initializeMethodIDs - called D/LeaderboardToJavaInterface(12308): initializeMethodIDs - initialized D/AGSAchievementJni(12308): JNI_OnLoad called D/AchievementToJavaInterface(12308): initializeClient - called D/AchievementToJavaInterface(12308): initializeMethodIDs - called D/AchievementToJavaInterface(12308): initializeMethodIDs - initialized D/AGSProfileJni(12308): JNI_OnLoad called D/ProfileToJavaInterface(12308): initializeClient - called D/ProfileToJavaInterface(12308): initializeMethodIDs - called D/ProfileToJavaInterface(12308): initializeMethodIDs - initialized D/GC_Whispersync(12308): JNI_OnLoad called D/GC_Whispersync(12308): initializeMethodIDs - called D/GameCircleToJavaInterface(12308): initializeClient - called D/GameCircleToJavaInterface(12308): initializeMethodIDs - called D/GameCircleToJavaInterface(12308): initializeMethodIDs - initialized D/GameCircleClient(12308): SDK Version: 2.4.2 D/com.amazon.identity.auth.device.utils.MAPLog.PII(12308): Extracting verison incremental: D/com.amazon.identity.auth.device.utils.MAPLog.PII(12308): Incremental version '%s' was in invalid format.: D/com.amazon.identity.auth.device.authorization.api.AmazonAuthorizationManager.PII(12308): AmazonAuthorizationManager:sdkVer=1.0.0 libVer=3.3.0: I/com.amazon.identity.auth.device.authorization.api.AmazonAuthorizationManager(12308): Options bundle is null E/GameCircleClient(12308): Unable to read api key. GameCircle requires an api key to be included in 'assets/api_key.txt'. GameCircle will not initialize. E/GameCircleClient(12308): java.lang.NullPointerException E/GameCircleClient(12308): at android.content.ContextWrapper.getPackageName(ContextWrapper.java:135) E/GameCircleClient(12308): at com.amazon.identity.auth.device.authorization.api.AmazonAuthorizationManager. (AmazonAuthorizationManager.java:123) E/GameCircleClient(12308): at com.amazon.ags.api.AmazonGamesClient.initialize(AmazonGamesClient.java:144) E/GameCircleClient(12308): at uk.co.piggz.galaxy_attack_hd.GalaxyAttackHDActivity. (GalaxyAttackHDActivity.java:64) E/GameCircleClient(12308): at java.lang.Class.newInstanceImpl(Native Method) E/GameCircleClient(12308): at java.lang.Class.newInstance(Class.java:1319) E/GameCircleClient(12308): at android.app.Instrumentation.newActivity(Instrumentation.java:1054) E/GameCircleClient(12308): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2223) E/GameCircleClient(12308): at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2358) E/GameCircleClient(12308): at android.app.ActivityThread.access$600(ActivityThread.java:156) E/GameCircleClient(12308): at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1340) E/GameCircleClient(12308): at android.os.Handler.dispatchMessage(Handler.java:99) E/GameCircleClient(12308): at android.os.Looper.loop(Looper.java:153) E/GameCircleClient(12308): at android.app.ActivityThread.main(ActivityThread.java:5299) E/GameCircleClient(12308): at java.lang.reflect.Method.invokeNative(Native Method) E/GameCircleClient(12308): at java.lang.reflect.Method.invoke(Method.java:511) E/GameCircleClient(12308): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:833) E/GameCircleClient(12308): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:600) E/GameCircleClient(12308): at dalvik.system.NativeStart.main(Native Method) D/AndroidRuntime(12308): Shutting down VM W/dalvikvm(12308): threadid=1: thread exiting with uncaught exception (group=0x412ac9a8) E/AndroidRuntime(12308): FATAL EXCEPTION: main E/AndroidRuntime(12308): java.lang.RuntimeException: Unable to instantiate activity ComponentInfo{uk.co.piggz.galaxy_attack_hd/uk.co.piggz.galaxy_attack_hd.GalaxyAttackHDActivity}: java.lang.NullPointerException E/AndroidRuntime(12308): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2232) E/AndroidRuntime(12308): at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2358) E/AndroidRuntime(12308): at android.app.ActivityThread.access$600(ActivityThread.java:156) E/AndroidRuntime(12308): at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1340) E/AndroidRuntime(12308): at android.os.Handler.dispatchMessage(Handler.java:99) E/AndroidRuntime(12308): at android.os.Looper.loop(Looper.java:153) E/AndroidRuntime(12308): at android.app.ActivityThread.main(ActivityThread.java:5299) E/AndroidRuntime(12308): at java.lang.reflect.Method.invokeNative(Native Method) E/AndroidRuntime(12308): at java.lang.reflect.Method.invoke(Method.java:511) E/AndroidRuntime(12308): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:833) E/AndroidRuntime(12308): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:600) E/AndroidRuntime(12308): at dalvik.system.NativeStart.main(Native Method) E/AndroidRuntime(12308): Caused by: java.lang.NullPointerException E/AndroidRuntime(12308): at android.content.ContextWrapper.getPackageManager(ContextWrapper.java:94) E/AndroidRuntime(12308): at com.amazon.ags.api.AmazonGamesClient.initialize(AmazonGamesClient.java:154) E/AndroidRuntime(12308): at uk.co.piggz.galaxy_attack_hd.GalaxyAttackHDActivity. (GalaxyAttackHDActivity.java:64) E/AndroidRuntime(12308): at java.lang.Class.newInstanceImpl(Native Method) E/AndroidRuntime(12308): at java.lang.Class.newInstance(Class.java:1319) E/AndroidRuntime(12308): at android.app.Instrumentation.newActivity(Instrumentation.java:1054) E/AndroidRuntime(12308): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2223) E/AndroidRuntime(12308): ... 11 more
10 |5000

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

John Vincent Fiel avatar image
John Vincent Fiel answered
same problem here.
10 |5000

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

A. Pigg avatar image
A. Pigg answered
Ok, in anser to my on thread, ive made some progress. When I changed my Java init code from the example in: https://developer.amazon.com/sdk/gamecircle/documentation/jni-api.html to: https://developer.amazon.com/appsandservices/apis/engage/gamecircle/docs/initialize-android It started to work! Im now getting some different errors, but im sure I can work with them. Ironically, I got it working 5 minutes after emailing amazon support!! Adam
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
This error is also thrown if the api key given is not correct. Either the package name or the MD5 fingerprint of the certificate that is used to sign your your apk is wrong in the API key settings. Please follow below guidelines in order to generate the correct API key. https://developer.amazon.com/public/apis/engage/gamecircle/docs/create-a-gamecircle-configuration#Generate%20API%20Keys If the problem persists, please send us the GameCircle configuration name, the API key name through ContactUs ( https://developer.amazon.com/public/support/contact/contact-us )
10 |5000

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

Wai avatar image
Wai answered
I also have the error. The problem is my api_key is different each time when i goto the game circle site.
10 |5000

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

SanyuK avatar image
SanyuK answered
This is a known issue. Please make sure to store the API key you receive from the developer portal in a safe place for reference.
10 |5000

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