在新PC上安装android studio之后,我无法使用目标SDK版本28.0.0构建任何项目。但是它在27.1.1中没有显示错误。因此,我正在使用此较早的SDK版本进行构建。我还在堆栈溢出的不同上下文中找到了一个答案,指出28.0.0版本吐出了很多错误。但是为什么呢?
我尝试了干净的构建,使缓存无效并删除了.gradle文件夹,但没有任何效果,找不到任何解决方案。
如何使用最新版本的SDK成功构建?
如使用错误文本更新注释中所述:
Android resource linking failed
Output: W/ResourceType( 5112): ResTable_package:unknown data size 0x20202020 extends beyond resource end 00170544.
C:\Users\ThisUser\AndroidStudioProjects\ThisTestGame\wear\build\intermediates\incremental\mergeDebugResources\merged.dir\values\values.xml:149: error: resource android:color/black not found.
C:\Users\ThisUser\AndroidStudioProjects\ThisTestGame\wear\build\intermediates\incremental\mergeDebugResources\merged.dir\values\values.xml:151: error: resource android:color/black not found.
C:\Users\ThisUser\AndroidStudioProjects\ThisTestGame\wear\build\intermediates\incremental\mergeDebugResources\merged.dir\values\values.xml:152: error: resource android:color/black not found.
C:\Users\ThisUser\AndroidStudioProjects\ThisTestGame\wear\build\intermediates\incremental\mergeDebugResources\merged.dir\values\values.xml:159: error: resource android:color/white not found.
C:\Users\ThisUser\AndroidStudioProjects\ThisTestGame\wear\build\intermediates\incremental\mergeDebugResources\merged.dir\values\values.xml:170: error: resource android:color/white not found.
C:\Users\ThisUser\AndroidStudioProjects\ThisTestGame\wear\build\intermediates\incremental\mergeDebugResources\merged.dir\values\values.xml:171: error: resource android:color/black not found.
C:\Users\ThisUser\AndroidStudioProjects\ThisTestGame\wear\build\intermediates\incremental\mergeDebugResources\merged.dir\values\values.xml:186: error: resource android:color/white not found.
C:\Users\ThisUser\AndroidStudioProjects\ThisTestGame\wear\build\intermediates\incremental\mergeDebugResources\merged.dir\values\values.xml:188: error: resource android:color/black not found.
C:\Users\ThisUser\AndroidStudioProjects\ThisTestGame\wear\build\intermediates\incremental\mergeDebugResources\merged.dir\values\values.xml:189: error: resource android:color/white not found.
C:\Users\ThisUser\AndroidStudioProjects\ThisTestGame\wear\build\intermediates\incremental\mergeDebugResources\merged.dir\values\values.xml:218: error: resource android:color/white not found.
C:\Users\ThisUser\AndroidStudioProjects\ThisTestGame\wear\build\intermediates\incremental\mergeDebugResources\merged.dir\values\values.xml:219: error: resource android:color/black not found.
C:\Users\ThisUser\AndroidStudioProjects\ThisTestGame\wear\build\intermediates\incremental\mergeDebugResources\merged.dir\values\values.xml:241: error: resource android:color/black not found.
error: resource android:style/Theme.DeviceDefault not found.
C:\Users\ThisUser\AndroidStudioProjects\ThisTestGame\wear\build\intermediates\incremental\mergeDebugResources\merged.dir\values\values.xml:2569: error: style attribute 'android:attr/windowSwipeToDismiss' not found.
error: resource android:style/Widget not found.
C:\Users\ThisUser\AndroidStudioProjects\ThisTestGame\wear\build\intermediates\incremental\mergeDebugResources\merged.dir\values\values.xml:2572: error: style attribute 'android:attr/layout' not found.
error: resource android:style/Animation not found.
C:\Users\ThisUser\AndroidStudioProjects\ThisTestGame\wear\build\intermediates\incremental\mergeDebugResources\merged.dir\values\values.xml:2581: error: style attribute 'android:attr/windowEnterAnimation' not found.
C:\Users\ThisUser\AndroidStudioProjects\ThisTestGame\wear\build\intermediates\incremental\mergeDebugResources\merged.dir\values\values.xml:2582: error: style attribute 'android:attr/windowExitAnimation' not found.
error: resource android:style/Animation not found.
Command: C:\Users\ThisUser\.gradle\caches\transforms-1\files-1.1\aapt2-3.2.1-4818971-windows.jar\39c8269e0849c64d409f0ab7dabfbbb8\aapt2-3.2.1-4818971-windows\aapt2.exe link -I\
C:\Users\ThisUser\AppData\Local\Android\Sdk\platforms\android-28\android.jar\
--manifest\
C:\Users\ThisUser\AndroidStudioProjects\ThisTestGame\wear\build\intermediates\merged_manifests\debug\processDebugManifest\merged\AndroidManifest.xml\
-o\
C:\Users\ThisUser\AndroidStudioProjects\ThisTestGame\wear\build\intermediates\processed_res\debug\processDebugResources\out\resources-debug.ap_\
-R\
@C:\Users\ThisUser\AndroidStudioProjects\ThisTestGame\wear\build\intermediates\incremental\processDebugResources\resources-list-for-resources-debug.ap_.txt\
--auto-add-overlay\
--java\
C:\Users\ThisUser\AndroidStudioProjects\ThisTestGame\wear\build\generated\not_namespaced_r_class_sources\debug\processDebugResources\r\
--custom-package\
com.fitasc.ThisTestGame\
-0\
apk\
--output-text-symbols\
C:\Users\ThisUser\AndroidStudioProjects\ThisTestGame\wear\build\intermediates\symbols\debug\R.txt\
--no-version-vectors
Daemon: AAPT2 aapt2-3.2.1-4818971-windows Daemon #0
重点不是这些错误,因为与其他SDK版本(无论是穿戴设备还是移动版)一起使用时,这些错误都不存在,这些错误在28.0.0的SDK版本中显示。
谢谢。