What is AndroidX?

后端 未结 10 1064
死守一世寂寞
死守一世寂寞 2020-11-22 03:38

I am reading about a room library of Android. I see they changed package android to androidx. I did not understand that. Can someone explain, pleas

10条回答
  •  太阳男子
    2020-11-22 04:26

    AndroidX is the open-source project that the Android team uses to develop, test, package, version and release libraries within Jetpack.

    After hours of struggling, I solved it by including the following within app/build.gradle:

    android {
        compileOptions {
            sourceCompatibility JavaVersion.VERSION_1_8
            targetCompatibility JavaVersion.VERSION_1_8
        }
    }
    

    Put these flags in your gradle.properties

    android.enableJetifier=true
    android.useAndroidX=true
    
    Changes in gradle:
    
    implementation 'androidx.appcompat:appcompat:1.0.2'
    implementation 'androidx.constraintlayout:constraintlayout:1.1.3'
    implementation 'androidx.legacy:legacy-support-v4:1.0.0'
    implementation 'com.google.android.material:material:1.1.0-alpha04'
    

    When migrating on Android studio, the app/gradle file is automatically updated with the correction library impleemntations from the standard library

    Refer to: https://developer.android.com/jetpack/androidx/migrate

提交回复
热议问题