我一直在努力将我的 custom_rules.xml 重建为 gradle 中的东西,但事实证明这非常困难。所以我的下一步是尝试将我在 gradle 中不能做的最后几件事导入为 build.xml。
然而,这似乎没有任何作用。当我尝试使用 ant.importBuild 'build.xml' 我的脚本没有反馈或回声。我通读了很多 gradles 文档,尤其是关于 ant 的文档,在我的一生中,我无法弄清楚导入构建后我应该做什么。脚本如何执行?
这是我的build.xml
<?xml version="1.0" encoding="UTF-8"?>
<project>
<target name="postPackage" >
<property name="config_path" location="${cert.dir}" />
<property name="out.pre.widevine.signed.file" location="release-pre-widevine-sign.apk" />
<property name="out.widevine.signed.file" location="release-widevine-signed.apk" />
<echo>sign with widevine certificate</echo>
<touch file="res/raw/wv.properties"/>
<copy file="${out.packaged.file}" tofile="${out.pre.widevine.signed.file}"/>
<java jar="apksigtool.jar" failonerror="true" fork="true">
<arg value="${out.packaged.file}"/>
<arg value="private_key.der" />
<arg value="my.crt" />
</java>
<copy file="${out.packaged.file}" tofile="${out.widevine.signed.file}"/>
</target>
</project>
最佳答案
我能够通过在方法中使用以下代码 fragment 来完成此操作
ant.importBuild 'build.xml'
postPackage.doFirst{println("Im starting")}
postPackage.execute()
关于android - gradle如何执行一个ant构建文件,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/26043478/