简体   繁体   English

导入新的 Android 设计支持库

[英]Import new Android Design Support library

嗨,我正在尝试导入新的 android 支持库,如com.android.support:support-design:22.0.0但在同步 gradle 后出现此错误: failed to find

You have to update your Android Support Repository in SDK Manager, then just add this dependency to your build.gradle :您必须在 SDK Manager 中更新您的 Android Support Repository,然后将此依赖项添加到您的build.gradle

compile 'com.android.support:design:22.2.0'

com.android.support:support-design:22.0.0 is wrong. com.android.support:support-design:22.0.0是错误的。

dependencies {
    implementation 'com.android.support:design:28.0.0'
}

New Android Design Libraries usually start with androidx word, such as:新的 Android Design Libraries 通常以 androidx 字开头,例如:

AppCompat androidx: AppCompat androidx:

implementation 'androidx.appcompat:appcompat:1.2.0'

CardViex androidx: CardViex androidx:

implementation 'androidx.cardview:cardview:1.0.0'

However be careful because everything is not start with androidx .但是要小心,因为一切都不是从androidx开始的。 For example, old design dependency is:例如,旧的设计依赖是:

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

But new design dependency is:但是新的设计依赖是:

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

Recyclerview dependency is: Recyclerview 依赖项是:

implementation 'androidx.recyclerview:recyclerview:1.2.0'

So, you have to search and read carefully.因此,您必须仔细搜索和阅读。

The docs has it wrong. 文档有误。

It should actually be 'com.android.support:design:22.2.0'它实际上应该是'com.android.support:design:22.2.0'

as mentioned in their official blog .正如他们的官方博客中提到的。

With gradle 3 it should be:对于 gradle 3,它应该是:

dependencies {
    implementation 'com.android.support:design:27.0.2'
}

You can use:您可以使用:

compile 'com.android.support:design:22.2.0'

I built a complete example.我构建了一个完整的示例。 I hope it helps!我希望它有帮助! https://github.com/erikcaffrey/AndroidDesignSupportLibrary https://github.com/erikcaffrey/AndroidDesignSupportLibrary

Remember now is available!记住现在可用!

Android Support Library, revision 22.2.1 (July 2015) Android 支持库,修订版 22.2.1(2015 年 7 月)

ctrl+alt+shift+s in the androidstudio window... project structure window will appear..在androidstudio窗口中ctrl+alt+shift+s ...会出现项目结构窗口..
click the app in the menu bar at the left then click dependencies .. then add `com.android.support:design:26.1.0单击左侧菜单栏中的应用程序,然后单击依赖项.. 然后添加 `com.android.support:design:26.1.0

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

单击“文件”-->“项目结构”(或 CTRL+ALT+SHIFT+S)--> 选择“依赖项”--> 单击“所有依赖项”部分中的“+”--> 选择“1” .Library Dependency'--> 在这里您可以搜索要在您的 android studio 项目中实现的任何库。

i was facing the same problem actually this is old one.我面临着同样的问题,实际上这是旧问题。 Just replace it with the following code:只需将其替换为以下代码:

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

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM