且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

如何在Android Studio中使用Android滑动面板制作示例演示项目

更新时间:2023-01-23 13:14:53

将此库添加到Android Studio项目中要容易得多.首先,撤消您之前的所有步骤-完全不需要.

It's much easier to add this library to your Android Studio project. First of all undo all of your previous steps - they're simply not needed.

打开app文件夹的build.gradle文件,并将以下行添加到依赖项:

Open the build.gradle file of your appfolder and add the following lines to the dependencies:

dependencies {
    repositories {
        mavenCentral()
    }
    compile 'com.sothree.slidinguppanel:library:+'
}

完成! Android Studio可能会抱怨存储库中的内容不属于那里,因此只需将其移动到项目本身的build.gradle文件中,而不是应用模块中即可.

Done! Android Studio may complain that the repositories stuff doesn't belong there so just move it to the build.gradle file of the project itself instead of the app module.

这是您的build.gradle文件的最终外观:

Here's how your build.gradle files should look like in the end:

正如注释中提到的Scott Barta,如果您的存储库列表中已经有jcenter(),则不需要mavenCentral(). jcenter()似乎是mavenCentral()的超集-在此处了解更多: SO:Android buildscript储存库. jcenter VS mavencentral

As Scott Barta mentioned in the comments, mavenCentral() isn't needed if there's already jcenter() in your repository list. jcenter() seems like a superset of mavenCentral() - Read more here: SO: Android buildscript repositories. jcenter VS mavencentral