1. 程式人生 > >Unity和Android互動出現一個問題

Unity和Android互動出現一個問題

Error building Player: CommandInvokationFailure: Failed to re-package resources. See the Console for details.
F:\adt-bundle-windows-x86-20140624\sdk\build-tools\android-4.4W\aapt.exe package --auto-add-overlay -v -f -m -J gen -M AndroidManifest.xml -S "res" -I "F:/adt-bundle-windows-x86-20140624/sdk/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'.
]
stdout[
Configurations:
(default)
v11
v14
hdpi
mdpi
xhdpi
xxhdpi


Files:
drawable\app_icon.png
Src: () res\drawable\app_icon.png
drawable\ic_launcher.png
Src: (hdpi) res\drawable-hdpi\ic_launcher.png
Src: (mdpi) res\drawable-mdpi\ic_launcher.png
Src: (xhdpi) res\drawable-xhdpi\ic_launcher.png
Src: (xxhdpi) res\drawable-xxhdpi\ic_launcher.png
layout\main.xml
Src: () res\layout\main.xml
values\strings.xml
Src: () res\values\strings.xml
values\styles.xml
Src: () res\values\styles.xml
Src: (v11) res\values-v11\styles.xml
Src: (v14) res\values-v14\styles.xml
AndroidManifest.xml
Src: () AndroidManifest.xml


Resource Dirs:
Type drawable
drawable\app_icon.png
Src: () res\drawable\app_icon.png
drawable\ic_launcher.png
Src: (hdpi) res\drawable-hdpi\ic_launcher.png
Src: (mdpi) res\drawable-mdpi\ic_launcher.png
Src: (xhdpi) res\drawable-xhdpi\ic_launcher.png
Src: (xxhdpi) res\drawable-xxhdpi\ic_launcher.png
Type layout
layout\main.xml
Src: () res\layout\main.xml
Type values
values\strings.xml
Src: () res\values\strings.xml
values\styles.xml
Src: () res\values\styles.xml
Src: (v11) res\values-v11\styles.xml
Src: (v14) res\values-v14\styles.xml
Including resources from package: F:\adt-bundle-windows-x86-20140624\sdk\platforms\android-20\android.jar
applyFileOverlay for drawable
applyFileOverlay for layout
applyFileOverlay for anim
applyFileOverlay for animator
applyFileOverlay for interpolator
applyFileOverlay for transition
applyFileOverlay for xml
applyFileOverlay for raw
applyFileOverlay for color
applyFileOverlay for menu
applyFileOverlay for mipmap
Processing image: res\drawable\app_icon.png
Processing image: res\drawable-hdpi\ic_launcher.png
Processing image: res\drawable-mdpi\ic_launcher.png
(processed image res\drawable-mdpi\ic_launcher.png: 82% size of source)
Processing image: res\drawable-xhdpi\ic_launcher.png
(processed image res\drawable-hdpi\ic_launcher.png: 77% size of source)
Processing image: res\drawable-xxhdpi\ic_launcher.png
(processed image res\drawable-xhdpi\ic_launcher.png: 74% size of source)
(processed image res\drawable\app_icon.png: 94% size of source)
(processed image res\drawable-xxhdpi\ic_launcher.png: 72% size of source)
(new resource id app_icon from drawable\app_icon.png #generated)
(new resource id ic_launcher from hdpi\drawable\ic_launcher.png #generated)
(new resource id ic_launcher from mdpi\drawable\ic_launcher.png #generated)
(new resource id ic_launcher from xhdpi\drawable\ic_launcher.png #generated)
(new resource id ic_launcher from xxhdpi\drawable\ic_launcher.png #generated)
(new resource id main from res\layout\main.xml)
]

解決方案

很簡單,修改AndroidManifest.xml的內容。將如下內容修改成
android:theme="@android:style/Theme.NoTitleBar"
android:icon="@drawable/app_icon"
android:label="@string/app_name"
那麼res資料夾可以不必匯入。

http://tieba.baidu.com/p/3147767224