我已经成功将我的子项目库包含到我的主项目中,但我似乎无法构建我的子项目库,所以我无法将它导入我的脚本中。
当我在构建所有内容后查看目录/build/exploded-bundles/
我发现MyAndroidProjectStickyScrollViewItemsUnspecified.aar以及ComActionBarSherlockAxtionBarSherlock440.aar,它们都具有相似的目录结构,都包含:
- 资产(目录),
- 水库(目录),
- AndroidManifest.xml ,
- classes.jar和
- R.txt
像这样
MyAndroidProject
|- .idea
|- MyAndroid
| |- build
| | |- exploded-bundles
| | | |- ComActionBarSherlockAxtionBarSherlock440.aar
| | | |- MyAndroidProjectStickyScrollViewItemsUnspecified.aar
| | | |- assets
| | | |- res
| | | |- AndroidManifest.xml
| | | |- classes.jar
| | | |- R.txt
| | |- res
| | |- sources
| |- src
| |- build.gradle
| |- MyAndroid.iml
|- gradle
|- project-lib
| |- StickyScrollViewItems
| |- build
| |- src
| | |- main
| | |- gen
| | | |- com.emilsjolander.components.stickyscrollviewitems
| | | |- BuildConfig.java
| | | |- Manifest.java
| | | |- R.java
| | |- java
| | | |- com.emilsjolander.components.stickyscrollviewitems
| | | |- StickyScrollView.java
| | |- res
| | |- AndroidManifest.xml
| |- build.gradle
| |- StickyScrollViewItems.iml
|- build.gradle
|- MyAndroidProject.iml
|- gradlew
|- gradle.bat
|- local.properties
|- settings.gradle
...
但是ComActionBarSherlockAxtionBarSherlock440.aar的 classes.jar 包含以下包:
- android.support.v4.app
- com.actionbar.sherlock
- 元信息
MyAndroidProjectStickyScrollViewItemsUnspecified.aar的classes.jar 为空
这里是根项目的settings.gradle
include ':MyAndroid', ':StickyScrollViewItems'
project(':StickyScrollViewItems').projectDir = "$rootDir/project-lib/StickyScrollViewItems" as File
这里是 MyAndroid 的 build.gradle
import groovy.transform.Field
buildscript {
repositories {
mavenCentral()
}
dependencies {
classpath 'com.android.tools.build:gradle:0.6.+'
}
}
apply plugin: 'android'
repositories {
mavenCentral()
}
android {
compileSdkVersion 18
buildToolsVersion "17.0.0"
defaultConfig {
minSdkVersion 16
targetSdkVersion 18
}
}
dependencies {
compile 'com.android.support:support-v4:18.0.+'
compile 'com.actionbarsherlock:actionbarsherlock:4.4.0@aar'
compile 'com.squareup.picasso:picasso:2.1.1'
compile 'com.github.snowdream.android:android-async-http:0.0.2'
compile 'de.greenrobot:greendao:1.3.2'
compile project(':StickyScrollViewItems')
}
这是 StickyScrollViewItems 的 build.gradle
import groovy.transform.Field
buildscript {
repositories {
mavenCentral()
}
dependencies {
classpath 'com.android.tools.build:gradle:0.6.+'
}
}
apply plugin: 'android-library'
repositories {
mavenCentral()
}
android {
compileSdkVersion 18
buildToolsVersion "17.0.0"
defaultConfig {
minSdkVersion 7
targetSdkVersion 18
}
}
dependencies {
compile 'com.android.support:support-v4:18.0.+'
}
我应该怎么做才能使用
import com.emilsjolander.components.stickyscrollviews.R;