如何在 Android Studio 上导入滑动菜单? [英] How to import slidingmenu on Android Studio?

查看:58
本文介绍了如何在 Android Studio 上导入滑动菜单?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我使用的是 Android Studio,如您所知,使用 Android Studio 导入当前 IDE 中使用的库(如 Eclipse)并不容易.我正在尝试将 slidingmenu 库导入到我的项目中,但我不知道如何做好.我已经尝试过他们在这个链接中所说的如何导入滑动菜单Intellij 创意?但是我又失败了.所以我希望有人能回答我并向我展示它是如何工作的.

I'm using Android Studio, and as you know, importing libraries used in current IDE like Eclipse is not easy with Android Studio. I'm trying to import the slidingmenu lib into my project but I don't know how to do it well. I've tried as they said in this link How to import slidingmenu on Intellij Idea? But I failed again. So I hope someone can answer me and show me how it works.

推荐答案

只是让每个人都知道我所指的文件结构(有效):

Just so everyone knows the file structure that I am referring to (which does work):

在您的 APP build.gradle 文件中,确保您有:

In your APP's build.gradle file make sure you have:

dependencies {
    // Your other dependencies go here
    compile project(':libraries:SlidingMenu')
}

在您的滑动菜单 build.gradle 文件中,确保它包含以下内容:

In your SLIDING MENU's build.gradle file make sure it has the following:

buildscript {
    repositories {
        mavenCentral()
    }
    dependencies {
        classpath 'com.android.tools.build:gradle:0.7.+'
    }
}

apply plugin: 'android-library'

repositories {
    mavenCentral()
}

dependencies {
    compile 'com.android.support:support-v4:19.0.0'
}

android {
    compileSdkVersion 19
    buildToolsVersion "19.0.1"

    defaultConfig {
        minSdkVersion 7
        targetSdkVersion 16
    }

    sourceSets {
        main {
            java.srcDirs = ['src/main/java']
            res.srcDirs = ['src/main/res']

            manifest.srcFile 'src/main/AndroidManifest.xml'
        }
    }
}

您的项目 settings.gradle 文件应如下所示:

Your PROJECT'S settings.gradle file should look like this:

include ":libraries:SlidingMenu", ':App'

在android studio中按Tools ->安卓->Sync Project with Gradle Files 按钮,然后重建你的项目.如果一切顺利,您应该能够将 com.jeremyfeinstein.slidingmenu.lib.SlidingMenu 库导入您应用的源文件中.

In android studio press the Tools -> Android -> Sync Project with Gradle Files button, then rebuild your project. If all went well you should be able to import the com.jeremyfeinstein.slidingmenu.lib.SlidingMenu library into your app's source files.

这篇关于如何在 Android Studio 上导入滑动菜单?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