【问题标题】:Getting error while using Huawei ImageKit doInit() method使用 Huawei ImageKit doInit() 方法时出错
【发布时间】:2020-08-06 18:42:07
【问题描述】:

我正在尝试在我的 android 项目中使用 ImageKit。

val res = imageRenderAPI.doInit(sourcePath, getAuthJson())

每当我像上面的代码那样调用doInit方法时,它总是抛出错误代码35,根据文档翻译为ERROR_DOINIT

我的 XML 文件如下:

<?xml version="1.0" encoding="utf-8"?>
<Root screenWidth="1080">
  <Image x="1080" y="1920" src="background.png"></Image> 
  <Image w="481" h="432"  x="481" y="120" pivotX="500" pivotY="80" rotationX="50" rotationY="50" src="human.png" > 
    <PositionAnimation> 
        <Position x="0" y="0" time="0"/> 
        <Position x="500" y="0" time="1000"/> 
    </PositionAnimation>    
    <RotationAnimation >       
        <Rotation angle="0" time="0"/>        
        <Rotation angle="360" time="6000"/>     
    </RotationAnimation>
</Image>
</Root>

关于 authJson 的参数,我完全按照我从 app/agconnect-services.json 中获得的 appId、authApiKey、clientSecret 和 clientId 的信息,除了我不确定要输入什么值的项目 id,我尝试使用 agconnect-services.json 中的 cp_id 和 product_id 作为 projectId,也给出了同样的错误。而且我在这里不使用任何令牌,因为文档Image Kit Documentation 说令牌是可选的。我无法弄清楚哪一部分是错误的,感谢任何帮助。

【问题讨论】:

  • 有趣....

标签: android huawei-mobile-services huawei-developers


【解决方案1】:

您是否初始化了图像渲染服务?

在初始化服务时,您的应用需要传递sourcePath(要解析的资源的路径)和认证信息(例如APIKey和证书指纹,JSON格式)。您的应用只有在成功通过身份验证后才能使用该服务。

您收到错误代码 35,在官方文档中描述为:初始化错误。该问题的官方解决方案是:

检查输入的资源路径是否正确。

有关 Image Kit 相关错误的列表及其含义,这里是文档:Documentation

【讨论】:

    猜你喜欢
    • 2015-09-07
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2015-03-06
    • 2010-12-11
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多