Gre*_*nis 7 ftp android gradle
我正在尝试在Gradle构建后FTP签名的APK.我已经添加了将对APK进行签名的新构建配置,但我仍然试图弄清楚如何调用FTP任务.
我在第59.6节找到了一个正式的样本,但它抱怨它无法解析依赖org.apache.ant:ant-commons-net:1.8.4.所以显然我在这里遗漏了一些明显的东西,比如在哪里放一个给定的jar文件或引用它,虽然我认为maven会处理这类事情?
作为参考,这里是链接的示例,它失败并显示有关依赖项的消息:
configurations {
ftpAntTask
}
dependencies {
ftpAntTask("org.apache.ant:ant-commons-net:1.8.4") {
module("commons-net:commons-net:1.4.1") {
dependencies "oro:oro:2.0.8:jar"
}
}
}
task ftp << {
ant {
taskdef(name: 'ftp',
classname: 'org.apache.tools.ant.taskdefs.optional.net.FTP',
classpath: configurations.ftpAntTask.asPath)
ftp(server: "ftp.apache.org", userid: "anonymous", password: "me@myorg.com") {
fileset(dir: "htdocs/manual")
}
}
}
Run Code Online (Sandbox Code Playgroud)
这失败并显示以下消息:
> Could not find org.apache.ant:ant-commons-net:1.8.4.
Run Code Online (Sandbox Code Playgroud)
这是我完整的gradle.build文件,删除了一些敏感信息:
buildscript {
repositories {
mavenCentral()
}
dependencies {
classpath 'com.android.tools.build:gradle:0.4'
}
}
apply plugin: 'android'
dependencies {
compile files('libs/android-support-v4.jar')
}
android {
compileSdkVersion 17
buildToolsVersion "17.0.0"
defaultConfig {
minSdkVersion 14
targetSdkVersion 17
}
signingConfigs {
signed {
storeFile file("(removed)")
storePassword "(removed)"
keyAlias "(removed)"
keyPassword "(removed)"
}
}
buildTypes {
signed {
debuggable false
jniDebugBuild false
signingConfig signingConfigs.signed
}
}
}
configurations {
ftpAntTask
}
dependencies {
ftpAntTask("org.apache.ant:ant-commons-net:1.8.4") {
module("commons-net:commons-net:1.4.1") {
dependencies "oro:oro:2.0.8:jar"
}
}
}
task ftp << {
ant {
taskdef(name: 'ftp',
classname: 'org.apache.tools.ant.taskdefs.optional.net.FTP',
classpath: configurations.ftpAntTask.asPath)
ftp(server: "(removed)", userid: "(removed)", password: "(removed)", remoteDir: "(removed)") {
fileset(dir: "(removed)") {
include(name: "(removed)")
}
}
}
}
Run Code Online (Sandbox Code Playgroud)
您尚未声明可用于解析已声明工件的存储库。尝试将以下代码片段添加到您的 build.gradle 文件中:
\n\nrepositories{\n mavenCentral()\n}\nRun Code Online (Sandbox Code Playgroud)\n\n干杯,
\n\n任\xc3\xa9
\n| 归档时间: |
|
| 查看次数: |
5100 次 |
| 最近记录: |