不使用eclipse将android项目编译为apk

不使用eclipse将android项目编译为apk

本文介绍了不使用eclipse将android项目编译为apk的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我所做的是从我的 eclipse 项目中获取类文件并通过优化器/混淆器运行它们.所以我现在已经优化了我想要以 apk 的形式获取的类文件,以便我可以签名和发布它.但是,我不知道如何做到这一点.我想我不能将它们复制到我的 eclipse 项目的 bin 文件夹中,因为当我尝试导出已签名的 apk 时,eclipse 只会用新的编译覆盖它们.那么如何从这些类文件创建一个 apk?

What I have done is I have taken the class-files from my eclipse project and run them trough an optimizer/obfuscator. So I now have optimized class-files that I want to get in the form of an apk so I can sign and publish it. However, I am lost on how to do this. I guess I cant just copy them into the bin-folder of my eclipse-project, because eclipse would just overwrite them with a new compilation when I try to export a signed apk. So how do I create an apk from these class-files?

推荐答案

你可以尝试把它们放在 bin/classes 中,然后使用ant"命令来构建你的应用程序

you can try to put them in bin/classes and then use "ant" command to build your application

cd /path/to/my/app
ant release

它每次都会要求您提供私钥来签署应用程序,可以通过编辑build.properties"文件将其配置为自动签名:

it will ask you every time for your private key to sign the app, it can be configured to auto-sign by editing "build.properties" file:

key.store=release.keystore
key.alias=release
key.store.password=my_key_password
key.alias.password=my_key_password

您还可以调查 Android SDK,找到它实际使用的 ANT 构建脚本,并在构建过程中插入您的自定义混淆器/优化器调用.

you can also investigate Android SDK, find the ANT build scripts it actually uses, and insert your custom obfuscator/optimizer call in middle of build process.

这篇关于不使用eclipse将android项目编译为apk的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

07-30 06:02