问题描述
我采用了Android工作室,如你所知,在导入当前使用的库 IDE
如的Eclipse
是不容易与Android工作室。我试图导入 slidingmenu
lib放到我的项目,但我不知道该怎么把它做好。因为他们在这个环节说,我已经试过 如何在导入slidingmenu IntelliJ IDEA的? 但是,我又失败了。所以,我希望有人能回答我,告诉我它是如何工作的。
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'
在机器人工作室preSS的工具 - > Android的 - >同步工程与摇篮文件
按钮,然后重新生成项目。如果一切顺利,你应该能够在 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的导入slidingmenu?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!