简体   繁体   English

Android中的Aviary SDK更新

[英]Aviary SDK update in Android

So we've been using Aviary SDK in our project for a long time, and no problems occured. 所以我们长期以来一直在我们的项目中使用Aviary SDK,没有出现任何问题。 But when we updated the Aviary version to latest, some strange behavior was revealed - when u first install application with new version of Aviary bundled on a device, which has version of app with older Aviary version, app crashes with exception - 但是,当我们将Aviary版本更新为最新版本时,会发现一些奇怪的行为 - 当您首次安装捆绑在设备上的新版Aviary应用程序时,该应用程序版本较旧的Aviary版本,应用程序崩溃异常 -

FATAL EXCEPTION: IntentService[AviaryCdsService]
java.lang.IllegalStateException: Missing required api key secret

second run of installed app work as expected, and all functions are working properly. 第二批已安装的应用程序按预期工作,并且所有功能都正常运行。 If device doesn't have previously installed app, no crash occured and installation runs fine. 如果设备没有以前安装的应用程序,则不会发生崩溃并且安装运行正常。 This behavior revealed when migrating from com.aviary.android.feather.sdk:aviary-sdk:3.4.3.351 to com.aviary.android.feather.sdk:aviary-sdk:3.6.3 com.aviary.android.feather.sdk:aviary-sdk:3.4.3.351迁移到com.aviary.android.feather.sdk时,会出现此行为:aviary -sdk:3.6.3

Does anyone else had such problem, and is there any way to avoid this crash? 有没有其他人有这样的问题,有没有办法避免这种崩溃?

Create application class and put below code in onCreate() methide 创建应用程序类并将下面的代码放在onCreate()methide中

Intent cdsIntent = AviaryIntent.createCdsInitIntent(getBaseContext(), API_SECRET, null); Intent cdsIntent = AviaryIntent.createCdsInitIntent(getBaseContext(),API_SECRET,null); startService( cdsIntent ); startService(cdsIntent);

I was experiencing the same exception, but it may have been because I was calling AviaryIntent.createCdsInitIntent inside an activity. 我遇到了同样的异常,但可能是因为我在一个活动中调用了AviaryIntent.createCdsInitIntent Once I moved the call to AviaryIntent.createCdsInitIntent to the Application this exception went away. 一旦我AviaryIntent.createCdsInitIntent的调用AviaryIntent.createCdsInitIntentApplication这个例外就消失了。

The answer is in the documentation. 答案在文档中。

4.1. 4.1。 Assets Folder Create a folder called "aviary" inside the assets folder of your application. 资产文件夹在应用程序的assets文件夹中创建一个名为“aviary”的文件夹。 Inside, create a file called "aviary.txt" - on the first line of this file put your API-secret and on the second line put your Google Play billing public API key. 在里面,创建一个名为“aviary.txt”的文件 - 在此文件的第一行放置您的API密码,在第二行放置您的Google Play结算公共API密钥。 This file is not entirely necessary but you will receive a warning if you exclude it. 此文件并非完全必要,但如果您将其排除,则会收到警告。 We do this to optimize content downloads when your app is not active. 我们这样做是为了在您的应用未处于活动状态时优化内容下载。 Check the assets folder of the sample application for a template on how to do this. 检查示例应用程序的assets文件夹以获取有关如何执行此操作的模板。

如果您没有应用的Google Play结算公开API密钥,该怎么办?

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM