I create a project on IntelliJ IDEA using Gradle and I'm trying to add AndroidSlidingUpPanel to it ( https://github.com/umano/AndroidSlidingUpPanel ).
What exactly do I have to do to configure it?
I have the following folder structure:
RootFolder |_libraries |_ AndroidSlidingUpPanel |_ library |_ build.gradle |_ settings.gradle |_ build.gradle |_app |_ build.gradle |_ settings.gradle |_ build.gradle
The files are like this:
RootFolder/settings.gradle
include ':app'
include ':libraries:AndroidSlidingUpPanel:library'
RootFolder/build.gradle
buildscript {
repositories {
mavenCentral()
}
dependencies {
classpath 'com.android.tools.build:gradle:0.8.+'
}
}
allprojects {
repositories {
mavenCentral()
}
}
RootFolder/libraries/AndroidSlidingUpPanel/settings.gradle
include ':library'
include ':demo'
RootFolder/libraries/AndroidSlidingUpPanel/build.gradle
allprojects {
group 'com.sothree.slidinguppanel'
version '1.0.0-SNAPSHOT'
buildscript {
repositories {
mavenCentral()
}
}
dependencies {
repositories {
mavenCentral()
}
}
}
RootFolder/libraries/AndroidSlidingUpPanel/library/build.gradle
apply plugin: 'android-library'
buildscript {
dependencies {
classpath 'com.android.tools.build:gradle:0.7.+'
}
}
dependencies {
compile 'com.android.support:support-v4:13.0.0'
}
android {
compileSdkVersion 19
buildToolsVersion "19.0.1"
sourceSets {
main {
manifest.srcFile 'AndroidManifest.xml'
java.srcDirs = ['src']
resources.srcDirs = ['src']
res.srcDirs = ['res']
assets.srcDirs = ['assets']
}
}
}
RootFolder/app/build.gradle
apply plugin: 'android'
android {
compileSdkVersion 19
buildToolsVersion "19.0.2"
defaultConfig {
minSdkVersion 10
targetSdkVersion 19
versionCode 1
versionName "1.0"
}
buildTypes {
release {
runProguard false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.txt'
}
}
}
dependencies {
compile 'com.android.support:gridlayout-v7:19.0.1'
compile 'com.android.support:support-v4:19.0.1'
compile 'com.android.support:appcompat-v7:19.0.1'
compile fileTree(dir: 'libs', include: ['*.jar'])
}
You aren't clear about what build errors you may be having or what your exact question is, though since you haven't got a dependency to SlidingUpPanel in your , the question is how to include it? 没有对SlidingUpPanel的依赖,所以问题是如何包含它?
If so, the first thing to bear in mind is that a project can't have more than one . 。 To be more precise, it only looks in the root folder for it and uses it if it's there. So the in will be ignored. 的将被忽略。 It looks like you've properly set up an include
to the SlidingUpPanel library in , so that's good: 的SlidingUpPanel库中正确设置了一个include
,所以很好:
include ':libraries:AndroidSlidingUpPanel:library'
to include a dependency on it in your app, you use a compile project
statement and give it the same path:
dependencies {
compile 'com.android.support:gridlayout-v7:19.0.1'
compile 'com.android.support:support-v4:19.0.1'
compile 'com.android.support:appcompat-v7:19.0.1'
compile project(':libraries:AndroidSlidingUpPanel:library')
compile fileTree(dir: 'libs', include: ['*.jar'])
}
If you're using Android Studio (it should also work with Gradle-based projects in IntelliJ Community Edition), you can set up dependencies on modules from the Project Structure dialog via > > > > : > >“ > >“ 从“项目结构”对话框中设置对 :
If you've added the module to your file as you already have and have synced up your project to the Gradle files, then the SlidingUpPanel module should appear in the Project view in the IDE and should appear as a module choice in that dependency list. 文件中,并且已经将项目同步到Gradle文件,那么SlidingUpPanel模块应该出现在IDE的“项目”视图中,并且应该作为模块选择出现在其中。依赖项列表。
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.