set workpath=g:\unity3dwork\zsxd-android\clientset unitypath="C:\Program Files (x86)\Unity472\Editor\Unity.exe"set toolpath=D:\adt-bundle-windows-x86_64-20140702\sdk\tools\androidset datestr=%date:~0,4%%date:~5,2%%date:~8,2%-%time:~0,2%%time:~3,2%%time:~6,2% set configdir=tencentset buildfunc=buildtencentAndroidset project_name=test::复制配置文件登陆口地址,资源下载地址等::xcopy "%workpath%\config\%configdir%\android\Assets\*" "%workpath%\Assets\" /s /e /y::复制资源到项目目录::call %workpath%\config\%configdir%\android\build\rsyncres::编译unity项目为eclipse项目rd /S/Q "%workpath%\build\%project_name%\"xcopy "%workpath%\config\%configdir%\android\Assets\*" "%workpath%\Assets\" /s /e /y%unitypath% -quit -batchmode -projectPath "%workpath%" -executeMethod BuildTool.%buildfunc% -logFile "%workpath%\build\export-app.log"::复制eclipse项目配置,keystore文件和密码等到项目目录xcopy "%workpath%\config\%configdir%\android\config\*" "%workpath%\build\%project_name%\" /s /e /ycall %toolpath% update lib-project --target 1 -p %workpath%\config\tencent\android\Libraries\YSDKLibrarycall %toolpath% update project --name zjfy --target 4 --path %workpath%\build\%project_name%\ --subprojectscd /d %workpath%\build\%project_name%call ant cleancall ant releasepause
由于不同版本sdk需要的android sdk版本不同,需要先使用eclipse打开项目排除错误,然后查看是哪个版本的tagets值,eclipse显示的Name值,target是它对应的id 每台机器的targets数值代表的android sdk版本不同,需要根据自己的情况修改 查看targets列表
D:\adt-bundle-windows-x86_64-20140702\sdk\tools\android list targets
Available Android targets:----------id: 1 or "android-22" Name: Android 5.1.1 Type: Platform API level: 22 Revision: 2 Skins: HVGA, QVGA, WQVGA400, WQVGA432, WSVGA, WVGA800 (default), WVGA854, WXGA720, WXGA800, WXGA800-7in Tag/ABIs : no ABIs.----------id: 2 or "android-23" Name: Android 6.0 Type: Platform API level: 23 Revision: 3 Skins: HVGA, QVGA, WQVGA400, WQVGA432, WSVGA, WVGA800 (default), WVGA854, WXGA720, WXGA800, WXGA800-7in Tag/ABIs : no ABIs.----------id: 3 or "android-24" Name: Android 7.0 Type: Platform API level: 24 Revision: 2 Skins: HVGA, QVGA, WQVGA400, WQVGA432, WSVGA, WVGA800 (default), WVGA854, WXGA720, WXGA800, WXGA800-7in Tag/ABIs : no ABIs.----------id: 4 or "android-25" Name: Android 7.1.1 Type: Platform API level: 25 Revision: 3 Skins: HVGA, QVGA, WQVGA400, WQVGA432, WSVGA, WVGA800 (default), WVGA854, WXGA720, WXGA800, WXGA800-7in Tag/ABIs : no ABIs.
另外如果有编译错误需要修改 d:\adt-bundle-windows-x86_64-20140702\sdk\tools\ant\build.xml 将71和72行的1.5修改为1.7