0
我使用Travis和Fastlane構建應用並將其發佈到Google Play商店,但在同時處理多種風味時,Supply無法找到APK上傳它們。構建多種風味並從Fastlane部署到Google Play時未導出Apk路徑
這是我中fastfile:
fastlane_version "2.59.0"
default_platform :android
platform :android do
before_all do
gradle(task: "clean")
end
desc "Submit Whitelabels to Play Store"
lane :whitelabels_playstore do
gradle(
task: 'releaseWhitelabel'
)
lane_context[SharedValues::GRADLE_ALL_APK_OUTPUT_PATHS].each do | apk |
puts "Uploading APK to Play Store: " + apk
begin
supply(
skip_upload_images: true,
skip_upload_screenshots: true,
validate_only: true,
apk: apk
)
rescue => ex
puts ex
end
end
end
end
任務releaseWhitelabel代碼:
def releaseTask = tasks.create(name: 'releaseWhitelabel') {
group 'Whitelabel'
description "Assembles and release all Whitelabels"
}
android.applicationVariants.all { variant ->
if (variant.buildType.name == 'release') {
variant.productFlavors.each { flavor ->
def flavorName = flavor.name.capitalize()
def releaseFlavorTaskName = "releaseWhitelabel${flavorName}"
def releaseFlavorTask
flavorsMap.each { name, jsonItem ->
if (flavorName.toUpperCase().startsWith(name.toUpperCase())) {
releaseFlavorTask = tasks.create(name: releaseFlavorTaskName) {
group 'Whitelabel'
description "Assembles and release build for flavor $flavorName"
}
releaseFlavorTask.dependsOn variant.assemble
releaseTask.dependsOn releaseFlavorTask
}
}
}
}
}
本地運行時任務完美的作品,當我執行的車道,我得到一個錯誤,說lane_context[SharedValues::GRADLE_ALL_APK_OUTPUT_PATHS]
不能是不行的。
當我運行下面的gradle配置時,我工作正常,但只有一種口味可以通過這種方式發佈,我的口味是動態生成的。
gradle(
task: 'assemble',
flavor: 'Dell',
build_type: 'Release'
)
我該如何才能將lane_context[SharedValues::GRADLE_ALL_APK_OUTPUT_PATHS]
正確地更新爲每個apk的路徑?