我正在将 aar 文件发布到 Maven。我已经成功上传了所有内容,但是当我将库的依赖项添加到示例项目时,它没有来自我的项目的源文件。
这是我的图书馆的 build.gradle
apply plugin: 'com.android.library'
android {
compileSdkVersion 21
buildToolsVersion "21.1.2"
defaultConfig {
minSdkVersion 14
targetSdkVersion 21
versionCode 1
versionName "1.0"
}
buildTypes {
release {
minifyEnabled true
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
}
dependencies {
compile fileTree(dir: 'libs', include: ['*.jar'])
compile 'com.android.support:appcompat-v7:21.0.3'
// Volley
compile 'com.mcxiaoke.volley:library:1.0.14'
// Gson
compile 'com.google.code.gson:gson:2.3.1'
}
这是我的项目的 build.gradle
// Top-level build file where you can add configuration options common to all sub-projects/modules.
apply plugin: 'com.android.library'
buildscript {
repositories {
mavenCentral()
jcenter()
}
dependencies {
classpath 'com.android.tools.build:gradle:1.1.2'
// NOTE: Do not place your application dependencies here; they belong
// in the individual module build.gradle files
}
}
allprojects {
repositories {
mavenCentral()
jcenter()
}
}
android {
compileSdkVersion 21
buildToolsVersion "21.1.2"
sourceSets {
main {
manifest.srcFile 'app/src/main/AndroidManifest.xml'
java.srcDirs = ['app/src/main/java/com/ebrick/TestSpot']
}
}
}
dependencies {
compile fileTree(dir: 'libs', include: ['*.jar'])
compile 'com.android.support:appcompat-v7:21.0.3'
// Volley
compile 'com.mcxiaoke.volley:library:1.0.14'
// Gson
compile 'com.google.code.gson:gson:2.3.1'
}
apply from: 'maven_push.gradle'
如果我从项目 build.gradle 中删除 sourceSet,它会给我错误 AndroidManifest.xml 未找到。