To elaborate, I dont want to migrate to Android X. I just want to use one feature called Android Slices. https://developer.android.com/guide/slices/getting-started
-
Have you tried using the support library? – Brijesh Joshi Jul 23 '18 at 13:21
-
I have been trying, the issues themselves are unclear whether they are because of misconfiguration, beta tools or not supported. – Pinser Jul 24 '18 at 00:50
-
Are you getting issue in the gradle ? – Brijesh Joshi Jul 24 '18 at 04:24
4 Answers
This is an excellent question. You can setup gradle to use the support library for this instead of AndroidX but the documentation is non existent.
implementation 'com.android.support:slices-builders:28.0.0-rc02'
implementation 'com.android.support:slices-core:28.0.0-rc02'
implementation 'com.android.support:slices-view:28.0.0-rc02'
This compiles fine, but I can't find a single page of documentation. All the examples use ListBuilder which is in the AndroidX packages.
Short answer, it's badly documented. Having spent all day trying to get it to work I'm giving up disappointed.

- 3,485
- 3
- 20
- 43
From the article you give,
While not always required, Android Studio 3.2 or later contains additional tools and functionality that can help you with Slice development, including:
- AndroidX refactoring tool: required if you're working in a project that uses AndroidX libraries.
- Slices lint checks: catches common anti-practices when building Slices SliceProvider
- template: handles the boilerplate when building a SliceProvider
I think you do not need AndroidX.

- 864
- 2
- 8
- 25
Based on this article I guess we can use Slices without depending on android X.
Both the provider and host apps will need to:
Have compileSdkVersion 'android-P' and targetSdkVersion 'P' Have a dependency on either 'com.android.support:slices-view:28.0.0-alpha1' or 'com.android.support:slices-builders:28.0.0-alpha1', depending on their role
https://blog.novoda.com/android-p-slices-missing-documentation-part-1/

- 1,898
- 3
- 29
- 43
Yes, currently Slices are available in the old com.android.support
packages, you can use them by adding these dependencies to your build.gradle
:
implementation 'com.android.support:slices-core:28.0.0-rc1'
implementation 'com.android.support:slices-builders:28.0.0-rc1'
(where rc1 is the latest version at time of writing).
This is mentioned in the docs as well.
However, like most legacy com.android.support
packages, at some point in the future, there will be no new versions in the legacy com.android.support
package and future development will only happen in the androidx.*
. You can read more about this on the AndroidX overview page.

- 21,199
- 5
- 42
- 58