4

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?

Ciro Santilli OurBigBook.com
  • 347,512
  • 102
  • 1,199
  • 985
pgsandstrom
  • 14,361
  • 13
  • 70
  • 104

2 Answers2

11

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

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

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.

zed_0xff
  • 32,417
  • 7
  • 53
  • 72
  • 1
    Thansk! But I just spent half a day trying to do this and failed. Guides I have found have presumed that I have a build.xml in my project directory, which I have not. I have tried to take a build.xml from a sdk sample, but have failed to convert it to work on my project :'( Any ideas? – pgsandstrom Jun 07 '10 at 13:40
  • run "android update project --path /path/to/your/project --target 3" – zed_0xff Jun 07 '10 at 13:59
  • you can list targets with "android list target" cmd – zed_0xff Jun 07 '10 at 14:00
  • i finally got it... some enviromental variable pointed towards an old SDK and screwed with "list target". :P thanks for the help – pgsandstrom Jun 07 '10 at 15:21
  • sry just realized that it did not work... ant compiles the java-files. I will have to have a look at the ant script tomorrow :( – pgsandstrom Jun 07 '10 at 16:06
  • solved it... removed the – pgsandstrom Jun 08 '10 at 07:17
-1

Here's an example:

android create project \
--target 1 \
--name MyAndroidApp \
--path ./MyAndroidAppProject \
--activity MyAndroidAppActivity \
--package com.example.myandroid
Xorsat
  • 2,388
  • 21
  • 21