3

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

AdamK
  • 21,199
  • 5
  • 42
  • 58
Pinser
  • 1,898
  • 3
  • 29
  • 43

4 Answers4

2

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.

James
  • 3,485
  • 3
  • 20
  • 43
1

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.

hjchin
  • 864
  • 2
  • 8
  • 25
0

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/

Pinser
  • 1,898
  • 3
  • 29
  • 43
0

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.

AdamK
  • 21,199
  • 5
  • 42
  • 58