报错情形一:
更新了Android SDK到API level 20以后打包出错了:
Error building Player: Win32Exception: ApplicationName='C:/Android/adt-bundle-windows-x8664-20140702/sdk\tools\zipalign.exe', CommandLine='4 .......
解决方案:
上网查了一下文章,360搜索只找到一篇,说得不清楚,谷歌继续抽筋,还是用了yahoo中文,找到unity论坛的解决方法:
http://answers.unity3d.com/questions/759002/error-building-player-win32exception-1.html
step 1 go to the folder where your api is找到你api的文件夹(这个应该不难吧,目录为..\adt-bundle-windows-x86\sdk\build-tools),拣最高的版本
step 2 go to your newist api and coppy zipalign.exe复制这个文件
step 3 paste zipalign.exe at C:/Android/adt-bundle-windows-x8664-20140702/sdk\tools\搬家到旁边的邻居家里。。。坑哦!
再打包,问题解决。
报错情形二:
Error building Player: CommandInvokationFailure: Failed to re-package resources. See the Console for details.
E:\android\android-sdks\build-tools\19.1.0\aapt.exe package --auto-add-overlay -v -f -m -J gen -M AndroidManifest.xml -S "res" -I "E:/android/android-sdks/platforms/android-20\android.jar" -F bin/resources.ap_
stderr[
res\values\styles.xml:7: error: Error retrieving parent for item: No resource found that matches the given name 'Theme.AppCompat.Light'.
res\values-v11\styles.xml:7: error: Error retrieving parent for item: No resource found that matches the given name 'Theme.AppCompat.Light'.
res\values-v14\styles.xml:8: error: Error retrieving parent for item: No resource found that matches the given name 'Theme.AppCompat.Light.DarkActionBar'.
解决方案:
1、修改res/values,values-xx里面的styles.xml,
<style name="AppBaseTheme" parent="Theme.AppCompat.Light">
改为 <style name="AppBaseTheme" parent="android:Theme.Light">
同理,将 <style name="AppBaseTheme" parent="Theme.AppCompat.Light.DarkActionBar">
改为 <style name="AppBaseTheme" parent="android:Theme.Holo.Light.DarkActionBar">
2、删掉menu里面的文件main.xml
报错情形三:
Error building Player: CommandInvokationFailure: Failed to build apk. See the Console for details.
C:\Program Files\Java\jdk1.7.0_45\bin\java.exe -Xmx1024M -Dcom.android.sdkmanager.toolsdir="D:/android-sdk-windows\tools" -Dfile.encoding=UTF8 -jar "D:/Program Files/Unity/Editor/Data/BuildTargetTools/AndroidPlayer\sdktools.jar" -
解决方案:
1、重新创建签名及密码
2、重新创建后输出时还是报错的话,就关闭Unity重新打开再输出