重新安装Android Studio后,很多资源都有点缺失

时间:2018-02-15 16:25:56

标签: android android-studio gradle

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

C:\Users\woors\.gradle\caches\transforms-1\files-1.1\appcompat-v7-
27.0.2.aar\c3f1a01ea2c7c2b45168cff946884206\res\values\values.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

我清理了我的缓存并尝试再次构建,但我得到了同样的错误。 有没有人遇到过这个错误?

更新
如果我删除该文件 \app\build\intermediates\incremental\mergeDebugResources\merged.dir\values\values.xml 错误消失了。但只是几分钟。然后我必须再次删除该文件。 每当我启动Android Studio时,我都必须重新选择我的SDK。 这些错误真的很奇怪。

1 个答案:

答案 0 :(得分:0)

这是因为您有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'

}