歡迎來到Linux教程網
Linux教程網
Linux教程網
Linux教程網
Linux教程網 >> Linux綜合 >> 學習Linux >> centos7上安裝aapt

centos7上安裝aapt

日期:2017/3/6 9:11:19   编辑:學習Linux

centos7上安裝aapt


centos7上安裝aapt


參考資料

http://blog.csdn.net/u013107656/article/details/51517820

思路

從apktool.jar中解壓縮出來一個aapt。

為此,先下載一個apktool.jar,到centos上測試該jar是否可用。然後解壓縮,找到aapt。

安裝apktool

主要步驟:

  • 下載apktool.jar (比如apktool_2.2.0.jar)
  • (Optional)mv apktool_2.2.0.jar apktool.jar
  • (Optional)執行命令java -jar apktool.jar,確保傳入了正確的jar文件
  • (Optional)進一步,嘗試命令:java -jar apktool.jar d TempApk.apk

安裝aapt

主要步驟:

  • 解壓縮jar:unzip apktool.jar -d apktool
  • aapt文件:prebuilt\aapt\linux\aapt
  • 把aapt設置為可執行文件:chmod +x aapt
  • 在執行aapt的時候,會有一些錯誤,安裝對應的文件即可,主要包括:
  • yum install glibc.i686
  • yum install zlib.i686 –setopt=protected_multilib=false
  • yum update libstdc++-4.8.2-16.2.el7_0.x86_64
  • yum install libstdc++-4.8.5-4.el7.i686
  • cp aapt /usr/bin/

其中對於libstdc++,先更新機器上已經有的64位版本,但安裝32位版本。——不能直接用上面的setopt一套方法。

附 安裝日志

apktool

[root@computer_name software]# pwd/home/software[root@computer_name software]# mkdir apktool[root@computer_name software]# cp apktool_2.2.0.jar ./apktool[root@computer_name software]# cd apktool/[root@computer_name apktool]# lltotal 6344-rw-r--r-- 1 root root 6493636 Aug  8 09:39 apktool_2.2.0.jar[root@computer_name apktool]# mv apktool_2.2.0.jar apktool.jar[root@computer_name apktool]# java -jar apktool.jarApktool v2.2.0 - a tool for reengineering Android apk fileswith smali v2.1.3 and baksmali v2.1.3Copyright 2014 Ryszard Wi舏ewski <[email protected]>Updated by Connor Tumbleson <[email protected]>usage: apktool -advance,--advanced   prints advance information. -version,--version    prints the version then exitsusage: apktool if|install-framework [options] <framework.apk> -p,--frame-path <dir>   Stores framework files into <dir>. -t,--tag <tag>          Tag frameworks using <tag>.usage: apktool d[ecode] [options] <file_apk> -f,--force              Force delete destination directory. -o,--output <dir>       The name of folder that gets written. Default is apk.out -p,--frame-path <dir>   Uses framework files located in <dir>. -r,--no-res             Do not decode resources. -s,--no-src             Do not decode sources. -t,--frame-tag <tag>    Uses framework files tagged by <tag>.usage: apktool b[uild] [options] <app_path> -f,--force-all          Skip changes detection and build all files. -o,--output <dir>       The name of apk that gets written. Default is dist/name.apk -p,--frame-path <dir>   Uses framework files located in <dir>.For additional info, see: http://ibotpeaches.github.io/Apktool/ For smali/baksmali info, see: https://github.com/JesusFreke/smali[root@computer_name apktool]# java -jar apktool.jar d ../ftp/TempApk.apk I: Using Apktool 2.2.0 on TempApk.apkI: Loading resource table...I: Decoding AndroidManifest.xml with resources...I: Loading resource table from file: /root/.local/share/apktool/framework/1.apkI: Regular manifest package...I: Decoding file-resources...I: Decoding values */* XMLs...I: Baksmaling classes.dex...I: Copying assets and libs...I: Copying unknown files...I: Copying original files...[root@computer_name apktool]# lltotal 6348-rw-r--r-- 1 root root 6493636 Aug  8 09:39 apktool.jardrwxr-xr-x 5 root root    4096 Aug  8 09:43 TempApk[root@computer_name apktool]# cd TempApk/[root@computer_name TempApk]# lltotal 20-rw-r--r--  1 root root  728 Aug  8 09:43 AndroidManifest.xml-rw-r--r--  1 root root  392 Aug  8 09:43 apktool.ymldrwxr-xr-x  3 root root 4096 Aug  8 09:43 originaldrwxr-xr-x 12 root root 4096 Aug  8 09:43 resdrwxr-xr-x  4 root root 4096 Aug  8 09:43 smali[root@computer_name TempApk]# 

aapt

解壓縮&找到aapt文件

[root@computer_name apktool]# aapt-bash: aapt: command not found[root@computer_name apktool]# lltotal 6348-rw-r--r-- 1 root root 6493636 Aug  8 09:39 apktool.jardrwxr-xr-x 5 root root    4096 Aug  8 09:43 TempApk[root@computer_name apktool]# unzip apktool.jar -d apktoolArchive:  apktool.jar  inflating: apktool/META-INF/MANIFEST.MF    ...  inflating: apktool/javax/annotation/concurrent/ThreadSafe.java  [root@computer_name apktool]# cd apktool/[root@computer_name apktool]# lltotal 48drwxr-xr-x 4 root root 4096 Aug  8 09:48 android-rw-r--r-- 1 root root   25 Aug  7 11:04 baksmali.propertiesdrwxr-xr-x 7 root root 4096 Aug  8 09:48 brutdrwxr-xr-x 3 root root 4096 Aug  8 09:48 comdrwxr-xr-x 3 root root 4096 Aug  8 09:48 javax-rw-r--r-- 1 root root 1509 Aug  7 11:04 LICENSE.txtdrwxr-xr-x 4 root root 4096 Aug  8 09:48 META-INFdrwxr-xr-x 8 root root 4096 Aug  8 09:48 orgdrwxr-xr-x 3 root root 4096 Aug  8 09:48 prebuiltdrwxr-xr-x 2 root root 4096 Aug  8 09:48 properties-rw-r--r-- 1 root root   25 Aug  7 11:04 smali.propertiesdrwxr-xr-x 2 root root 4096 Aug  8 09:48 templates-rw-r--r-- 1 root root    0 Aug  7 11:04 XPP3_1.1.4c_VERSION[root@computer_name apktool]# cd prebuilt/[root@computer_name prebuilt]# lltotal 4drwxr-xr-x 5 root root 4096 Aug  8 09:48 aapt[root@computer_name prebuilt]# cd aapt[root@computer_name aapt]# lltotal 12drwxr-xr-x 2 root root 4096 Aug  8 09:48 linuxdrwxr-xr-x 2 root root 4096 Aug  8 09:48 macosxdrwxr-xr-x 2 root root 4096 Aug  8 09:48 windows[root@computer_name aapt]# cd linux/[root@computer_name linux]# lltotal 1924-rw-r--r-- 1 root root 1967712 Aug  7 11:04 aapt[root@computer_name linux]#

