当前位置:网站首页>Summary of ant usage (I): using ant to automatically package apk

Summary of ant usage (I): using ant to automatically package apk

2022-06-23 05:59:00 linchaolong

To configure ant Environmental Science


(1) download ant

Download address 1 :http://mirrors.cnnic.cn/apache//ant/binaries/apache-ant-1.9.4-bin.zip

Download address 2 :http://pan.baidu.com/s/1gdnc98n

(2) decompression ant, And put bin The directory path is configured to the system path variable


In the command line window, you can execute ant Command indicates successful configuration



Update project configuration


(1) Open the command line window , Execute the following command :

SDK root directory \tools\android update project --name Project name --target Compiled using Android SDK edition --path Project path

Example :

D:\AndroidDeveloper\adt-bundle-windows-x86_64-20140321\sdk\tools\android update project --name Linchaolong --target  android-10 --path E:\Project\Linchaolong


Use android list target The command can list SDK Version list .


(2) After successful execution, the following files will be generated in the project directory :

ant.properties

build.xml

local.properties

proguard-project.txt


Be careful : If the project depends on other projects , These files are also required for dependent projects , You can also use this command to generate .


Related configuration


(1) stay ant.properties Configuration in file .keystore Document related information

key.store=.keystore File path
key.store.password=.keystore File password
key.alias.password= Alias password
key.alias= Alias
#java Code obfuscation configuration file

proguard.config=proguard-project.txt  


(2) Use ant Command to generate apk

Optional parameters :

debug: Construction of trial signature with tone
release: Building the application , Generated apk You must sign to publish
install: Install the debug build package to the running simulator or device ;

Such as :ant release Represents the apk,apk Generate in project bin Under the table of contents .


Error log


error :[aapt] invalid resource directory name: xxx/bin/res/crunch

terms of settlement : Delete crunch Folder , And click Project ——Project—— Cancel Build Automatically, That's it .


Refer to the article address :http://blog.csdn.net/androiddevelop/article/details/11553215


Related articles :

ant Use summary ( Two ): Related command description

ant Use summary ( 3、 ... and ): Pack in bulk apk

原网站

版权声明
本文为[linchaolong]所创,转载请带上原文链接,感谢
https://yzsam.com/2022/174/202206230421395326.html