【问题标题】:How to implement design library to android app?如何将设计库实现到 android 应用程序?
【发布时间】:2020-07-02 00:41:16
【问题描述】:

我不会在我的项目中实现这个设计库 > https://developer.android.com/topic/libraries/support-library/packages.html#design (com.android.support:design:28.0.0)。但是当我同步时出现错误:无法为 org.gradle.api.internal.artifacts.dsl.dependencies.DefaultDependencyHandler 类型的对象获取未知属性“com”。请帮忙。谢谢:)


android {
  compileSdkVersion 29
  buildToolsVersion "29.0.3"
  defaultConfig {
      applicationId "com.example.pyramid"
      minSdkVersion 15
      targetSdkVersion 29
      versionCode 1
      versionName "1.0"
      testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
  }
  buildTypes {
      release {
          minifyEnabled false
          proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
      }
  }
}

dependencies {
  implementation fileTree(dir: 'libs', include: ['*.jar'])
  implementation 'androidx.appcompat:appcompat:1.1.0'
  implementation 'androidx.constraintlayout:constraintlayout:1.1.3'
  testImplementation 'junit:junit:4.12'
  androidTestImplementation 'androidx.test.ext:junit:1.1.1'
  androidTestImplementation 'androidx.test.espresso:espresso-core:3.2.0'
  implementation 'com.google.android.material:material:1.1.0'
  implementation 'com.android.support.design:28.0.0'

【问题讨论】:

  • 你把引号弄错了,应该是implementation 'com.android.support.design:28.0.0'。此外,与问题无关,但设计库在 androidx 中由 com.google.android.material:material 库成功实现,因此您可能想改用它。
  • 仍然。错误:无法解决:com.android.support.design:28.0.0:受影响的模块:app
  • 更新您问题中的脚本。
  • 如果您希望使用 google 材料组件,请完全删除 design 库。一个是另一个的替代品。
  • 我一定有design 库,因为我不会制作BottomNavigationBar

标签: java android android-design-library


【解决方案1】:

好的,我认为它已解决。我刚刚将带有Bottom Navigation Activity 的第二个项目中的所有库复制到我的第一个项目中。 com.google.android.material.bottomnavigation.BottomNavigationView 就是这样:)

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 2012-02-02
    • 1970-01-01
    • 2021-01-20
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多