简体   繁体   English

错误:发现多个<meta-data>元素</meta-data>

[英]Error: Found multiple <meta-data> elements

I created an app (bundle: myApp.aab) (using cn1: Android build) and tried to upload it on google-console, but it was rejected with the following error:我创建了一个应用程序(bundle:myApp.aab)(使用 cn1:Android build)并尝试将其上传到 google-console,但由于以下错误而被拒绝:

An error occurred while running bundletool build-apks on your uploaded App Bundle.在您上传的 App Bundle 上运行 bundletool build-apks 时出错。 Ensure that your App Bundle is valid by running bundletool build-apks locally and try again.通过在本地运行 bundletool build-apks 确保您的 App Bundle 有效,然后重试。 Error: Found multiple elements for key 'com.google.android.gms.version', expected at most one.错误:找到键“com.google.android.gms.version”的多个元素,预计最多一个。

When I decompiled AndroidManifest.xml (using bundletool.jar on myApp.aab) I noticed that the following line appears twice:当我反编译 AndroidManifest.xml(在 myApp.aab 上使用 bundletool.jar)时,我注意到以下行出现了两次:

<meta-data android:name="com.google.android.gms.version" android:value="@integer/google_play_services_version" />

This is obviously the cause of the error described above.这显然是上述错误的原因。 This line appears only once in the 'build hints' (in cn1-settings: key=android.xapplication).此行仅在“构建提示”中出现一次(在 cn1-settings: key=android.xapplication 中)。

I tried to delete this <meta-data> tag (in the 'build hints'), but during the build process it was automatically added.我试图删除这个<meta-data>标签(在“构建提示”中),但在构建过程中它被自动添加了。

So the problem is that cn1 automatically generates this tag twice in the AndroidManifest.xml during the build process, and therefore google-console generates an error during the upload of the myApp.aab file.所以问题是 cn1 在构建过程中在 AndroidManifest.xml 中自动生成了这个标签两次,因此 google-console 在上传 myApp.aab 文件时产生了错误。

What can I do to avoid this problem?我该怎么做才能避免这个问题?

This might be a problem specific to Ant since that system used a somewhat flawed approach of modifying the build hints to inject additional meta-data.这可能是 Ant 特有的问题,因为该系统使用了一种有缺陷的方法来修改构建提示以注入额外的元数据。 As a workaround, try unzipping the fullscreen ads cn1lib and removing that hint from the properties file at the root.作为解决方法,请尝试解压缩全屏广告 cn1lib 并从根目录的属性文件中删除该提示。 Then rezip it and replace the existing file.然后重新压缩并替换现有文件。

Remove the build hint android.xpermissions .删除构建提示android.xpermissions It will regenerate without the meta tag.它将在没有元标记的情况下重新生成。 That might workaround the problem.这可能会解决问题。

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

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