4

I'd like to use the new Material Components introduced in the 28.0.0-alpha1 version of the design support library.

I found that this version of the design library won't compile without setting compileSdkVersion to android-P, because it references attributes only found on API level 28 (for example, android:attr/dialogCornerRadius).

On the other hand, the Google Play Console won't let me upload an app targeting android-P, it's giving me the error "You cannot upload a test-only APK". This seems intentional, as these docs state:

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?

zsmb13
  • 85,752
  • 11
  • 221
  • 226

2 Answers2

2

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

It should be used for trial purposes but shouldn't be released to end users. As the name suggest its still in Preview phase and not yet finalized.

From the developer point of view, the purpose is to allow us to get familiar with the APIs before final version is released and be prepared with updates of our apps by consuming the new APIs to give best experience to the users. This also enables us to check for compatibility before hand and prepare ourselves to comply with new changes and policies.

From Google's point of view, they get chance of performing some tests, get feedback from developers to fine tune their implementation and fix the issues discovered during this process. In short they use developers as testers of their new APIs and features. There could be some drastic changes in final APIs which could break the expected behavior of our apps, hence Google discourages and blocks us from accidentally uploading to play store.

Sagar
  • 23,903
  • 4
  • 62
  • 62
  • Thank you for your explanation. I was mostly aware of why the restriction was in place, I was looking to find a workaround for it. – zsmb13 Jun 03 '18 at 10:49
1

Update: publishing apps that target Android P is now officially supported, as per this blog post.

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.

Old answer below.


In the meantime I found a workaround thanks to /u/slartibartfast_iv on reddit.

I initially thought that the Play Console is checking whether the app is targeting the Android P Preview and just displaying a misleading error message. It turns out it's really just checking if the test only flag is set, which is done at compile time by Android Studio if you're targeting the P Preview.

You can however disable it just like for any other build (see this answer), what I specifically did was I added the following to my gradle.properties:

android.injected.testOnly=false
zsmb13
  • 85,752
  • 11
  • 221
  • 226