简体   繁体   English

Android App Bundle构建失败

[英]Android App Bundle build fails

I have problem with building our app with new Google's feature which name is App Bundle . 我有使用新的Google功能构建我们的应用程序的问题,该功能的名称是App Bundle

When I run ./gradlew app:packageProductionReleaseBundle --stacktrace command, I receive: 当我运行./gradlew app:packageProductionReleaseBundle --stacktrace命令时,我收到:

Execution failed for task ':app:packageProductionReleaseBundle'.
            java.util.concurrent.ExecutionException: com.android.tools.build.bundletool.exceptions.ValidationException: Error validating module 'base'.
                              ...
                           LONG STACK TRACE...
                              ...
Caused by: com.android.tools.build.bundletool.exceptions.BundleFileTypesException$FileUsesReservedNameException: File 'root/res/drawable/adoceansdk_close_interstitial_button.png' uses reserved file or directory name 'res'.
                at com.android.tools.build.bundletool.validation.BundleFilesValidator.validateModuleFile(BundleFilesValidator.java:112)
                at com.android.tools.build.bundletool.validation.ValidatorRunner.lambda$validateBundleModules$6(ValidatorRunner.java:73)
                at com.google.common.collect.ImmutableList.forEach(ImmutableList.java:406)
                at com.android.tools.build.bundletool.validation.ValidatorRunner.validateBundleModules(ValidatorRunner.java:73)

The reason for this is the external library in .jar we use. 原因是我们使用的.jar中的外部库。

How can I fix it without removing this library? 如何在不删除此库的情况下修复它?

Thank you for the answer in advance. 提前谢谢你的回答。

If this external library is meant to be used in an Android app, I believe it should be exported as an AAR, not a JAR. 如果要在Android应用程序中使用此外部库,我认为它应该导出为AAR,而不是JAR。 See https://developer.android.com/studio/projects/android-library 请参阅https://developer.android.com/studio/projects/android-library

One of the solution can be you get pre- compiled library file of this google module. 其中一个解决方案是你可以获得这个谷歌模块的预编译库文件。 I think a little google. 我觉得有点谷歌。 search will help you. 搜索将帮助您。 I myself would have done that but i didn't get the name of the module you are asking. 我本人会这样做,但我没有得到你问的模块的名称。

So, try and search for lib.so file this way you will get the functionality provided by the module as well now there will be no need to compile it. 因此,尝试以这种方式搜索lib.so文件,您将获得模块提供的功能,现在不需要编译它。

One more advantage is that compiling the module from scratch results in much much bigger apk size while using precompiled libraries result in much lesser apk size. 另一个优点是从头开始编译模块会导致更大的apk大小,而使用预编译库会导致更小的apk大小。

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

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