設置為可執行

[root@computer_name linux]# chmod +x aapt [root@computer_name linux]# lltotal 1924-rwxr-xr-x 1 root root 1967712 Aug  7 11:04 aapt[root@computer_name linux]# ./aapt -bash: ./aapt: /lib/ld-linux.so.2: bad ELF interpreter: No such file or directory[root@computer_name linux]# 

安裝glibc

[root@computer_name linux]# yum install glibc.i686Loaded plugins: langpacksbase                                                                                                                                                                    | 3.6 kB  00:00:00     epel                                                                                                                                                                    | 4.3 kB  00:00:00     extras                                                                                                                                                                  | 3.4 kB  00:00:00     updates                                                                                                                                                                 | 3.4 kB  00:00:00     (1/4): extras/7/x86_64/primary_db                                                                                                                                       | 160 kB  00:00:00     (2/4): epel/x86_64/updateinfo                                                                                                                                           | 590 kB  00:00:00     (3/4): epel/x86_64/primary_db                                                                                                                                           | 4.3 MB  00:00:00     (4/4): updates/7/x86_64/primary_db                                                                                                                                      | 6.4 MB  00:00:00     Resolving Dependencies--> Running transaction check---> Package glibc.i686 0:2.17-106.el7_2.8 will be installed--> Processing Dependency: glibc-common = 2.17-106.el7_2.8 for package: glibc-2.17-106.el7_2.8.i686--> Processing Dependency: libfreebl3.so(NSSRAWHASH_3.12.3) for package: glibc-2.17-106.el7_2.8.i686--> Processing Dependency: libfreebl3.so for package: glibc-2.17-106.el7_2.8.i686--> Running transaction check---> Package glibc-common.x86_64 0:2.17-55.el7_0.5 will be updated--> Processing Dependency: glibc-common = 2.17-55.el7_0.5 for package: glibc-2.17-55.el7_0.5.x86_64---> Package glibc-common.x86_64 0:2.17-106.el7_2.8 will be an update---> Package nss-softokn-freebl.x86_64 0:3.16.2-2.el7_0 will be updated---> Package nss-softokn-freebl.i686 0:3.16.2.3-14.2.el7_2 will be installed---> Package nss-softokn-freebl.x86_64 0:3.16.2.3-14.2.el7_2 will be an update--> Running transaction check---> Package glibc.x86_64 0:2.17-55.el7_0.5 will be updated--> Processing Dependency: glibc = 2.17-55.el7_0.5 for package: nscd-2.17-55.el7_0.5.x86_64--> Processing Dependency: glibc = 2.17-55.el7_0.5 for package: glibc-devel-2.17-55.el7_0.5.x86_64--> Processing Dependency: glibc = 2.17-55.el7_0.5 for package: glibc-headers-2.17-55.el7_0.5.x86_64---> Package glibc.x86_64 0:2.17-106.el7_2.8 will be an update--> Running transaction check---> Package glibc-devel.x86_64 0:2.17-55.el7_0.5 will be updated---> Package glibc-devel.x86_64 0:2.17-106.el7_2.8 will be an update---> Package glibc-headers.x86_64 0:2.17-55.el7_0.5 will be updated---> Package glibc-headers.x86_64 0:2.17-106.el7_2.8 will be an update---> Package nscd.x86_64 0:2.17-55.el7_0.5 will be updated---> Package nscd.x86_64 0:2.17-106.el7_2.8 will be an update--> Finished Dependency ResolutionDependencies Resolved=============================================================================================================================================================================================== Package                                            Arch                                   Version                                               Repository                               Size===============================================================================================================================================================================================Installing: glibc                                              i686                                   2.17-106.el7_2.8                                      updates                                 4.2 MInstalling for dependencies: nss-softokn-freebl                                 i686                                   3.16.2.3-14.2.el7_2                                   updates                                 187 kUpdating for dependencies: glibc                                              x86_64                                 2.17-106.el7_2.8                                      updates                                 3.6 M glibc-common                                       x86_64                                 2.17-106.el7_2.8                                      updates                                  11 M glibc-devel                                        x86_64                                 2.17-106.el7_2.8                                      updates                                 1.0 M glibc-headers                                      x86_64                                 2.17-106.el7_2.8                                      updates                                 663 k nscd                                               x86_64                                 2.17-106.el7_2.8                                      updates                                 261 k nss-softokn-freebl                                 x86_64                                 3.16.2.3-14.2.el7_2                                   updates                                 204 kTransaction Summary===============================================================================================================================================================================================Install  1 Package  (+1 Dependent package)Upgrade             ( 6 Dependent packages)Total download size: 22 MIs this ok [y/d/N]: yDownloading packages:Delta RPMs disabled because /usr/bin/applydeltarpm not installed.(1/8): glibc-2.17-106.el7_2.8.x86_64.rpm                                                                                                                                | 3.6 MB  00:00:00     (2/8): glibc-2.17-106.el7_2.8.i686.rpm                                                                                                                                  | 4.2 MB  00:00:00     (3/8): glibc-devel-2.17-106.el7_2.8.x86_64.rpm                                                                                                                          | 1.0 MB  00:00:00     (4/8): glibc-headers-2.17-106.el7_2.8.x86_64.rpm                                                                                                                        | 663 kB  00:00:00     (5/8): nscd-2.17-106.el7_2.8.x86_64.rpm                                                                                                                                 | 261 kB  00:00:00     (6/8): nss-softokn-freebl-3.16.2.3-14.2.el7_2.i686.rpm                                                                                                                  | 187 kB  00:00:00     (7/8): nss-softokn-freebl-3.16.2.3-14.2.el7_2.x86_64.rpm                                                                                                                | 204 kB  00:00:00     (8/8): glibc-common-2.17-106.el7_2.8.x86_64.rpm                                                                                                                         |  11 MB  00:00:06     -----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------Total                                                                                                                                                          2.9 MB/s |  22 MB  00:00:07     Running transaction checkRunning transaction testTransaction test succeededRunning transaction  Updating   : glibc-common-2.17-106.el7_2.8.x86_64                                                                                                                                       1/14   Updating   : glibc-2.17-106.el7_2.8.x86_64                                                                                                                                              2/14   Updating   : nss-softokn-freebl-3.16.2.3-14.2.el7_2.x86_64                                                                                                                              3/14   Updating   : glibc-headers-2.17-106.el7_2.8.x86_64                                                                                                                                      4/14   Updating   : glibc-devel-2.17-106.el7_2.8.x86_64                                                                                                                                        5/14   Updating   : nscd-2.17-106.el7_2.8.x86_64                                                                                                                                               6/14   Installing : nss-softokn-freebl-3.16.2.3-14.2.el7_2.i686                                                                                                                                7/14   Installing : glibc-2.17-106.el7_2.8.i686                                                                                                                                                8/14   Cleanup    : glibc-devel-2.17-55.el7_0.5.x86_64                                                                                                                                         9/14   Cleanup    : glibc-headers-2.17-55.el7_0.5.x86_64                                                                                                                                      10/14   Cleanup    : nscd-2.17-55.el7_0.5.x86_64                                                                                                                                               11/14   Cleanup    : glibc-common-2.17-55.el7_0.5.x86_64                                                                                                                                       12/14   Cleanup    : nss-softokn-freebl-3.16.2-2.el7_0.x86_64                                                                                                                                  13/14   Cleanup    : glibc-2.17-55.el7_0.5.x86_64                                                                                                                                              14/14   Verifying  : glibc-2.17-106.el7_2.8.i686                                                                                                                                                1/14   Verifying  : glibc-devel-2.17-106.el7_2.8.x86_64                                                                                                                                        2/14   Verifying  : nss-softokn-freebl-3.16.2.3-14.2.el7_2.x86_64                                                                                                                              3/14   Verifying  : glibc-headers-2.17-106.el7_2.8.x86_64                                                                                                                                      4/14   Verifying  : glibc-common-2.17-106.el7_2.8.x86_64                                                                                                                                       5/14   Verifying  : nss-softokn-freebl-3.16.2.3-14.2.el7_2.i686                                                                                                                                6/14   Verifying  : glibc-2.17-106.el7_2.8.x86_64                                                                                                                                              7/14   Verifying  : nscd-2.17-106.el7_2.8.x86_64                                                                                                                                               8/14   Verifying  : glibc-2.17-55.el7_0.5.x86_64                                                                                                                                               9/14   Verifying  : glibc-devel-2.17-55.el7_0.5.x86_64                                                                                                                                        10/14   Verifying  : nscd-2.17-55.el7_0.5.x86_64                                                                                                                                               11/14   Verifying  : glibc-headers-2.17-55.el7_0.5.x86_64                                                                                                                                      12/14   Verifying  : glibc-common-2.17-55.el7_0.5.x86_64                                                                                                                                       13/14   Verifying  : nss-softokn-freebl-3.16.2-2.el7_0.x86_64                                                                                                                                  14/14 Installed:  glibc.i686 0:2.17-106.el7_2.8                                                                                                                                                                Dependency Installed:  nss-softokn-freebl.i686 0:3.16.2.3-14.2.el7_2                                                                                                                                                Dependency Updated:  glibc.x86_64 0:2.17-106.el7_2.8         glibc-common.x86_64 0:2.17-106.el7_2.8                  glibc-devel.x86_64 0:2.17-106.el7_2.8         glibc-headers.x86_64 0:2.17-106.el7_2.8          nscd.x86_64 0:2.17-106.el7_2.8          nss-softokn-freebl.x86_64 0:3.16.2.3-14.2.el7_2        Complete![root@computer_name linux]# ./aapt ./aapt: error while loading shared libraries: libz.so.1: cannot open shared object file: No such file or directory[root@computer_name linux]# 

