我使用的是Android Gradle插件0.13.2,Android Studio 0.8.11,Gradle 2.1和maven插件.
我想用一个命令(任务)将我的Android库的多个变体(flavor + build类型)安装到本地Maven存储库.
目前Android Gradle插件0.13.2允许我将publishNonDefault标志设置为发布所有变体,但正如文档所述,它将使用与Maven Repository不兼容的分类器发布变体.
我现在的解决方法是使用defaultPublishConfig"myVariant"并为我拥有的每个变体更改它.
apply plugin: 'com.android.library'
apply plugin: 'maven'
android {
defaultPublishConfig "myVariant"
.
.
.
}
task installArchives(type: Upload) {
repositories.mavenInstaller {
configuration = configurations.getByName(Dependency.DEFAULT_CONFIGURATION)
pom.groupId = "com.company"
pom.artifactId = "mylibrary"
pom.version = "1.0.0-myVariant"
}
}
Run Code Online (Sandbox Code Playgroud)
我想有一个任务可以正确地将所有变种发布到本地Maven存储库.
我正在使用Crashlytics Gradle插件最新版本(09/03/2015).用于定义测试版的组,发行说明或电子邮件的风味维度的额外属性将被忽略.
flavorDimensions "source", "type"
productFlavors {
network {
flavorDimension "source"
}
simulator {
versionName "-SIMULATOR"
flavorDimension "beaconSource"
buildConfigField "boolean", "IS_SIMULATOR_ENABLED", "true"
}
paid {
flavorDimension "type"
ext.betaDistributionReleaseNotes="My Paid Release Notes"
ext.betaDistributionGroupAliases="my_paid_group_alias"
}
free {
flavorDimension "type"
ext.betaDistributionReleaseNotes="My Free Release Notes"
ext.betaDistributionGroupAliases="my_free_group_alias"
}
}
Run Code Online (Sandbox Code Playgroud)
当我运行以下命令时:
./gradlew assembleNetworkPaidRelease crashlyticsUploadDistributionNetworkPaidRelease
Run Code Online (Sandbox Code Playgroud)
crashlytics插件会忽略额外的属性信息.
如果我将额外的属性移动到BuildType它工作:
release {
ext.betaDistributionReleaseNotes="My Universal Release Notes"
ext.betaDistributionGroupAliases="my_universal_group_alias"
}
Run Code Online (Sandbox Code Playgroud) 我有一个来自QuickLook框架的协议:
/*!
* @abstract The QLPreviewItem protocol declares the methods that a QLPreviewController instance uses to access the contents of a given item.
*/
@protocol QLPreviewItem <NSObject>
@required
/*!
* @abstract The URL of the item to preview.
* @discussion The URL must be a file URL.
*/
@property(readonly) NSURL * previewItemURL;
@optional
/*!
* @abstract The item's title this will be used as apparent item title.
* @discussion The title replaces the default item display name. This property is …Run Code Online (Sandbox Code Playgroud) 我想使用Square的Retrofit库创建一个包含我请求的某些部分的哈希.RequestInterceptor没有帮助我,因为它不提供有关请求的信息,它只是可以向它添加信息.我需要访问HTTP动词,所有标头和REST路径来创建哈希.哈希将添加到Authorization标头中.有任何想法吗?