Android studio - 如何使用gradle中的可执行jar文件 [英] Android studio - How to use an executable jar file from gradle
问题描述
PS。我已阅读了很多gradle文档,所以请不要阅读文档回复。
编辑: p是我目前的任务,它编译,但林不知道它实际上做任何事情
任务(runApkSigTool,dependsOn: 'android',输入:JavaExec){
classpath files('apksigtool.jar')
main'com.widevine.tools.android.apksigtool.ApkSigTool'
args [ 0] = apkLocation
args [1] ='private_key.der'
args [2] ='my.crt'
}
我不确定是否必须像我的build.gradle文件的android部分中的方法那样使用它。
您可以使用 JavaExec 任务。像这样:
任务signApk(类型:JavaExec){
classpath文件('path / to / executable。 jar')
main'com.foo.MainClass'
args ['-foo','bar']
}
So I have a custom_rules.xml file Im trying to rebuild in gradle. so far I have no problem figuring everything else out but the last part Im trying to accomplish is running a special apk signing tool for widevine drm on the unsigned apk that I generate with my gradle build process. Ive been looking online and in the gradle documentation all day but I have yet to find how to run an executable jar file from gradle. I know I have to create a task but thats about it. Any help would be much appreciated.
PS. Ive read a lot of the gradle documentation so please spare me any read the docs responses
EDIT:
this is what my task looks like at the moment and it compiles but Im not sure its actually doing anything
task (runApkSigTool , dependsOn: 'android', type: JavaExec) {
classpath files('apksigtool.jar')
main 'com.widevine.tools.android.apksigtool.ApkSigTool'
args[0] = apkLocation
args[1] = 'private_key.der'
args[2] = 'my.crt'
}
Im not sure if I have to use it like a method in the android section of my build.gradle file or what.
You could probably use the JavaExec task. Something like this:
task signApk(type: JavaExec) {
classpath files('path/to/executable.jar')
main 'com.foo.MainClass'
args ['-foo', 'bar']
}
这篇关于Android studio - 如何使用gradle中的可执行jar文件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!