I don’t know if you’ve noticed this:
When you recently created the project, you had the option User Androidx.* Artifacts. In case you don’t know what AndroidX means, androidX replaces the previous set of support libraries. If you choose AndroidX, you will be using androidX as the support library for your new project instead of the support library we used before.
If this is not checked then we are still using the same type of support library as before android.support. Such as the implementation ‘com. Android. Support: appcompat – v7:28.0.0’ implementation ‘com. Android. Support. The constraint, the constraint – layout: 1.1.3’ and so on.
If you build your new project using API 28, compileSdkVersion 28 in build.gradle, you’ll notice that when you look at the code in the support library, you won’t be able to read it
I can’t read the source code, only.class. This is because:
The Support Library 28.0.0 source code is no longer available on Android 28.0.0, even though we compiled the project using Android 28 with Support Library 28.0.0. When you view a class in the Support Library, you will not be able to view the source code. Instead, you will see only xxx.class. This is because after the release of Android9.0 (API level 28), a new version of the support library, AndroidX, was born. It belongs to JetPack and includes the latest JetPack components in addition to the original support library content.
We can still use the support library while using API 28, but all new library development is done in androidx, so we can’t see the source code (the source code was available in previous versions), Google recommends that all new projects use the androidx library.
So the solution
Embrace the androidx library, which is also recommended by Google
Another way to do this is to use versions below 28:
compileSdkVersion 26
dependencies {
implementation fileTree(dir: 'libs', include: ['*.jar'])
implementation 'com. Android. Support: appcompat - v7:26.1.0'
implementation 'com. Android. Support. The constraint, the constraint - layout: 1.1.3'
testImplementation 'junit: junit: 4.12'
androidTestImplementation 'com. Android. Support. Test: runner: 1.0.2'
androidTestImplementation 'com. Android. Support. Test. Espresso: espresso - core: 3.0.2'
}
Copy the code
This way, you can still view the source code of the classes in Support.