Centos 64位安装aapt、jdk、tomcat的详细教程
1、安装jdk
#查看系统自带的jdk [root@localhost~]#rpm-qa|grepjdk java-1.7.0-openjdk-1.7.0.79-2.5.5.4.el6.x86_64 java-1.6.0-openjdk-1.6.0.35-1.13.7.1.el6_6.x86_64 #卸载系统自带openjdk [root@localhost~]#rpm-e--nodepsjava-1.6.0-openjdk-1.6.0.35-1.13.7.1.el6_6.x86_64 [root@localhost~]#rpm-e--nodepsjava-1.7.0-openjdk-1.7.0.79-2.5.5.4.el6.x86_64 #查看jdk版本 [root@localhost~]#java-version -bash:/usr/bin/java:没有那个文件或目录 #ok,卸载成功! #下面安装我们自己的jdk #自己去下载 [root@localhost~]#cd/usr/local/java/jdk #查看目录文件 [root@localhostjava]#ls jdk-7u79-linux-x64.tar.gz #解压 [root@localhostjdk]#tar-zxvfjdk-7u79-linux-x64.tar.gz #授权 [root@localhostjdk]#chmod+xjdk1.7.0_79/
配置环境变量,(稍后和tomcat一起配置)
2.安装tomcat
下载目录:tomcat7下载地址
#查看 [root@localhostjava]#lstomcat/ apache-tomcat-7.0.29.tar.gz #解压 [root@localhosttomcat]#tar-zxvfapache-tomcat-7.0.29.tar.gz #授权 [root@localhostjdk]#chmod+xapache-tomcat-7.0.29
3、配置环境变量
#编辑profile文件:vim/etc/profile exportJAVA_HOME=/usr/local/java/jdk/jdk1.7.0_79 exportCALSSPATH=$JAVA_HOME/lib/*.* exportPATH=$PATH:$JAVA_HOME/bin exportTOMCAT_HOME=/usr/local/java/tomcat/apache-tomcat-7.0.29 exportCATALINA_HOME=/usr/local/java/tomcat/apache-tomcat-7.0.29 #保存文件并退出!
注意:等号前后没有空格
#使设置立即生效: [root@localhostjdk]#source/etc/profile #查看jdk是否安装成功 [root@localhostjdk]#java-version javaversion"1.7.0_79" Java(TM)SERuntimeEnvironment(build1.7.0_79-b15) JavaHotSpot(TM)64-BitServerVM(build24.79-b02,mixedmode) #成功! #启动tomcat [root@localhostbin]#sh/usr/local/java/tomcat/apache-tomcat-7.0.29/bin/startup.sh #查看启动日志 [root@localhostbin]#tail-f/usr/local/java/tomcat/apache-tomcat-7.0.29/logs/catalina.out #访问tomcat http://192.168.81.115:8080/ #如果访问不了,要开启防火墙 #打开防火墙端口命令 #开启8080端口 [root@localhostbin]#/sbin/iptables-IINPUT-ptcp--dport8080-jACCEPT #再次访问tomcat http://192.168.81.115:8080/
OK!
4、安装aapt
下载目录:
aapt下载
apktool.jar下载
#授权
[root@localhostapktool]#chmod+xaapt
#执行
[root@localhostapktool]#./aapt
-bash:./aapt:/lib/ld-linux.so.2:badELFinterpreter:没有那个文件或目录
#那么在64位操作系统下去执行./aapt命令的话会报以上错误
#我们需要安装:glibc.i686,zlib.i686,libstdc++.i686
#(1.)第一步
[root@localhostapktool]#yuminstallglibc.i686
[root@localhostapktool]#./aapt
#./aapt:errorwhileloadingsharedlibraries:libz.so.1:cannotopensharedobjectfile:Nosuchfileordirectory
#(2.)第二步
[root@localhostapktool]#sudoyuminstallzlib.i686
[root@localhostapktool]#./aapt
#./aapt:errorwhileloadingsharedlibraries:libstdc++.so.6:cannotopensharedobjectfile:Nosuchfileordirectory
#(3.)第三步
[root@localhostapktool]#sudoyuminstalllibstdc++.i686
#运行./aaptversion看看是否安装成功
[root@localhostapktool]#./aaptversion
#AndroidAssetPackagingTool,v0.2
#如果出现以上说明安装成功,或者可以执行运行./aapt,如果出现一大坨和最下面的相同的东西说明成功;如果还是报错,就继续往下走
#(4.)第四步
[root@localhostapktool]#./aapt
#看最后一句
#Protectedmultilibversions:libstdc++-4.4.7-17.el6.i686!=libstdc++-4.4.7-16.el6.x86_64
#如果报错的话需要升级!=后面的版本,执行
[root@localhostapktool]#yumupdatelibstdc++-4.4.7-16.el6.x86_64
[root@localhostapktool]#./aapt
#./aapt:errorwhileloadingsharedlibraries:libstdc++.so.6:cannotopensharedobjectfile:Nosuchfileordirectory
#还是报错,继续
#(5.)第五步
[root@localhostapktool]#yuminstalllibstdc++.so.6
[root@localhostapktool]#./aapt
AndroidAssetPackagingTool
Usage:
aaptl[ist][-v][-a]file.{zip,jar,apk}
ListcontentsofZip-compatiblearchive.
aaptd[ump][--values]WHATfile.{apk}[asset[asset...]]
badgingPrintthelabelandiconfortheappdeclaredinAPK.
permissionsPrintthepermissionsfromtheAPK.
resourcesPrinttheresourcetablefromtheAPK.
configurationsPrinttheconfigurationsintheAPK.
xmltreePrintthecompiledxmlsinthegivenassets.
xmlstringsPrintthestringsofthegivencompiledxmlassets.
aaptp[ackage][-d][-f][-m][-u][-v][-x][-z][-MAndroidManifest.xml]\
[-0extension[-0extension...]][-gtolerance][-jjarfile]\
[--debug-mode][--min-sdk-versionVAL][--target-sdk-versionVAL]\
[--app-versionVAL][--app-version-nameTEXT][--custom-packageVAL]\
[--rename-manifest-packagePACKAGE]\
[--rename-instrumentation-target-packagePACKAGE]\
[--utf16][--auto-add-overlay]\
[--max-res-versionVAL]\
[-Ibase-package[-Ibase-package...]]\
[-Aasset-source-dir][-Gclass-list-file][-Ppublic-definitions-file]\
[-Sresource-sources[-Sresource-sources...]][-Fapk-file][-JR-file-dir]\
[--productproduct1,product2,...]\
[raw-files-dir[raw-files-dir]...]
Packagetheandroidresources.Itwillreadassetsandresourcesthatare
suppliedwiththe-M-A-Sorraw-files-dirarguments.The-J-P-Fand-R
optionscontrolwhichfilesareoutput.
aaptr[emove][-v]file.{zip,jar,apk}file1[file2...]
DeletespecifiedfilesfromZip-compatiblearchive.
aapta[dd][-v]file.{zip,jar,apk}file1[file2...]
AddspecifiedfilestoZip-compatiblearchive.
aaptv[ersion]
Printprogramversion.
Modifiers:
-aprintAndroid-specificdata(resources,manifest)whenlisting
-cspecifywhichconfigurationstoinclude.Thedefaultisall
configurations.Thevalueoftheparametershouldbeacomma
separatedlistofconfigurationvalues.Localesshouldbespecified
aseitheralanguageorlanguage-regionpair.Someexamples:
en
port,en
port,land,en_US
Ifyouputthespeciallocale,zz_ZZonthelist,itwillperform
pseudolocalizationonthedefaultlocale,modifyingallofthe
stringssoyoucanlookforstringsthatmissedthe
internationalizationprocess.Forexample:
port,land,zz_ZZ
-doneormoredeviceassetstoinclude,separatedbycommas
-fforceoverwriteofexistingfiles
-gspecifyapixeltolerancetoforceimagestograyscale,default0
-jspecifyajarorzipfilecontainingclassestoinclude
-kjunkpathoffile(s)added
-mmakepackagedirectoriesunderlocationspecifiedby-J
-uupdateexistingpackages(addnew,replaceolder,removedeletedfiles)
-vverboseoutput
-xcreateextending(non-application)resourceIDs
-zrequirelocalizationofresourceattributesmarkedwith
localization="suggested"
-Aadditionaldirectoryinwhichtofindrawassetfiles
-GAfiletooutputproguardoptionsinto.
-Fspecifytheapkfiletooutput
-Iaddanexistingpackagetobaseincludeset
-JspecifywheretooutputR.javaresourceconstantdefinitions
-MspecifyfullpathtoAndroidManifest.xmltoincludeinzip
-Pspecifywheretooutputpublicresourcedefinitions
-Sdirectoryinwhichtofindresources.Multipledirectorieswillbescanned
andthefirstmatchfound(lefttoright)willtakeprecedence.
-0specifiesanadditionalextensionforwhichsuchfileswillnot
bestoredcompressedinthe.apk.Anemptystringmeanstonot
compressanyfilesatall.
--debug-mode
insertsandroid:debuggable="true"intotheapplicationnodeofthe
manifest,makingtheapplicationdebuggableevenonproductiondevices.
--min-sdk-version
insertsandroid:minSdkVersionintomanifest.Iftheversionis7or
higher,thedefaultencodingforresourceswillbeinUTF-8.
--target-sdk-version
insertsandroid:targetSdkVersionintomanifest.
--max-res-version
ignoresversionedresourcedirectoriesabovethegivenvalue.
--values
whenusedwith"dumpresources"alsoincludesresourcevalues.
--version-code
insertsandroid:versionCodeintomanifest.
--version-name
insertsandroid:versionNameintomanifest.
--custom-package
generatesR.javaintoadifferentpackage.
--auto-add-overlay
Automaticallyaddresourcesthatareonlyinoverlays.
--rename-manifest-package
Rewritethemanifestsothatitspackagenameisthepackagename
givenhere.Relativeclassnames(forexample.Foo)willbe
changedtoabsolutenameswiththeoldpackagesothatthecode
doesnotneedtochange.
--rename-instrumentation-target-package
Rewritethemanifestsothatallofitsinstrumentation
componentstargetthegivenpackage.Usefulwhenusedin
conjunctionwith--rename-manifest-packagetofixtestsagainst
apackagethathasbeenrenamed.
--product
Specifieswhichvarianttochooseforstringsthathave
productvariants
--utf16
changesdefaultencodingforresourcestoUTF-16.OnlyusefulwhenAPI
levelissetto7orhigherwherethedefaultencodingisUTF-8.
--non-constant-id
MaketheresourcesIDnonconstant.ThisisrequiredtomakeanRjavaclass
thatdoesnotcontainthefinalvaluebutisusedtomakereusablecompiled
librariesthatneedtoaccessresources.
出现以上信息说明安装成功!
这时可以上传一个apk文件,然后执行解析apk
目录:
执行:./aaptdbadging1.apk
可以看到结果输出的包名、版本号等等信息都解析出来了。
以上所述是小编给大家介绍的Centos64位安装aapt、jdk、tomcat的详细教程,希望对大家有所帮助,如果大家有任何疑问请给我留言,小编会及时回复大家的。在此也非常感谢大家对毛票票网站的支持!