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
58
votes
19 answers

How to set title in app bar with Navigation Architecture Component

I was trying out Navigation architecture component and is now having difficulties in setting the title. How do I set the title programmatically and also how it works? To clear my question, let's have an example, where, I've set up a simple app with…
54
votes
6 answers

How to access RecyclerView in androidx?

Hi I'm new to Android development and I'm trying out a tutorial on MVVM I found on YouTube. The example project in the video uses AppCompat but I converted mine to androidx because from what I read its the current(?) version to use? Am I mistaken…
kobowo
  • 2,529
  • 2
  • 24
  • 37
51
votes
14 answers

Error inflating class androidx.constraintlayout.widget.ConstraintLayout

After migrating to Androidx packages using Android Studio menu option Refactor -> Refactor to Androidx... I'm getting the following error: Error inflating class androidx.constraintlayout.widget.ConstraintLayout
Arturo Mejia
  • 1,862
  • 1
  • 17
  • 25
50
votes
7 answers

launchFragmentInContainer unable to resolve Activity in Android

While writing a simple test which uses launchFragmentInContainer, I get the following error message: java.lang.RuntimeException: Unable to resolve activity for: Intent { act=android.intent.action.MAIN cat=[android.intent.category.LAUNCHER]…
Bugdr0id
  • 2,962
  • 6
  • 35
  • 59
50
votes
1 answer

How to set `null` as the default value for a nullable argument using SafeArgs?

How should I pass in null as default value for a String argument such as this: If the argument is nullable there should be a…
Kayvan N
  • 8,108
  • 6
  • 29
  • 38
49
votes
11 answers

Issues were found when checking AAR metadata: androidx.core:core:1.12.0-alpha01 and androidx.core:core-ktx:1.12.0-alpha01

I am working on a project and today the build is not working anymore. The error is the following: 2 issues were found when checking AAR metadata: Dependency 'androidx.core:core:1.12.0-alpha01' requires libraries and applications that depend on it…
Valentin Cerneanu
  • 895
  • 2
  • 8
  • 11
48
votes
5 answers

AndroidX Security EncryptedSharedPreferences v1.1.0 /w API 21 issue

I decided to use new EncryptedSharedPreferences from AndroidX Security library. Since the app is supporting API 21 and higher, I decided to try out this new v1.1.0-alpha02 version, since it supports API 21+ So, I succeded to make the implementation…
aherman
  • 900
  • 1
  • 8
  • 16
48
votes
9 answers

addFontWeightStyle NoSuchMethodException on TextView

I am using Androidx library for my project, And I want to set a font to textview, so when I am applying any font to any Textview components than system gives me TypefaceCompatApi21Impl: java.lang.NoSuchMethodException …
Ankit Dubariya
  • 905
  • 2
  • 9
  • 22
47
votes
10 answers

How to get an Instance of ViewModel in activity in 2020/21?

I am new to the mvvm pattern. I created a ViewModel for the main activity. Now I want to get an instance of the ViewModel in the main activity. Most Tutorials and answers here on Stackoverflow suggest using ViewModelProviders.of(..., but this is…
Gerke
  • 926
  • 1
  • 10
  • 20
47
votes
2 answers

What is the use of androidx.legacy:legacy-support-v4: dependency

I was implementing Android Room Database and in one of the tutorial I found the usage of androidx.legacy:legacy-support-v4:1.0.0 dependency. Can any one tell me use of this dependency.
Rahul Khatri
  • 1,502
  • 2
  • 13
  • 25
46
votes
8 answers

java.lang.IllegalStateException: SimpleTypeImpl should not be created for error type

Have been facing this error after migrating to AndroidX. java.lang.IllegalStateException: SimpleTypeImpl should not be created for error type: ErrorScope{Error scope for class with arguments:…
Shahzeb
  • 3,696
  • 4
  • 28
  • 47
46
votes
9 answers

Failed to transform file 'some-lib-release.aar' to match attributes {artifactType=processed-aar} using transform JetifyTransform

I have a project with 2 modules: an app (Java) with build types debug, release, and enterprise and a Kotlin library (release and debug) used by the app. I'm using AndroidX and have the following in my…
copolii
  • 14,208
  • 10
  • 51
  • 80
44
votes
7 answers

in androidx.fragment.app.Fragment,setUserVisibleHint()is Deprecated,and not executed,why?

@Override public void setUserVisibleHint(boolean isVisibleToUser) { super.setUserVisibleHint(isVisibleToUser); if (getUserVisibleHint()) { isVisible = true; onVisible(); } else { isVisible = false; …
limengxin
  • 574
  • 1
  • 4
  • 7
41
votes
7 answers

Failed to resolve variable '${project.groupId}'

I migrate my project to AndroidX and I got these errors when building the project: [TAG] Failed to resolve variable '${project.groupId}' [TAG] Failed to resolve variable '${project.version}' [TAG] Failed to resolve variable…
MHogge
  • 5,408
  • 15
  • 61
  • 104
41
votes
4 answers

Difference between androidx and com.android.support

I was about to use a constraint-layout in my project when I noticed that there are two different dependencies that I can use: com.android.support.constraint:constraint-layout androidx.constraintlayout:constraintlayout Is there a difference between…
NewestStackOverflowUser
  • 2,792
  • 5
  • 22
  • 31