问题
I am following the tutorial (9.2), it asks to add a 'settings activity', when i try to select it, it is greyed out and says that it 'requires androidx support'. I can find no reference to androidx support in the tutorial and have tried googling the problem to no avail. I have even loaded the completed project from the master files to compare their code with mine, i can find no reference to androidx. I am using android studio 3.4.1
回答1:
As it says, it requires androidx support. You need to enable AndroidX in your project. Add these two lines to your gradle.properties
file:
android.useAndroidX=true
android.enableJetifier=true
Setting these two gradle plugin flags to true means that Android Plugin will use appropriate AndroidX library instead of support Library & will rewrite their binaries. Also note that, since you need to use AndroidX in this project, you need to set the compile SDK to Android 9.0 (API level 28) or higher.
For knowing more how to migrate an entire project to AndroidX, please follow this link
来源:https://stackoverflow.com/questions/56550431/unable-to-select-settings-activity-in-android-studio