Problem Description
Our project is developed with Unity . Huawei's official intermodal game sdk is android sdk . I use android as an aar package and import it into unity to access sdk , and add sdk dependencies and other configurations to unity 's gradle . Error after integration:
Get appId with AGConnectServiceConfig failed
In getMetaDataAppId,Failed to read meta data for the AppID
Get client/app_id failed:java.io.FileNotFoundException:agconnect-services.json
The client/app_id is null
problem analysis
In our project, the json file is downloaded from the Huawei background according to the document requirements and placed in the project root directory, and the appid is also configured in the Androidmanifest.xml file , as follows:
<meta-data
android:name="com.huawei.hms.client.appid"
android:value="appid=xxx">
I don't understand why it still prompts that the json file cannot be found. I found on the Internet that do not repeat the configuration, you need to configure the appid in the Androidmanifest.xml file of unity , and the configuration in the aar package exported by android will not take effect. The reason is that when the plugin is imported into Unity, the Androidmanifest.xml file imported into the Unity project will be automatically renamed to Androidmanifest 1.xml and Androidmanifest 2.xml . Since only one "Androidmanifest" file can be recognized in the same Android program, the Androidmanifest.xml file imported and renamed later will not be recognized.
problem solved
According to the technical reply, move the configuration to the Androidmanifest.xml of Unity , and the problem is solved.