Closed Gmrevo closed 6 years ago
Have you checked the keystore used to sign the app? Also, is your build configuration set to debug or release and are you using the appropriate keystore to sign your app?
Wow! Thanks for the super fast reply,
Yes, I have checked the keystore used to sign the app, I have used the same SHA256 and MD5 values in creating security profile at Amazon Developer Console.
My build configuration is set to debug version, yes I am using the appropriate.Jks file
I have attached the screenshot of the project for better understanding.
Is there anything else in the log prior to this error? Can you see the api key being read from file?
Here's the log prior to error:
It seems the API key added in assets is not being read somehow.
05-02 01:03:17.199 5484-5484/? I/MicroDetector: Keeping mic open: false
05-02 01:03:17.200 5484-13783/? I/AudioController: internalShutdown
05-02 01:03:17.200 5484-15093/? I/DeviceStateChecker: DeviceStateChecker cancelled
05-02 01:03:17.201 5484-12190/? I/MicroRecognitionRunner: Stopping hotword detection.
05-02 01:03:17.201 5484-9242/? I/MicroRecognitionRunner: Detection finished
05-02 01:03:17.233 605-15823/? D/audio_hw_primary: in_set_parameters: enter: kvpairs=routing=0
05-02 01:03:17.241 2710-2917/? I/ActivityManager: Start proc 15826:com.amazon.android.lwaapp/u0a224 for service com.amazon.android.lwaapp/com.amazon.android.alexa.service.DownChannelService
05-02 01:03:17.248 15826-15826/? I/art: Late-enabling -Xcheck:jni
05-02 01:03:17.252 560-746/? I/SFPerfTracer: triggers: (rate: 0:6) (32331 sw vsyncs) (0 skipped) (137:59502 vsyncs) (139:95211)
05-02 01:03:17.285 605-15823/? D/audio_hw_primary: disable_audio_route: reset and update mixer path: audio-record
05-02 01:03:17.287 605-15823/? D/audio_hw_primary: disable_snd_device: snd_device(107: voice-rec-mic)
05-02 01:03:17.294 5484-15446/? I/MicrophoneInputStream: mic_close SR : 16000 CC : 16 SO : 1999
05-02 01:03:17.311 15826-15826/com.amazon.android.lwaapp W/System: ClassLoader referenced unknown path: /data/app/com.amazon.android.lwaapp-1/lib/arm
05-02 01:03:17.328 15826-15826/com.amazon.android.lwaapp I/AlexaApplication: 4C:BE:19:05:85:DD:22:D7:76:3E:0F:92:D8:54:CC:87
05-02 01:03:17.329 15826-15826/com.amazon.android.lwaapp I/DownChannelService: Launched
05-02 01:03:17.333 9122-9122/? W/Settings: Setting preferred_network_mode has moved from android.provider.Settings.Secure to android.provider.Settings.Global.
05-02 01:03:17.337 15826-15826/com.amazon.android.lwaapp D/com.amazon.identity.auth.map.device.utils.MAPLog.PII: Extracting verison incremental:
I'll ask the dumb question. I see api_key but I don't see a .txt extension. Is this hidden in Android Studio or is the file actually named api_key with no extension?
It's a perfect question, I added a file of text type with no extension. (Default way of adding file) the extension seems to be hidden.
I imagine one of two problems exist:
About point #2. I just tested this. Adding a file of type text in Android Studio does not give it a .txt extension by default. At least it didn't for me. Check your assets directory just to be safe.
Thanks a ton for the help! Do you mean that file type must have .txt extension to be read?
Correct. The code looks for the file with extension .txt. Let me know if adding the .txt extension works.
It seems to rename the file extension for getting file extension doesn't work, I am getting the same error in logs. Please check the screenshot in support.
Can you send me the whole log again (or at least the relevant parts)?
Thanks for the support, I was able to resolve by updating the signing.gradle.
@Gmrevo How did you update the signing.gradle because I am currently fighting with the same problems as you were having?
Steps Taken:
Have cross-checked my API Key values defined in the assets folder and package name in security profile and android project.
Have refactored the package name
Have updated host in the manifest file
Have updated Product ID in contants declared
Still, I am unable to resolve this error, any help is much appreciated. Please provide some suggestions. Thanks for sharing the project. 05-02 00:34:12.293 12687-12687/com.amazon.android.lwaapp E/AuthorizationHandler: Unable to Use Amazon Authorization Manager. APIKey is incorrect or does not exist. Does assets/api_key.txt exist in the main application? java.lang.IllegalArgumentException: Invalid API Key at com.amazon.identity.auth.device.authorization.api.AmazonAuthorizationManager.(AmazonAuthorizationManager.java:119)
at com.amazon.android.alexa.AuthorizationManager.(AuthorizationManager.java:56)
at com.amazon.android.alexa.AlexaManager.(AlexaManager.java:70)
at com.amazon.android.alexa.AlexaManager.getInstance(AlexaManager.java:106)
at com.amazon.android.lwaapp.BaseActivity.initAlexaAndroid(BaseActivity.java:101)
at com.amazon.android.lwaapp.BaseActivity.onCreate(BaseActivity.java:68)
at com.amazon.android.lwaapp.MainActivity.onCreate(MainActivity.java:30)
at android.app.Activity.performCreate(Activity.java:6672)
at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1140)
at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2612)
at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2724)
at android.app.ActivityThread.-wrap12(ActivityThread.java)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1473)
at android.os.Handler.dispatchMessage(Handler.java:102)
at android.os.Looper.loop(Looper.java:154)
at android.app.ActivityThread.main(ActivityThread.java:6123)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:867)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:757)