willblaschko / AlexaAndroid

A library and sample app to abstract access to the Amazon Alexa service for Android applications.
GNU General Public License v2.0
280 stars 133 forks source link

Api Key Issue in android pie ("APIKey is incorrect or does not exist. Does assets/api_key.txt exist in the main application?") #159

Closed chaitu14 closed 5 years ago

chaitu14 commented 5 years ago

Hi I have build the app 8.1 and previous versions its working well. but come to android pie i got this apikey not found issue. can you please look into it. i felt there is key reading releated issue from assets in api level 28 and later.

explore.unify.com.unifyexplor 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.willblaschko.android.alexa.AuthorizationManager.(AuthorizationManager.java:56) at com.willblaschko.android.alexa.AlexaManager.(AlexaManager.java:61) at com.willblaschko.android.alexa.AlexaManager.getInstance(AlexaManager.java:85) at explore.unify.com.unifyexplor.activities.AssistenceActivity.initView(AssistenceActivity.java:299) at explore.unify.com.unifyexplor.activities.AssistenceActivity.onCreate(AssistenceActivity.java:87) at android.app.Activity.performCreate(Activity.java:7136) at android.app.Activity.performCreate(Activity.java:7127) at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1271) at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2893) at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:3048) at android.app.servertransaction.LaunchActivityItem.execute(LaunchActivityItem.java:78) at android.app.servertransaction.TransactionExecutor.executeCallbacks(TransactionExecutor.java:108) at android.app.servertransaction.TransactionExecutor.execute(TransactionExecutor.java:68) at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1808) at android.os.Handler.dispatchMessage(Handler.java:106) at android.os.Looper.loop(Looper.java:193) at android.app.ActivityThread.main(ActivityThread.java:6669) at java.lang.reflect.Method.invoke(Native Method) at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:493) at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:858) 2018-12-18 13:49:18.116 1883-2007/? E/TaskPersister: File error accessing recents directory (directory doesn't exist?). 2018-12-18 13:49:21.897 1883-2007/? E/TaskPersister: File error accessing recents directory (directory doesn't exist?). 2018-12-18 13:49:26.323 1883-1897/? E/memtrack: Couldn't load memtrack module

chaitu14 commented 5 years ago

i felt there is incompatibility while reading api_key.txt from assets. can anyone please address this

chaitu14 commented 5 years ago

I Just fixed this bug existing amazon sdk 3.0.0 having issue with android pie versions. Please modify it to amazon sdk 3.0.4. it works me now.

https://developer.amazon.com/sdk-download

Login With Amazon (3.0.4) - Aug 07, 2018 New Features Support for authorizing users on browserless and input constraint devices Compatible with Android P Bug fixes for token expiration if device timezone changes Support for hiding progress spinner animation upon authorization Compatibility Backwards compatible to version 2.x and 1.x

Prakhar-Agarwal-byte commented 3 years ago

I have no words to describe how u have solved my problem . Thank u very much!!