gpt4 book ai didi

android - Gradle执行curl不上传文件

转载 作者:行者123 更新时间:2023-12-03 05:17:29 40 4
gpt4 key购买 nike

我有一个Gradle任务publish使用curl上传我的应用程序:

task publish(dependsOn: assembleRelease) << {
def apkName = group + "-" + revision + "-" + android.defaultConfig.versionName + "-release";
println "Publishing $project.buildDir/apk/" + apkName + ".apk to mobileappstore.com";
exec {
executable "/bin/sh"
args "-c", "curl -k -u 'CD:w2'" +
" -F upload=@$project.buildDir/apk/" + apkName +
".apk -F tags=" + apkName + " http://mobileappstore.com/AE/Build/Upload";
}
}

但是,有一个错误。输出为:
Publishing [...]/main/build/apk/null-1.0-release.apk to mobileappstore.com
% Total % Received % Xferd Average Speed Time Time Time Current
Dload Upload Total Spent Left Speed
0 0 0 0 0 0 0 0 --:--:-- --:--:-- --:--:-- 0
curl: (26) failed creating formpost data
:main:publish FAILED

FAILURE: Build failed with an exception.

* Where:
Build file '[...]/main/build.gradle' line: 103

* What went wrong:
Execution failed for task ':main:publish'.
> Process 'command '/bin/sh'' finished with non-zero exit value 26

我尝试的另一种方法:
task publish(dependsOn: assembleRelease) << {
def apkName = android.defaultConfig.versionName + "-release";
println "Publishing $project.buildDir/apk/" + apkName + ".apk to mobileappstore.com";
exec {
executable "/bin/sh"
args "-c", "curl -k -u ", "-F upload=@$project.buildDir/apk/Ae-0.0.1-test.apk", "-F tags=AutoBuild" "https://mobileappstore.com/AE/Build/Upload";
}
}

输出:
* What went wrong:
Execution failed for task ':main:publish'.
> No such property: https://mobileapptore.com/AE/Build/Upload for class: org.gradle.process.internal.DefaultExecAction_Decorated

最佳答案

URL前面的args行缺少逗号。另外,每个参数都需要单独传递(通常是在命令行上任何空格的位置)。另外,为什么不直接执行curl

关于android - Gradle执行curl不上传文件,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/23932953/

40 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com