不能在Unity插件上使用谷歌播放服务 [英] Can't use google play services on unity java plugin
问题描述
我有一个用Java编写的Unity插件。在这个插件中,我需要获取新的Google 广告ID 它必须添加到Manifest文件中:
I have a plugin for Unity that is written in Java. In this plugin I need to get the new Google Advertisement ID to do it, I have to add to the Manifest file:
<meta-data android:name="com.google.android.gms.version" android:value="@integer/google_play_services_version" />
当我编译时,Unity抛出错误:
When I compile, Unity is throwing error:
Error building Player: CommandInvokationFailure: Failed to re-package resources. See the Console for details.
/Applications/adt/sdk/build-tools/android-4.2.2/aapt package --auto-add-overlay -v -f -m - J gen -M AndroidManifest.xml -S "res" -I "/Applications/adt/sdk/platforms/android- 19/android.jar" -F bin/resources.ap_
stderr[
AndroidManifest.xml:21: error: Error: No resource found that matches the given name (at 'value' with value '@integer/google_play_services_version').
]
我也尝试将Google Play服务jar添加到[lugins / Androif但没有帮助。
使它工作的正确方法是什么?
I also tried to add the Google play services jar to the [lugins/Androif folder but that didn't help. What is the correct way to make it work?
推荐答案
要解决此错误,您必须复制 version.xml
文件来自 android-sdk / extras / google / google_play_services / libproject / google-play-services_lib / res / values /
转换为 Assets / Plugins / Android / res / values /
您的Unity项目文件夹。
To fix this error, you have to copy the version.xml
file from android-sdk/extras/google/google_play_services/libproject/google-play-services_lib/res/values/
into Assets/Plugins/Android/res/values/
your Unity project's folder.
这篇关于不能在Unity插件上使用谷歌播放服务的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!