Good day!

I am interested in such a question, there is a compiled Android project (.apk), the task is - since the release of apk is done for different servers, you need to change some settings in the XML file Settings.xml but without physically recompiling the project through Eclipse.

A partial solution is the following: a script is written that decompilit .apk using apktool changes the values ​​in Settings.XML and then compile everything again via apktool.

However, as practice has shown, this apk assembled in this way is not installed on a real android device. a simple message is issued - "Application not installed"

Googling the internet found the following - http://developer.android.com/tools/publishing/app-signing.html#cert

The .apk file collected via apktool needs to be signed, however, when trying to generate this same signature through the command

ant release

I get an error - build.xml not found

Brief clarification Reconfiguration and reassembly will be performed on another computer where eclipse is not installed. You need to do something like reassembler. Naturally, some things, such as android-sdk, will still have to be put on that computer :)

Thanks in advance for your help!

  • I think it's easier to configure ant / gradle to create the desired number of binaries. Easier and more reliable. - KoVadim
  • Could you tell us in more detail what you mean? - BlackWidow
  • for gradle (this is the build system in android studio) there are flavors . This is exactly what you need. Just describe the differences and gradle will collect everything himself. If you use eclipse without gradle, then antenna is a preprocessor for java. But working with him is a special charm :) - KoVadim
  • As far as I know, Android Studio is a google development studio for Android. That is to say the Eclipse analogy. However, I will clarify once again - on the computer where the software will be configured - there are no Android developers at all, i.e. My task is to write a configurator, which will drag sdk and something else behind it - to reassemble the project with one button - BlackWidow
  • You will need to configure gradle once for your project (for this, the studio is just needed, you can use pens, but at first it will be a little more difficult. On other computers you will need to install jdk and android sdk (it’s better to make an archive yourself with the right packages) And that's it. And those who need to build a project will simply run gradle from the command line with parameters that will indicate what needs to be assembled and in what quantity. Since the gradle is based on groovy, the possibilities for building are very wide in fact limited to fantasy only - KoVadim

1 answer 1

In general, a solution has been found. It all just turned out to be

I'll go from the beginning and try to save time to other developers. The logic is:

  1. there is an apk file
  2. there is a web part
  3. List item
  4. set the settings
  5. clicked configure
  6. script hidden batch file launched apktool
  7. the project was decompiled
  8. changed the values ​​needed and in the right places
  9. batch file started apk tool - again hidden
  10. squeezed and got the finished project
  11. Signed apk ready key.

Everything, on this your apk is ready to work.

To decompile the project you need to use

/Users/test/apktool/apktool d /Users/test/apktool/testproject.apk 

To compile

 /Users/test/apktool/apktool b /Users/test/apktool/testproject 

To sign the apk file (after building apktool), you need to use the standard key generation utility.

command line

 keytool -genkey -keystore mykeys.keystore -storepass spassword -alias mykey1 -keypass kpassword1 -dname “CN=Test Test O=StartAndroid C=RU” -validity 10000 

Well, I personally prefer to use the visual interface, because you need to create only one key, and then use it as you like. By the way, the key does not necessarily have to have the .keystore extension, it can have the extension .jks

Signature apk is also very simple

command line

 jarsigner -keystore /Volumes/workDisk/WorkProject/KeysForDroid/TestProject/testproject.jks -storepass qwe123 -keypass qwe123 /Volumes/workDisk/WorkProject/KeysForDroid/TestProject/testproject.apk testproject 

Naturally, Eclipse, that Android Studio have visual tools for signing apk with a key, but specifically in my case the goal was to do it from the console.

Specifically, the whole mechanism is reviewed here.

http://startandroid.ru/ru/uroki/vse-uroki-spiskom/221-urok-123-kak-podpisat-prilozhenie-utility-keytool-i-jarsigner.html