安裝zlib

[root@computer_name linux]# yum install zlib.i686Loaded plugins: langpacksResolving Dependencies--> Running transaction check---> Package zlib.i686 0:1.2.7-15.el7 will be installed--> Finished Dependency ResolutionError:  Multilib version problems found. This often means that the root       cause is something else and multilib version checking is just       pointing out that there is a problem. Eg.:         1. You have an upgrade for zlib which is missing some            dependency that another package requires. Yum is trying to            solve this by installing an older version of zlib of the            different architecture. If you exclude the bad architecture            yum will tell you what the root cause is (which package            requires what). You can try redoing the upgrade with            --exclude zlib.otherarch ... this should give you an error            message showing the root cause of the problem.         2. You have multiple architectures of zlib installed, but            yum can only see an upgrade for one of those architectures.            If you don't want/need both architectures anymore then you            can remove the one with the missing update and everything            will work.         3. You have duplicate versions of zlib installed already.            You can use "yum check" to get yum show these errors.       ...you can also use --setopt=protected_multilib=false to remove       this checking, however this is almost never the correct thing to       do as something else is very likely to go wrong (often causing       much more problems).       Protected multilib versions: zlib-1.2.7-15.el7.i686 != zlib-1.2.7-13.el7.x86_64[root@computer_name linux]# yum install zlib.i686 --setopt=protected_multilib=falseLoaded plugins: langpacksResolving Dependencies--> Running transaction check---> Package zlib.i686 0:1.2.7-15.el7 will be installed--> Finished Dependency ResolutionDependencies Resolved=============================================================================================================================================================================================== Package                                     Arch                                        Version                                             Repository                                   Size===============================================================================================================================================================================================Installing: zlib                                        i686                                        1.2.7-15.el7                                        base                                         90 kTransaction Summary===============================================================================================================================================================================================Install  1 PackageTotal download size: 90 kInstalled size: 180 kIs this ok [y/d/N]: yDownloading packages:zlib-1.2.7-15.el7.i686.rpm                                                                                                                                              |  90 kB  00:00:01     Running transaction checkRunning transaction testTransaction test succeededRunning transaction  Installing : zlib-1.2.7-15.el7.i686                                                                                                                                                      1/1   Verifying  : zlib-1.2.7-15.el7.i686                                                                                                                                                      1/1 Installed:  zlib.i686 0:1.2.7-15.el7                                                                                                                                                                     Complete![root@computer_name linux]# ./aapt ./aapt: error while loading shared libraries: libgcc_s.so.1: cannot open shared object file: No such file or directory[root@computer_name linux]# 

