Questions tagged [androidx]

New Android extension libraries (AndroidX) which represents an Android Support Library.

New package structure to make package structure clearer which packages are bundled with the Android operating system, and which are packaged with Android app's APK. Going forward, the android.* package hierarchy will be reserved for Android packages that ship with the operating system; other packages will be issued in the new androidx.* package hierarchy.

Existing packages are being refactored to use the new hierarchy. Historical artifacts—those versioned 27 and earlier, and packaged as android.support.* —will remain available on Google Maven; however, all new development will occur in the new androidx.*-packaged artifacts versioned starting from 1.0.0.

Release blog

Official Google Doc

AndroidX release notes

AndroidX refactoring

2486 questions
38
votes
6 answers

How can I render plain android ProgressBar with Compose?

My application needs a ProgressBar, and I am trying to implement it with Jetpack Compose, so either I need a builtin ProgressBar support (I didn't find it) or there should be a mechanism to display plain Android Widgets with Compose. Is anything of…
38
votes
1 answer

androidx.lifecycle.DefaultLifecycleObserver not found

I am having a problem where my build cannot find one of the androidx classes, specifically: androidx.lifecycle.DefaultLifecycleObserver Here are my gradle deps: annotationProcessor "androidx.lifecycle:lifecycle-compiler:2.0.0" implementation…
lostintranslation
  • 23,756
  • 50
  • 159
  • 262
38
votes
7 answers

PreferenceFragmentCompat has padding on PreferenceCategory that I can't get rid of

So I've been trying to create a settings activity using androidx.preference.PreferenceFragmentCompat and it's all working fine. However for some reason there is some padding present on both the preference categories and the preferences themselves. I…
37
votes
7 answers

Cannot access 'androidx.lifecycle.HasDefaultViewModelProviderFactory' which is a supertype of 'FavoriteBottomDialogFragment'. Check your module cla

I am getting error in the whole class that extends BottomSheetDialogFragment Cannot access 'androidx.lifecycle.HasDefaultViewModelProviderFactory' which is a supertype of 'FavoriteBottomDialogFragment'. Check your module classpath for missing or…
37
votes
16 answers

Error when adding buildFeatures in build.gradle file

I am trying out compose which is a new feature in Andorid jetpack. Below is my code. I am adding buildfeatures in build.gradle file of app, not in the root folder. android { compileSdkVersion compileSDKVer buildToolsVersion buildToolsVer …
Sreedev
  • 6,563
  • 5
  • 43
  • 66
37
votes
3 answers

Android data binding "Missing import expression although it is registered" after upgrade to gradle 5.0

After I upgrade my Android studio to 3.4, Android Gradle Plugin to 3.4 and gradle to 5.1.1 I got the data binding errors like below I have made sure I cleaned project and rebuild, I have cleared cache and restarted AS. This issue never happened…
CodingTT
  • 1,125
  • 3
  • 14
  • 23
37
votes
5 answers

After migrating to AndroidX, Error inflating class android.support.design.widget.AppBarLayout

After using Android Studio to migrate my project to AndroidX (and manually fixing a lot of import errors), I'm getting no compile errors but when the app starts I get a crash with: Error inflating class android.support.design.widget.AppBarLayout.…
Robert Lewis
  • 1,847
  • 2
  • 18
  • 43
37
votes
13 answers

Android Work Manager: "Could not instantiate Worker"

I've followed the Android Developer's tutorial on using the Worker Manager structure to run my code in background but anytime I try to enqueue my worker it doesn't run and I get the following error: 2018-10-04 22:25:47.004…
Ícaro
  • 1,432
  • 3
  • 18
  • 36
36
votes
3 answers

AndroidX ActivityResultContracts package not found / class not found

According to this documentation from Google about launching an activity to get a result: While the underlying startActivityForResult() and onActivityResult() APIs are available on the Activity class on all API levels, it is strongly recommended…
Kenny Wyland
  • 20,844
  • 26
  • 117
  • 229
36
votes
5 answers

DrawerLayout getting stuck on swipe

I am playing around with DrawerLayout and I am encountering an issue. Basically sometimes when i swipe from the edge of the screen the DrawerLayout will get stuck until i lift my finger off the screen (See screenshot below) I am not sure what is up,…
thunderousNinja
  • 3,510
  • 9
  • 37
  • 49
35
votes
3 answers

FragmentManager and androidx FragmentManager

I'm trying to setup in my app that is using androidX. My problem is that when I try to work with PlaceAutocompleteFragment I get errors because it is a fragment from android.app.fragment and my parent fragment is an androidx fragment:…
Addev
  • 31,819
  • 51
  • 183
  • 302
34
votes
2 answers

Update to androidx.fragment:fragment:1.3.0-alpha08: registerForActivityResult not allowed after onCreate anymore. How to use after onCreate?

Initial Question (18/05/2020): So with the latest Update from androidx.fragment:fragment:1.3.0-alpha07 to androidx.fragment:fragment:1.3.0-alpha08 I get the error: FragmentXY is attempting to registerForActivityResult after being created.…
34
votes
6 answers

Program type already present: android.support.v4.os.ResultReceiver$MyResultReceiver

I'm refactoring an app to use androidx. I have struggled to get rid of all the libraries that do not support it. I thought I had removed all the libraries that use the support libraries but it looks like there is still something that is importing…
kingston
  • 11,053
  • 14
  • 62
  • 116
34
votes
3 answers

MutableLiveData is null in JUnitTest

I want to write a unit test. Therefore I need MutableLiveData. I started with a very basic test for setup but I cannot instantiate a MutableLiveData object. I is always null when I run the test. Do I have to mock anything? Any suggestions?…
Kewitschka
  • 1,445
  • 1
  • 21
  • 35
33
votes
8 answers

Unable to migrate Flutter project to AndroidX

I have a Flutter project in Android Studio. I am planning to migrate to AndroidX. Whenever I do Refactor -> Migrate to AndroidX, Android Studio shows error message: You need to have compileSdk set to at least 28 in your module build.gradle to…
Sam
  • 2,972
  • 6
  • 34
  • 62