是否可以使用新的 Material 组件将应用程序发布到 Play 商店?

Is it possible to publish apps to the Play Store using the new Material Components?

我想使用 28.0.0-alpha1 版设计支持库中引入的新 Material 组件。

我发现如果不将 compileSdkVersion 设置为 android-P,此版本的设计库将无法编译,因为它引用仅在 API 级别 28 上找到的属性(例如, ).

另一方面,Google Play 控制台不允许我上传面向 android-P 的应用,它给我错误 "You cannot upload a test-only APK"。这似乎是故意的,因为 these docs 状态:

Google Play prevents publishing of apps targeting the P Developer Preview. When the Android P final SDK is available, you’ll be able to target the official Android P API level and publish your app to Google Play via the alpha, beta, and production release channels.

这是否真的意味着新组件还不能用于生产应用程序?

Does this really mean that the new components can't be used for production apps yet?

它应该用于试用目的,但不应发布给最终用户。顾名思义,它仍处于预览阶段,尚未最终确定。

从开发人员的角度来看,目的是让我们在最终版本发布之前熟悉 API,并通过使用新 API 为用户提供最佳体验来为我们的应用程序更新做好准备。这也使我们能够事先检查兼容性并为遵守新的更改和政策做好准备。

从 Google 的角度来看,他们有机会执行一些测试,从开发人员那里获得反馈以微调他们的实施并修复在此过程中发现的问题。简而言之,他们使用开发人员作为他们新 API 和功能的测试人员。最终 API 可能会有一些剧烈的变化,这可能会破坏我们应用程序的预期行为,因此 Google 阻止并阻止我们意外上传到 Play 商店。

更新:根据 this blog post.

,现在正式支持发布以 Android P 为目标的应用程序

Starting today you can publish your APK updates that are compiled against, or optionally targeting, API 28. Publishing an update to Google Play during the preview lets you push updates to users to test compatibility on existing devices, including devices running Android P Beta 2.

下面是旧答案。


在此期间,感谢 /u/slartibartfast_iv on reddit

,我找到了解决方法

我最初以为 Play 管理中心正在检查该应用是否针对 Android P 预览,只是显示误导性错误消息。事实证明,它实际上只是检查是否设置了仅测试标志,如果您的目标是 P 预览,则由 Android Studio 在编译时完成。

然而,您可以像禁用任何其他构建一样禁用它(请参阅 ),我具体做的是将以下内容添加到我的 gradle.properties:

android.injected.testOnly=false