我已經成功將我的子項目lib包含到我的主項目中,但似乎無法構建我的子項目庫,因此無法將其導入到我的腳本中。Android Studio使用gradle構建classes.jar爲空
當我看着目錄/編譯/爆炸-包/後建立的一切
我發現MyAndroidProjectStickyScrollViewItemsUnspecified.aar,沿側ComActionBarSherlockAxtionBarSherlock440.aar,這兩者有相似的目錄結構,既包含:
- 資產(DIR),
- RES(DIR),
- 的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
- META-INF
MyAndroidProjectStickyScrollViewItemsUnspecified.aar的classes.jar是空的
這裏的根項目
include ':MyAndroid', ':StickyScrollViewItems'
project(':StickyScrollViewItems').projectDir = "$rootDir/project-lib/StickyScrollViewItems" as File
這裏的MyAndroid
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:[email protected]'
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')
}
中的build.gradle的settings.gradle,這裏是構建。StickyScrollViewItems的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;
謝謝,是的,它可能是最近添加的,但現在我可以使用build.gradle包含它,感謝@plastiv,upvoted並標記爲正確,再次感謝 – DeckyFx