首页 > 移动开发 > 移动测试 > Unity上使用华为AGC服务Demo常见操作及问题
首先,提供个在Unity中集成华为服务的Demo下载链接,可以先尝试接入
https://github.com/Unity-Technologies/HuaweiServiceSample
Project has invaild dependenciess: com.unity.textmeshpro: connect ETIMEDOUT 172.81.232.209:443 com.unity.timeline: connect ETIMEDOUT 172.81.232.209:443

此时可以忽略该问题,点击 Continue,进入项目。然后在项目内部,点击 Window - Package Management
找到需要更新的包,点击Update,更新到最新版本即可。

选择File - Build Setting,选择Android,点击Switch Platform,切换到Android

此时有如下错误,可以直接忽略,关掉该项目,再重新打开即可解决该问题
Microsoft (R) Visual C# Compiler version 2.9.1.65535 (9d34608e) Cpoyright(C) Microsoft Corporation. All right reserved.

在Build Setting界面,点击Player Settting,进入项目设置页面,
首先,配置Product Name,配置为你需要的名称
然后,在Other Setting中,配置Package Name,此名称为Android应用的包名,需要和AGC的json文件中名称保持一致。
在Publish Setting中,去勾选 Custom KeyStore.(此处仅针对AGC的9项无需签名的服务,如果涉及签名,请完成生成签名的相关操作)

最后,在AGC界面下载json文件并且放到项目的..\Assets\Plugins\Android 路径下
在Build Setting中,选择对应的设备,点击Build and run,此时会报如下错误,
org.gradle.launcher.GradleMain "-Dorg.gradle.jvmargs=-Xmx4096m" "assembleDebug" stderr[ Picked up JAVA_TOOLOPTIONS: Dfile.encoding=UTF-8

此问题是我们取消了对应的签名文件,但是在gradle文件中又使用该文件造成的。
想要解决该问题,需要打开..\Assets\Plugins\Android路径下的launcherTemplate.gradle文件,找到如下代码段,将其注释:

Temp\gradleOut\launcher\build\outputs\apk\release\launcher-release.apk does not exist System.IO.File.Move(System.String.sourceFileName, System.String destFileName)

解决此问题:需要在打包的时候,勾选下图中的选项

原文链接: https://developer.huawei.com/consumer/cn/forum/topic/0203477564318780394?fid=0101271690375130218
原作者:Mayism
来自 “ ITPUB博客 ” ,链接:https://blog.itpub.net/69970551/viewspace-2780874/ ,如需转载,请注明出处,否则将追究法律责任。