Bulk packaging under Mac

Source: Internet
Author: User

Two different ways:

The first type: there is source code

This method is relatively simple. Take advantage of ant packaging.
The direct shell script modifies the file that configures the channel number.
We are currently using the Umeng. In the Androidmanifest.xml.
Provides a simple script to modify the channel number.

The second type: no source

Because we use love encryption, so we can only use this way.
Now that we have fewer channels, we are adopting the apktool approach.
First step: Anti-compilation

Java-jar Apktool.jar D com.hiwifi.hiwifi_20140801181424.apk

Step two: Modify the channel number

Sed-i. Bak ' 145s/.*/<meta-data android:name= "Umeng_channel" android:value= "' ${channel} '" \/>/'  

Step Three: Recompile

Java-jar Apktool.jar b com.hiwifi.hiwifi_20140801181424 com.hiwifi.hiwifi_lenovo.apk

I encountered the following error while recompiling:

I:checking whether sources has changed ... I:checking whether resources has changed ... I:building Resources ... Exception in thread "main" brut.androlib.AndrolibException:brut.androlib.AndrolibException: Brut.common.BrutException:could not EXEC command: [AAPT, P,--min-sdk-version, one,--target-sdk-version, A, F,/var/fol Ders/7r/ghlhnsm56fn9d3zwwmznrh9w0000gn/t/apktool4414016803544356394.tmp, 0, ARSC,-I,/users/shunpingliu/library/ apktool/framework/1.apk,-S,/users/shunpingliu/greensoftware/apktool/com.hiwifi.hiwifi_20140801181424/res,-M,/ Users/shunpingliu/greensoftware/apktool/com.hiwifi.hiwifi_20140801181424/androidmanifest.xml]at Brut.androlib.Androlib.buildResourcesFull (androlib.java:358) at Brut.androlib.Androlib.buildResources ( androlib.java:283) at Brut.androlib.Androlib.build (androlib.java:206) at Brut.androlib.Androlib.build ( androlib.java:176) at Brut.apktool.Main.cmdBuild (main.java:228) at Brut.apktool.Main.main (main.java:79) caused by: Brut.androlib.androlibexception:brut.cOmmon. Brutexception:could not EXEC command: [AAPT, P,--min-sdk-version, one,--target-sdk-version, A, F,/var/folders/7r/ghlh Nsm56fn9d3zwwmznrh9w0000gn/t/apktool4414016803544356394.tmp, 0, ARSC,-I,/users/shunpingliu/library/apktool/ framework/1.apk,-S,/users/shunpingliu/greensoftware/apktool/com.hiwifi.hiwifi_20140801181424/res,-M,/Users/ Shunpingliu/greensoftware/apktool/com.hiwifi.hiwifi_20140801181424/androidmanifest.xml]at Brut.androlib.res.AndrolibResources.aaptPackage (androlibresources.java:357) at Brut.androlib.Androlib.buildResourcesFull (androlib.java:336) ...  5 morecaused by:brut.common.BrutException:could not EXEC command: [AAPT, P,--min-sdk-version, one,--target-sdk-version, +-F,/var/folders/7r/ghlhnsm56fn9d3zwwmznrh9w0000gn/t/apktool4414016803544356394.tmp,-0, ARSC,-I,/Users/ shunpingliu/library/apktool/framework/1.apk,-S,/users/shunpingliu/greensoftware/apktool/com.hiwifi.hiwifi_ 20140801181424/res,-M,/users/shunpingliu/greensoftware/apktool/com.hiwifi.hiWifi_20140801181424/androidmanifest.xml]at brut.util.OS.exec (os.java:93) at Brut.androlib.res.AndrolibResources.aaptPackage (androlibresources.java:355) ... 6 morecaused By:java.io.IOException:Cannot Run Program "AAPT": error=2, No such file or Directoryat Java.lang.ProcessBui Lder.processexception (processbuilder.java:478) at Java.lang.ProcessBuilder.start (processbuilder.java:457) at Java.lang.Runtime.exec (runtime.java:593) at Java.lang.Runtime.exec (runtime.java:466) at Brut.util.OS.exec (Os.java : 84) ... 7 morecaused by:java.io.ioexception:error=2, No such file or Directoryat java.lang.UNIXProcess.forkAndExec (Native metho d) at java.lang.unixprocess.<init> (unixprocess.java:53) at Java.lang.ProcessImpl.start (processimpl.java:91) At Java.lang.ProcessBuilder.start (processbuilder.java:452) ... Ten more

Workaround:
Add the AAPT to the environment variable, this command is in the SDK.
The code on my machine is as follows: Vim ~/.bash_profile adds the following: (related to the respective file location)

Export path= "/users/shunpingliu/greensoftware/adt-bundle-mac-x86_64-20140321    /sdk/build-tools/android-4.4.2 : $PATH "

Then make the configuration effective
source. bash_profile
The full version of the script reference attachment.

Reference:

    • ? US Android Automation Tour-Generate channel package
Attachment
    • Buildbyijiami.sh? (524 bytes)-Added by Shunping.liu 8 month ago.
    • Apklist.sh? (696 bytes)-Added by binyu.xia 6 month ago. Hiwifi Bulk Package shell scripts
    • Channel.data? (124 bytes)-Added by binyu.xia 6 month ago. List of packaged channels
    • Hi.keystore? (1.2 KB)-Added by binyu.xia 6 month ago. Hiwifi signature file

Bulk packaging under Mac

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.