我已经阅读到默认情况下现在所有变体都将被发布,并且不再需要publishNonDefault。删除publishNonDefault后,它仍然无法正常工作。
我正在使用Gradle 4.1与插件3.0和Gradle 2.14.1与插件2.2.2。
apply plugin: 'com.android.library'
apply plugin: 'maven'
android {
compileSdkVersion 26
defaultConfig {
minSdkVersion 17
targetSdkVersion 26
versionCode 1
versionName "1.0"
vectorDrawables.useSupportLibrary = true
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
publishNonDefault true
flavorDimensions "app"
productFlavors{
apple{
}
orange{
}
}
}
dependencies {
implementation fileTree(dir: 'libs', include: ['*.jar'])
implementation 'com.android.support:appcompat-v7:26.0.2'
testImplementation 'junit:junit:4.12'
androidTestImplementation 'com.android.support.test:runner:1.0.1'
androidTestImplementation 'com.android.support.test.espresso:espresso-core:3.0.1'
}
uploadArchives {
repositories {
mavenDeployer {
repository(url: mavenLocal().url)
pom.version = "1.3.7"
pom.artifactId = "android"
pom.groupId = "com.example"
}
}
}