【问题标题】:com.android.support:design:28.0.0 - Version 28 is the last version of the legacy support librarycom.android.support:design:28.0.0 - 版本 28 是旧支持库的最后一个版本
【发布时间】:2020-01-10 02:24:41
【问题描述】:

在我的 xml android 项目中,我尝试使用 com.google.android.material.textfield.TextInputEditText

像这样:

        <com.google.android.material.textfield.TextInputEditText
                android:id="@+id/editTextEmail"
                style="@style/textTextViewStyle"
                android:layout_width="0dp"
                android:layout_height="@dimen/min_height"
                android:layout_margin="@dimen/default_margin"
                android:hint="@string/email"
                android:inputType="textEmailAddress"
                android:padding="@dimen/half_default_margin"
                app:layout_constraintEnd_toEndOf="parent"
                app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@+id/textViewAppName" />

在 gradle.properties 中

android.useAndroidX=true
android.enableJetifier=true

在 app/build.gradle:

android {
    dataBinding {
        enabled = true
    }
    compileSdkVersion 29
    defaultConfig {
        applicationId "com.myapp"
        minSdkVersion 23
        targetSdkVersion 29
        versionCode 1
        versionName "1.0"
        testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
    }

dependencies {
    implementation fileTree(dir: 'libs', include: ['*.jar'])
    implementation 'androidx.appcompat:appcompat:1.0.2'
    implementation 'androidx.constraintlayout:constraintlayout:1.1.3'
    implementation 'com.android.support:design:28.0.0'
    testImplementation 'junit:junit:4.12'
    androidTestImplementation 'androidx.test:runner:1.2.0'
    androidTestImplementation 'androidx.test.espresso:espresso-core:3.2.0'
}

但我在这一行收到警告:

implementation 'com.android.support:design:28.0.0'

警告信息:

Version 28 is the last version of the legacy support library, so we recommend that you migrate to AndroidX libraries...

我该如何解决这个问题?

【问题讨论】:

    标签: android material-design androidx android-support-design material-components-android


    【解决方案1】:

    要使用像&lt;com.google.android.material.textfield.TextInputEditText 这样的组件,您必须添加Material Components library

    implementation 'com.google.android.material:material:1.1.0-alpha10'
    

    并移除设计支持库

    //implementation 'com.android.support:design:28.0.0'
    

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2013-10-29
      • 2014-06-15
      • 1970-01-01
      • 1970-01-01
      • 2021-11-06
      相关资源
      最近更新 更多