在重新安装Android工作室之后,许多资源都缺少



我重新安装了Android Studio,因为我的一个驱动器坠毁。安装后,我尝试构建项目,我遇到了一些奇怪的错误:

C:Userswoors.gradlecachestransforms-1files-1.1appcompat-v7-
27.0.2.aarc3f1a01ea2c7c2b45168cff946884206resvaluesvalues.xml
Error:error: resource layout/abc_alert_dialog_material (aka com.tomade.saufomat:layout/abc_alert_dialog_material) not found.
Error:error: resource layout/abc_select_dialog_material (aka com.tomade.saufomat:layout/abc_select_dialog_material) not found.
Error:error: resource layout/select_dialog_item_material (aka com.tomade.saufomat:layout/select_dialog_item_material) not found.
Error:error: resource layout/select_dialog_multichoice_material (aka com.tomade.saufomat:layout/select_dialog_multichoice_material) not found.
Error:error: resource layout/select_dialog_singlechoice_material (aka com.tomade.saufomat:layout/select_dialog_singlechoice_material) not found.
Error:error: resource anim/abc_popup_enter (aka com.tomade.saufomat:anim/abc_popup_enter) not found.
Error:error: resource anim/abc_popup_exit (aka com.tomade.saufomat:anim/abc_popup_exit) not found.
Error:error: resource anim/abc_grow_fade_in_from_bottom (aka com.tomade.saufomat:anim/abc_grow_fade_in_from_bottom) not found.
Error:error: resource anim/abc_shrink_fade_out_from_bottom (aka com.tomade.saufomat:anim/abc_shrink_fade_out_from_bottom) not found.
Error:error: resource anim/tooltip_enter (aka com.tomade.saufomat:anim/tooltip_enter) not found.
Error:error: resource anim/tooltip_exit (aka com.tomade.saufomat:anim/tooltip_exit) not found.
Error:error: resource color/abc_btn_colored_borderless_text_material (aka com.tomade.saufomat:color/abc_btn_colored_borderless_text_material) not found.
Error:error: resource color/abc_btn_colored_text_material (aka com.tomade.saufomat:color/abc_btn_colored_text_material) not found.
Error:error: resource drawable/abc_list_selector_holo_dark (aka com.tomade.saufomat:drawable/abc_list_selector_holo_dark) not found.
Error:error: resource color/abc_background_cache_hint_selector_material_dark (aka com.tomade.saufomat:color/abc_background_cache_hint_selector_material_dark) not found.
Error:error: resource color/abc_primary_text_material_dark (aka com.tomade.saufomat:color/abc_primary_text_material_dark) not found.
Error:error: resource color/abc_primary_text_material_light (aka com.tomade.saufomat:color/abc_primary_text_material_light) not found.
Error:error: resource color/abc_primary_text_disable_only_material_dark (aka com.tomade.saufomat:color/abc_primary_text_disable_only_material_dark) not found.
Error:error: resource color/abc_secondary_text_material_dark (aka com.tomade.saufomat:color/abc_secondary_text_material_dark) not found.
Error:error: resource color/abc_secondary_text_material_light (aka com.tomade.saufomat:color/abc_secondary_text_material_light) not found.
Error:java.util.concurrent.ExecutionException: java.util.concurrent.ExecutionException: com.android.tools.aapt2.Aapt2Exception: AAPT2 error: check logs for details
Error:java.util.concurrent.ExecutionException: com.android.tools.aapt2.Aapt2Exception: AAPT2 error: check logs for details
Error:com.android.tools.aapt2.Aapt2Exception: AAPT2 error: check logs for details
Error:Execution failed for task ':app:processDebugResources'.
> Failed to execute aapt

我清理了缓存,并试图再次构建,但是我遇到了相同的错误。有人遇到此错误吗?


更新
如果我删除文件 appbuildintermediatesincrementalmergeDebugResourcesmerged.dirvaluesvalues.xml错误消失了。但是只有几分钟。然后,我必须再次删除文件。每当我启动Android Studio时,我都必须重新选择我的SDK。这些错误真的很奇怪。

这是因为您具有CompileSdkVersionbuildToolsVersiontargetSdkVersion和支持库的不同版本。您需要为他们使用相同的版本。在您的情况下,您需要使用版本27。类似的内容:

apply plugin: 'com.android.library'
android {
  compileSdkVersion 27
  buildToolsVersion "27.0.3"
  defaultConfig {
    minSdkVersion 14
    targetSdkVersion 27
    // ...
  }
  //...
}
dependencies {
  // ...
  implementation 'com.android.support:appcompat-v7:27.1.0'
}

相关内容

最新更新