安裝libstdc++

[root@computer_name linux]# yum install libstdc++.i686Loaded plugins: langpacksResolving Dependencies--> Running transaction check---> Package libstdc++.i686 0:4.8.5-4.el7 will be installed--> Processing Dependency: libgcc_s.so.1(GLIBC_2.0) for package: libstdc++-4.8.5-4.el7.i686--> Processing Dependency: libgcc_s.so.1(GCC_4.2.0) for package: libstdc++-4.8.5-4.el7.i686--> Processing Dependency: libgcc_s.so.1(GCC_3.3) for package: libstdc++-4.8.5-4.el7.i686--> Processing Dependency: libgcc_s.so.1(GCC_3.0) for package: libstdc++-4.8.5-4.el7.i686--> Processing Dependency: libgcc_s.so.1 for package: libstdc++-4.8.5-4.el7.i686--> Running transaction check---> Package libgcc.x86_64 0:4.8.2-16.2.el7_0 will be updated---> Package libgcc.i686 0:4.8.5-4.el7 will be installed---> Package libgcc.x86_64 0:4.8.5-4.el7 will be an update--> Finished Dependency ResolutionError:  Multilib version problems found. This often means that the root       cause is something else and multilib version checking is just       pointing out that there is a problem. Eg.:         1. You have an upgrade for libstdc++ which is missing some            dependency that another package requires. Yum is trying to            solve this by installing an older version of libstdc++ of the            different architecture. If you exclude the bad architecture            yum will tell you what the root cause is (which package            requires what). You can try redoing the upgrade with            --exclude libstdc++.otherarch ... this should give you an error            message showing the root cause of the problem.         2. You have multiple architectures of libstdc++ installed, but            yum can only see an upgrade for one of those architectures.            If you don't want/need both architectures anymore then you            can remove the one with the missing update and everything            will work.         3. You have duplicate versions of libstdc++ installed already.            You can use "yum check" to get yum show these errors.       ...you can also use --setopt=protected_multilib=false to remove       this checking, however this is almost never the correct thing to       do as something else is very likely to go wrong (often causing       much more problems).       Protected multilib versions: libstdc++-4.8.5-4.el7.i686 != libstdc++-4.8.2-16.2.el7_0.x86_64[root@computer_name linux]# yum install libstdc++.i686 --setopt=protected_multilib=falseLoaded plugins: langpacksResolving Dependencies--> Running transaction check---> Package libstdc++.i686 0:4.8.5-4.el7 will be installed--> Processing Dependency: libgcc_s.so.1(GLIBC_2.0) for package: libstdc++-4.8.5-4.el7.i686--> Processing Dependency: libgcc_s.so.1(GCC_4.2.0) for package: libstdc++-4.8.5-4.el7.i686--> Processing Dependency: libgcc_s.so.1(GCC_3.3) for package: libstdc++-4.8.5-4.el7.i686--> Processing Dependency: libgcc_s.so.1(GCC_3.0) for package: libstdc++-4.8.5-4.el7.i686--> Processing Dependency: libgcc_s.so.1 for package: libstdc++-4.8.5-4.el7.i686--> Running transaction check---> Package libgcc.x86_64 0:4.8.2-16.2.el7_0 will be updated---> Package libgcc.i686 0:4.8.5-4.el7 will be installed---> Package libgcc.x86_64 0:4.8.5-4.el7 will be an update--> Finished Dependency ResolutionDependencies Resolved=============================================================================================================================================================================================== Package                                        Arch                                        Version                                            Repository                                 Size===============================================================================================================================================================================================Installing: libstdc++                                      i686                                        4.8.5-4.el7                                        base                                      311 kInstalling for dependencies: libgcc                                         i686                                        4.8.5-4.el7                                        base                                      103 kUpdating for dependencies: libgcc                                         x86_64                                      4.8.5-4.el7                                        base                                       95 kTransaction Summary===============================================================================================================================================================================================Install  1 Package  (+1 Dependent package)Upgrade             ( 1 Dependent package)Total download size: 508 kIs this ok [y/d/N]: yDownloading packages:Delta RPMs disabled because /usr/bin/applydeltarpm not installed.(1/3): libgcc-4.8.5-4.el7.x86_64.rpm                                                                                                                                    |  95 kB  00:00:00     (2/3): libgcc-4.8.5-4.el7.i686.rpm                                                                                                                                      | 103 kB  00:00:01     (3/3): libstdc++-4.8.5-4.el7.i686.rpm                                                                                                                                   | 311 kB  00:00:01     -----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------Total                                                                                                                                                          227 kB/s | 508 kB  00:00:02     Running transaction checkRunning transaction testTransaction check error:  file /usr/share/gcc-4.8.2/python/libstdcxx/v6/printers.py from install of libstdc++-4.8.5-4.el7.i686 conflicts with file from package libstdc++-4.8.2-16.2.el7_0.x86_64  file /usr/share/gcc-4.8.2/python/libstdcxx/v6/printers.pyc from install of libstdc++-4.8.5-4.el7.i686 conflicts with file from package libstdc++-4.8.2-16.2.el7_0.x86_64  file /usr/share/gcc-4.8.2/python/libstdcxx/v6/printers.pyo from install of libstdc++-4.8.5-4.el7.i686 conflicts with file from package libstdc++-4.8.2-16.2.el7_0.x86_64Error Summary-------------[root@computer_name linux]# yum update libstdc++-4.8.2-16.2.el7_0.x86_64Loaded plugins: langpacksResolving Dependencies--> Running transaction check---> Package libstdc++.x86_64 0:4.8.2-16.2.el7_0 will be updated--> Processing Dependency: libstdc++ = 4.8.2-16.2.el7_0 for package: gcc-c++-4.8.2-16.2.el7_0.x86_64--> Processing Dependency: libstdc++(x86-64) = 4.8.2-16.2.el7_0 for package: libstdc++-devel-4.8.2-16.2.el7_0.x86_64---> Package libstdc++.x86_64 0:4.8.5-4.el7 will be an update--> Running transaction check---> Package gcc-c++.x86_64 0:4.8.2-16.2.el7_0 will be updated---> Package gcc-c++.x86_64 0:4.8.5-4.el7 will be an update--> Processing Dependency: gcc = 4.8.5-4.el7 for package: gcc-c++-4.8.5-4.el7.x86_64---> Package libstdc++-devel.x86_64 0:4.8.2-16.2.el7_0 will be updated---> Package libstdc++-devel.x86_64 0:4.8.5-4.el7 will be an update--> Running transaction check---> Package gcc.x86_64 0:4.8.2-16.2.el7_0 will be updated--> Processing Dependency: gcc = 4.8.2-16.2.el7_0 for package: gcc-gfortran-4.8.2-16.2.el7_0.x86_64--> Processing Dependency: gcc = 4.8.2-16.2.el7_0 for package: libquadmath-devel-4.8.2-16.2.el7_0.x86_64---> Package gcc.x86_64 0:4.8.5-4.el7 will be an update--> Processing Dependency: libgomp = 4.8.5-4.el7 for package: gcc-4.8.5-4.el7.x86_64--> Processing Dependency: cpp = 4.8.5-4.el7 for package: gcc-4.8.5-4.el7.x86_64--> Processing Dependency: libgcc >= 4.8.5-4.el7 for package: gcc-4.8.5-4.el7.x86_64--> Running transaction check---> Package cpp.x86_64 0:4.8.2-16.2.el7_0 will be updated---> Package cpp.x86_64 0:4.8.5-4.el7 will be an update---> Package gcc-gfortran.x86_64 0:4.8.2-16.2.el7_0 will be updated---> Package gcc-gfortran.x86_64 0:4.8.5-4.el7 will be an update--> Processing Dependency: libquadmath = 4.8.5-4.el7 for package: gcc-gfortran-4.8.5-4.el7.x86_64--> Processing Dependency: libgfortran = 4.8.5-4.el7 for package: gcc-gfortran-4.8.5-4.el7.x86_64---> Package libgcc.x86_64 0:4.8.2-16.2.el7_0 will be updated---> Package libgcc.x86_64 0:4.8.5-4.el7 will be an update---> Package libgomp.x86_64 0:4.8.2-16.2.el7_0 will be updated---> Package libgomp.x86_64 0:4.8.5-4.el7 will be an update---> Package libquadmath-devel.x86_64 0:4.8.2-16.2.el7_0 will be updated---> Package libquadmath-devel.x86_64 0:4.8.5-4.el7 will be an update--> Running transaction check---> Package libgfortran.x86_64 0:4.8.2-16.2.el7_0 will be updated---> Package libgfortran.x86_64 0:4.8.5-4.el7 will be an update---> Package libquadmath.x86_64 0:4.8.2-16.2.el7_0 will be updated---> Package libquadmath.x86_64 0:4.8.5-4.el7 will be an update--> Finished Dependency ResolutionDependencies Resolved=============================================================================================================================================================================================== Package                                              Arch                                      Version                                          Repository                               Size===============================================================================================================================================================================================Updating: libstdc++                                            x86_64                                    4.8.5-4.el7                                      base                                    298 kUpdating for dependencies: cpp                                                  x86_64                                    4.8.5-4.el7                                      base                                    5.9 M gcc                                                  x86_64                                    4.8.5-4.el7                                      base                                     16 M gcc-c++                                              x86_64                                    4.8.5-4.el7                                      base                                    7.2 M gcc-gfortran                                         x86_64                                    4.8.5-4.el7                                      base                                    6.6 M libgcc                                               x86_64                                    4.8.5-4.el7                                      base                                     95 k libgfortran                                          x86_64                                    4.8.5-4.el7                                      base                                    293 k libgomp                                              x86_64                                    4.8.5-4.el7                                      base                                    130 k libquadmath                                          x86_64                                    4.8.5-4.el7                                      base                                    182 k libquadmath-devel                                    x86_64                                    4.8.5-4.el7                                      base                                     46 k libstdc++-devel                                      x86_64                                    4.8.5-4.el7                                      base                                    1.5 MTransaction Summary===============================================================================================================================================================================================Upgrade  1 Package (+10 Dependent packages)Total size: 38 MTotal download size: 38 MIs this ok [y/d/N]: yDownloading packages:Delta RPMs disabled because /usr/bin/applydeltarpm not installed.(1/10): gcc-4.8.5-4.el7.x86_64.rpm                                                                                                                                      |  16 MB  00:00:00     (2/10): cpp-4.8.5-4.el7.x86_64.rpm                                                                                                                                      | 5.9 MB  00:00:01     (3/10): gcc-gfortran-4.8.5-4.el7.x86_64.rpm                                                                                                                             | 6.6 MB  00:00:00     (4/10): libgfortran-4.8.5-4.el7.x86_64.rpm                                                                                                                              | 293 kB  00:00:00     (5/10): libgomp-4.8.5-4.el7.x86_64.rpm                                                                                                                                  | 130 kB  00:00:00     (6/10): libquadmath-4.8.5-4.el7.x86_64.rpm                                                                                                                              | 182 kB  00:00:00     (7/10): gcc-c++-4.8.5-4.el7.x86_64.rpm                                                                                                                                  | 7.2 MB  00:00:02     (8/10): libquadmath-devel-4.8.5-4.el7.x86_64.rpm                                                                                                                        |  46 kB  00:00:00     (9/10): libstdc++-4.8.5-4.el7.x86_64.rpm                                                                                                                                | 298 kB  00:00:00     (10/10): libstdc++-devel-4.8.5-4.el7.x86_64.rpm                                                                                                                         | 1.5 MB  00:00:00     -----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------Total                                                                                                                                                           10 MB/s |  38 MB  00:00:03     Running transaction checkRunning transaction testTransaction test succeededRunning transaction  Updating   : libquadmath-4.8.5-4.el7.x86_64                                                                                                                                             1/22   Updating   : libgcc-4.8.5-4.el7.x86_64                                                                                                                                                  2/22   Updating   : libstdc++-4.8.5-4.el7.x86_64                                                                                                                                               3/22   Updating   : libstdc++-devel-4.8.5-4.el7.x86_64                                                                                                                                         4/22   Updating   : libgfortran-4.8.5-4.el7.x86_64                                                                                                                                             5/22   Updating   : libgomp-4.8.5-4.el7.x86_64                                                                                                                                                 6/22   Updating   : cpp-4.8.5-4.el7.x86_64                                                                                                                                                     7/22   Updating   : gcc-4.8.5-4.el7.x86_64                                                                                                                                                     8/22   Updating   : libquadmath-devel-4.8.5-4.el7.x86_64                                                                                                                                       9/22   Updating   : gcc-gfortran-4.8.5-4.el7.x86_64                                                                                                                                           10/22   Updating   : gcc-c++-4.8.5-4.el7.x86_64                                                                                                                                                11/22   Cleanup    : gcc-gfortran-4.8.2-16.2.el7_0.x86_64                                                                                                                                      12/22   Cleanup    : gcc-c++-4.8.2-16.2.el7_0.x86_64                                                                                                                                           13/22   Cleanup    : libquadmath-devel-4.8.2-16.2.el7_0.x86_64                                                                                                                                 14/22   Cleanup    : gcc-4.8.2-16.2.el7_0.x86_64                                                                                                                                               15/22   Cleanup    : libgfortran-4.8.2-16.2.el7_0.x86_64                                                                                                                                       16/22   Cleanup    : libstdc++-devel-4.8.2-16.2.el7_0.x86_64                                                                                                                                   17/22   Cleanup    : libstdc++-4.8.2-16.2.el7_0.x86_64                                                                                                                                         18/22   Cleanup    : libgcc-4.8.2-16.2.el7_0.x86_64                                                                                                                                            19/22   Cleanup    : libquadmath-4.8.2-16.2.el7_0.x86_64                                                                                                                                       20/22   Cleanup    : cpp-4.8.2-16.2.el7_0.x86_64                                                                                                                                               21/22   Cleanup    : libgomp-4.8.2-16.2.el7_0.x86_64                                                                                                                                           22/22   Verifying  : gcc-4.8.5-4.el7.x86_64                                                                                                                                                     1/22   Verifying  : gcc-c++-4.8.5-4.el7.x86_64                                                                                                                                                 2/22   Verifying  : libstdc++-4.8.5-4.el7.x86_64                                                                                                                                               3/22   Verifying  : libquadmath-devel-4.8.5-4.el7.x86_64                                                                                                                                       4/22   Verifying  : libgfortran-4.8.5-4.el7.x86_64                                                                                                                                             5/22   Verifying  : gcc-gfortran-4.8.5-4.el7.x86_64                                                                                                                                            6/22   Verifying  : libstdc++-devel-4.8.5-4.el7.x86_64                                                                                                                                         7/22   Verifying  : cpp-4.8.5-4.el7.x86_64                                                                                                                                                     8/22   Verifying  : libgomp-4.8.5-4.el7.x86_64                                                                                                                                                 9/22   Verifying  : libgcc-4.8.5-4.el7.x86_64                                                                                                                                                 10/22   Verifying  : libquadmath-4.8.5-4.el7.x86_64                                                                                                                                            11/22   Verifying  : cpp-4.8.2-16.2.el7_0.x86_64                                                                                                                                               12/22   Verifying  : libquadmath-devel-4.8.2-16.2.el7_0.x86_64                                                                                                                                 13/22   Verifying  : libgfortran-4.8.2-16.2.el7_0.x86_64                                                                                                                                       14/22   Verifying  : gcc-4.8.2-16.2.el7_0.x86_64                                                                                                                                               15/22   Verifying  : gcc-gfortran-4.8.2-16.2.el7_0.x86_64                                                                                                                                      16/22   Verifying  : gcc-c++-4.8.2-16.2.el7_0.x86_64                                                                                                                                           17/22   Verifying  : libstdc++-4.8.2-16.2.el7_0.x86_64                                                                                                                                         18/22   Verifying  : libgcc-4.8.2-16.2.el7_0.x86_64                                                                                                                                            19/22   Verifying  : libgomp-4.8.2-16.2.el7_0.x86_64                                                                                                                                           20/22   Verifying  : libquadmath-4.8.2-16.2.el7_0.x86_64                                                                                                                                       21/22   Verifying  : libstdc++-devel-4.8.2-16.2.el7_0.x86_64                                                                                                                                   22/22 Updated:  libstdc++.x86_64 0:4.8.5-4.el7                                                                                                                                                               Dependency Updated:  cpp.x86_64 0:4.8.5-4.el7            gcc.x86_64 0:4.8.5-4.el7        gcc-c++.x86_64 0:4.8.5-4.el7        gcc-gfortran.x86_64 0:4.8.5-4.el7         libgcc.x86_64 0:4.8.5-4.el7              libgfortran.x86_64 0:4.8.5-4.el7    libgomp.x86_64 0:4.8.5-4.el7    libquadmath.x86_64 0:4.8.5-4.el7    libquadmath-devel.x86_64 0:4.8.5-4.el7    libstdc++-devel.x86_64 0:4.8.5-4.el7   Complete![root@computer_name linux]# yum install libstdc++-4.8.5-4.el7.i686Loaded plugins: langpacksResolving Dependencies--> Running transaction check---> Package libstdc++.i686 0:4.8.5-4.el7 will be installed--> Processing Dependency: libgcc_s.so.1(GLIBC_2.0) for package: libstdc++-4.8.5-4.el7.i686--> Processing Dependency: libgcc_s.so.1(GCC_4.2.0) for package: libstdc++-4.8.5-4.el7.i686--> Processing Dependency: libgcc_s.so.1(GCC_3.3) for package: libstdc++-4.8.5-4.el7.i686--> Processing Dependency: libgcc_s.so.1(GCC_3.0) for package: libstdc++-4.8.5-4.el7.i686--> Processing Dependency: libgcc_s.so.1 for package: libstdc++-4.8.5-4.el7.i686--> Running transaction check---> Package libgcc.i686 0:4.8.5-4.el7 will be installed--> Finished Dependency ResolutionDependencies Resolved=============================================================================================================================================================================================== Package                                         Arch                                       Version                                           Repository                                  Size===============================================================================================================================================================================================Installing: libstdc++                                       i686                                       4.8.5-4.el7                                       base                                       311 kInstalling for dependencies: libgcc                                          i686                                       4.8.5-4.el7                                       base                                       103 kTransaction Summary===============================================================================================================================================================================================Install  1 Package (+1 Dependent package)Total size: 413 kInstalled size: 1.2 MIs this ok [y/d/N]: yDownloading packages:Running transaction checkRunning transaction testTransaction test succeededRunning transaction  Installing : libgcc-4.8.5-4.el7.i686                                                                                                                                                     1/2   Installing : libstdc++-4.8.5-4.el7.i686                                                                                                                                                  2/2   Verifying  : libgcc-4.8.5-4.el7.i686                                                                                                                                                     1/2   Verifying  : libstdc++-4.8.5-4.el7.i686                                                                                                                                                  2/2 Installed:  libstdc++.i686 0:4.8.5-4.el7                                                                                                                                                                 Dependency Installed:  libgcc.i686 0:4.8.5-4.el7                                                                                                                                                                    Complete![root@computer_name linux]# ./aapt Android Asset Packaging ToolUsage: aapt l[ist] [-v] [-a] file.{zip,jar,apk}   List contents of Zip-compatible archive. aapt d[ump] [--values] [--include-meta-data] WHAT file.{apk} [asset [asset ...]]   strings          Print the contents of the resource table string pool in the APK.   badging          Print the label and icon for the app declared in APK.   permissions      Print the permissions from the APK.   resources        Print the resource table from the APK.   configurations   Print the configurations in the APK.   xmltree          Print the compiled xmls in the given assets.   xmlstrings       Print the strings of the given compiled xml assets. aapt p[ackage] [-d][-f][-m][-u][-v][-x][-z][-M AndroidManifest.xml] \        [-0 extension [-0 extension ...]] [-g tolerance] [-j jarfile] \        [--debug-mode] [--forced-package-id VAL] [--min-sdk-version VAL] [--target-sdk-version VAL] \        [--app-version VAL] [--app-version-name TEXT] [--custom-package VAL] \        [--rename-manifest-package PACKAGE] \        [--rename-instrumentation-target-package PACKAGE] \        [--utf16] [--auto-add-overlay] \        [--max-res-version VAL] \        [-I base-package [-I base-package ...]] \        [-A asset-source-dir]  [-G class-list-file] [-P public-definitions-file] \        [-S resource-sources [-S resource-sources ...]] \        [-F apk-file] [-J R-file-dir] \        [--product product1,product2,...] \        [-c CONFIGS] [--preferred-density DENSITY] \        [--split CONFIGS [--split CONFIGS]] \        [--feature-of package [--feature-after package]] \        [raw-files-dir [raw-files-dir] ...] \        [--output-text-symbols DIR]   Package the android resources.  It will read assets and resources that are   supplied with the -M -A -S or raw-files-dir arguments.  The -J -P -F and -R   options control which files are output. aapt r[emove] [-v] file.{zip,jar,apk} file1 [file2 ...]   Delete specified files from Zip-compatible archive. aapt a[dd] [-v] file.{zip,jar,apk} file1 [file2 ...]   Add specified files to Zip-compatible archive. aapt c[runch] [-v] -S resource-sources ... -C output-folder ...   Do PNG preprocessing on one or several resource folders   and store the results in the output folder. aapt s[ingleCrunch] [-v] -i input-file -o outputfile   Do PNG preprocessing on a single file. aapt v[ersion]   Print program version. Modifiers:   -a  print Android-specific data (resources, manifest) when listing   -c  specify which configurations to include.  The default is all       configurations.  The value of the parameter should be a comma       separated list of configuration values.  Locales should be specified       as either a language or language-region pair.  Some examples:            en            port,en            port,land,en_US   -d  one or more device assets to include, separated by commas   -f  force overwrite of existing files   -g  specify a pixel tolerance to force images to grayscale, default 0   -j  specify a jar or zip file containing classes to include   -k  junk path of file(s) added   -m  make package directories under location specified by -J   -u  update existing packages (add new, replace older, remove deleted files)   -v  verbose output   -x  create extending (non-application) resource IDs   -z  require localization of resource attributes marked with       localization="suggested"   -A  additional directory in which to find raw asset files   -G  A file to output proguard options into.   -F  specify the apk file to output   -I  add an existing package to base include set   -J  specify where to output R.java resource constant definitions   -M  specify full path to AndroidManifest.xml to include in zip   -P  specify where to output public resource definitions   -S  directory in which to find resources.  Multiple directories will be scanned       and the first match found (left to right) will take precedence.   -0  specifies an additional extension for which such files will not       be stored compressed in the .apk.  An empty string means to not       compress any files at all.   --debug-mode       inserts android:debuggable="true" in to the application node of the       manifest, making the application debuggable even on production devices.   --include-meta-data       when used with "dump badging" also includes meta-data tags.   --pseudo-localize       generate resources for pseudo-locales (en-XA and ar-XB).   --forced-package-id       forces value as package-id   --min-sdk-version       inserts android:minSdkVersion in to manifest.  If the version is 7 or       higher, the default encoding for resources will be in UTF-8.   --target-sdk-version       inserts android:targetSdkVersion in to manifest.   --max-res-version       ignores versioned resource directories above the given value.   --values       when used with "dump resources" also includes resource values.   --version-code       inserts android:versionCode in to manifest.   --version-name       inserts android:versionName in to manifest.   --replace-version       If --version-code and/or --version-name are specified, these       values will replace any value already in the manifest. By       default, nothing is changed if the manifest already defines       these attributes.   --custom-package       generates R.java into a different package.   --extra-packages       generate R.java for libraries. Separate libraries with ':'.   --generate-dependencies       generate dependency files in the same directories for R.java and resource package   --auto-add-overlay       Automatically add resources that are only in overlays.   --preferred-density       Specifies a preference for a particular density. Resources that do not       match this density and have variants that are a closer match are removed.   --split       Builds a separate split APK for the configurations listed. This can       be loaded alongside the base APK at runtime.   --feature-of       Builds a split APK that is a feature of the apk specified here. Resources       in the base APK can be referenced from the the feature APK.   --feature-after       An app can have multiple Feature Split APKs which must be totally ordered.       If --feature-of is specified, this flag specifies which Feature Split APK       comes before this one. The first Feature Split APK should not define       anything here.   --rename-manifest-package       Rewrite the manifest so that its package name is the package name       given here.  Relative class names (for example .Foo) will be       changed to absolute names with the old package so that the code       does not need to change.   --rename-instrumentation-target-package       Rewrite the manifest so that all of its instrumentation       components target the given package.  Useful when used in       conjunction with --rename-manifest-package to fix tests against       a package that has been renamed.   --product       Specifies which variant to choose for strings that have       product variants   --utf16       changes default encoding for resources to UTF-16.  Only useful when API       level is set to 7 or higher where the default encoding is UTF-8.   --non-constant-id       Make the resources ID non constant. This is required to make an R java class       that does not contain the final value but is used to make reusable compiled       libraries that need to access resources.   --shared-lib       Make a shared library resource package that can be loaded by an application       at runtime to access the libraries resources. Implies --non-constant-id.   --error-on-failed-insert       Forces aapt to return an error if it fails to insert values into the manifest       with --debug-mode, --min-sdk-version, --target-sdk-version --version-code       and --version-name.       Insertion typically fails if the manifest already defines the attribute.   --error-on-missing-config-entry       Forces aapt to return an error if it fails to find an entry for a configuration.   --output-text-symbols       Generates a text file containing the resource symbols of the R class in the       specified folder.   --ignore-assets       Assets to be ignored. Default pattern is:       !.svn:!.git:!.ds_store:!*.scc:.*:<dir>_*:!CVS:!thumbs.db:!picasa.ini:!*~   --skip-symbols-without-default-localization       Prevents symbols from being generated for strings that do not have a default       localization   --no-version-vectors       Do not automatically generate versioned copies of vector XML resources.[root@computer_name linux]#  ./aapt d badging /home/software/ftp/TempApk.apk package: name='com.example.tempapk' versionCode='1' versionName='1.0' platformBuildVersionName=''sdkVersion:'14'targetSdkVersion:'21'uses-permission: name='android.permission.GET_TASKS'application-label:'TempApk'application-icon-160:'res/drawable-mdpi/ic_launcher.png'application-icon-240:'res/drawable-hdpi/ic_launcher.png'application-icon-320:'res/drawable-xhdpi/ic_launcher.png'application-icon-480:'res/drawable-xxhdpi/ic_launcher.png'application: label='TempApk' icon='res/drawable-mdpi/ic_launcher.png'application-debuggablelaunchable-activity: name='com.example.tempapk.MainActivity'  label='TempApk' icon=''feature-group: label=''  uses-feature: name='android.hardware.touchscreen'  uses-implied-feature: name='android.hardware.touchscreen' reason='default feature for all apps'mainsupports-screens: 'small' 'normal' 'large' 'xlarge'supports-any-density: 'true'locales: '--_--'densities: '160' '240' '320' '480'[root@computer_name linux]# lltotal 1924-rwxr-xr-x 1 root root 1967712 Aug  7 11:04 aapt[root@computer_name linux]# pwd/home/software/apktool/apktool/prebuilt/aapt/linux[root@computer_name linux]# 

拷貝到/usr/bin目錄下,免去單獨設置環境變量

[root@computer_name linux]# ll /usr/bin/a*-rwxr-xr-x. 1 root root  107824 Jun 18  2014 /usr/bin/a2p-rwxr-xr-x  1 root root   52640 Jul 18 23:31 /usr/bin/ab...lrwxrwxrwx. 1 root root       4 Nov 21  2014 /usr/bin/awk -> gawk[root@computer_name linux]# cp aapt /usr/bin/[root@computer_name linux]# ll /usr/bin/a*-rwxr-xr-x. 1 root root  107824 Jun 18  2014 /usr/bin/a2p-rwxr-xr-x  1 root root 1967712 Aug  8 10:43 /usr/bin/aapt...lrwxrwxrwx. 1 root root       4 Nov 21  2014 /usr/bin/awk -> gawk[root@computer_name linux]# 

http://xxxxxx/Linuxjc/1156086.html TechArticle

Copyright © Linux教程網 All Rights Reserved