【问题标题】:Getting error while adding these dependencies in app/build.gradle file in android在 android 的 app/build.gradle 文件中添加这些依赖项时出错
【发布时间】:2021-08-06 12:43:06
【问题描述】:

我想在 android 中使用 TabLayout 和 ViewPager。 为此,我将 implementation 'com.google.android.material:material:1.5.0-alpha01' 添加到 app/gradle.build 文件的依赖项部分。

This is the state of my dependency section before adding 'com.google.android.material:material:1.5.0-alpha01'

This is the state of my dependency section after adding 'com.google.android.material:material:1.5.0-alpha01'

添加com.google.android.material:material:1.5.0-alpha01 依赖后,com.android.support:appcompat-v7:23.3.0 报错。

我不知道为什么会这样......

【问题讨论】:

    标签: android dependencies material-design


    【解决方案1】:
    com.android.support:appcompat-v7:23.3.0
    

    使用 Andrioidx 库更新。

    将您的项目与 android 迁移到 androidx,然后您就可以添加材料依赖项。

    implementation 'androidx.appcompat:appcompat:1.3.1'
    implementation 'com.google.android.material:material:1.4.0'
    

    【讨论】:

    • 是的。谢谢。有用。我们只需要进入 Android Studio 的 Refactor Tab 并点击 Migrate to AndroidX。
    【解决方案2】:

    清理项目并添加这些库,然后同步项目

     implementation 'androidx.appcompat:appcompat:1.3.1'
     implementation 'com.google.android.material:material:1.4.0'
    

    【讨论】:

      猜你喜欢
      • 2021-01-07
      • 1970-01-01
      • 2018-01-16
      • 2022-01-19
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多