我刚刚在Android Studio中创建了一个新项目,并且在构建gradle之后,它显示以下错误。我不知道为什么会这样。
Information:Gradle tasks [clean, :app:generateDebugSources, :app:generateDebugAndroidTestSources, :app:mockableAndroidJar]
C:\Users\DEVPC\.gradle\caches\transforms-1\files-1.1\appcompat-v7-26.1.0.aar\4a763fb9bbd72a5413be967c96404ad9\res\values-v11\values-v11.xml
Error:(67, 5) error: resource style/Widget.AppCompat.Button.Borderless (aka com.asif047.includinglibrary2:style/Widget.AppCompat.Button.Borderless) not found.
Error:(67, 5) error: resource style/Widget.AppCompat.ButtonBar.AlertDialog (aka com.asif047.includinglibrary2:style/Widget.AppCompat.ButtonBar.AlertDialog) not found.
Error:(72, 5) error: resource style/Widget.AppCompat.ButtonBar.AlertDialog (aka com.asif047.includinglibrary2:style/Widget.AppCompat.ButtonBar.AlertDialog) not found.
Error:(72, 5) error: resource style/Widget.AppCompat.Button.Borderless (aka com.asif047.includinglibrary2:style/Widget.AppCompat.Button.Borderless) not found.
Error:(77, 5) error: resource style/Widget.AppCompat.ButtonBar.AlertDialog (aka com.asif047.includinglibrary2:style/Widget.AppCompat.ButtonBar.AlertDialog) not found.
Error:(77, 5) error: resource style/Widget.AppCompat.Button.Borderless (aka com.asif047.includinglibrary2:style/Widget.AppCompat.Button.Borderless) not found.
C:\Users\DEVPC\.gradle\caches\transforms-1\files-1.1\appcompat-v7-26.1.0.aar\4a763fb9bbd72a5413be967c96404ad9\res\values-v21\values-v21.xml
Error:(49, 5) error: resource string/abc_font_family_title_material (aka com.asif047.includinglibrary2:string/abc_font_family_title_material) not found.
Error:(49, 5) error: resource dimen/abc_text_size_menu_header_material (aka com.asif047.includinglibrary2:dimen/abc_text_size_menu_header_material) not found.
Error:(111, 5) error: resource dimen/abc_floating_window_z (aka com.asif047.includinglibrary2:dimen/abc_floating_window_z) not found.
Error:resource style/Theme.AppCompat.Light.DarkActionBar (aka com.asif047.includinglibrary2:style/Theme.AppCompat.Light.DarkActionBar) not found.
E:\E-COMMERCE NEW\IncludingLibrary2\app\build\intermediates\incremental\mergeDebugResources\merged.dir\values-v14\values-v14.xml
Error:(4) error: resource dimen/abc_text_size_button_material (aka com.asif047.includinglibrary2:dimen/abc_text_size_button_material) not found.
Error:(4) resource dimen/abc_text_size_button_material (aka com.asif047.includinglibrary2:dimen/abc_text_size_button_material) not found.
Error:resource style/Base.Theme.AppCompat.Dialog.FixedSize (aka com.asif047.includinglibrary2:style/Base.Theme.AppCompat.Dialog.FixedSize) not found.
Error:resource style/TextAppearance.AppCompat (aka com.asif047.includinglibrary2:style/TextAppearance.AppCompat) not found.
Error:resource style/Base.Theme.AppCompat.Light.Dialog.FixedSize (aka com.asif047.includinglibrary2:style/Base.Theme.AppCompat.Light.Dialog.FixedSize) not found.
Error:resource style/Base.V7.Theme.AppCompat.Light.Dialog (aka com.asif047.includinglibrary2:style/Base.V7.Theme.AppCompat.Light.Dialog) not found.
Error:resource style/Base.V7.Theme.AppCompat.Dialog (aka com.asif047.includinglibrary2:style/Base.V7.Theme.AppCompat.Dialog) not found.
Error:resource style/Base.V7.ThemeOverlay.AppCompat.Dialog (aka com.asif047.includinglibrary2:style/Base.V7.ThemeOverlay.AppCompat.Dialog) not found.
E:\E-COMMERCE NEW\IncludingLibrary2\app\build\intermediates\incremental\mergeDebugResources\merged.dir\values-v11\values-v11.xml
Error:(63) resource style/Widget.AppCompat.ButtonBar.AlertDialog (aka com.asif047.includinglibrary2:style/Widget.AppCompat.ButtonBar.AlertDialog) not found.
Error:(64) resource style/Widget.AppCompat.Button.Borderless (aka com.asif047.includinglibrary2:style/Widget.AppCompat.Button.Borderless) not found.
Error:(68) resource style/Widget.AppCompat.ButtonBar.AlertDialog (aka com.asif047.includinglibrary2:style/Widget.AppCompat.ButtonBar.AlertDialog) not found.
Error:(69) resource style/Widget.AppCompat.Button.Borderless (aka com.asif047.includinglibrary2:style/Widget.AppCompat.Button.Borderless) not found.
Error:(73) resource style/Widget.AppCompat.ButtonBar.AlertDialog (aka com.asif047.includinglibrary2:style/Widget.AppCompat.ButtonBar.AlertDialog) not found.
Error:(74) resource style/Widget.AppCompat.Button.Borderless (aka com.asif047.includinglibrary2:style/Widget.AppCompat.Button.Borderless) not found.
Error:resource style/Base.V7.Widget.AppCompat.AutoCompleteTextView (aka com.asif047.includinglibrary2:style/Base.V7.Widget.AppCompat.AutoCompleteTextView) not found.
Error:resource style/Base.V7.Widget.AppCompat.EditText (aka com.asif047.includinglibrary2:style/Base.V7.Widget.AppCompat.EditText) not found.
Error:resource style/Base.V7.Theme.AppCompat (aka com.asif047.includinglibrary2:style/Base.V7.Theme.AppCompat) not found.
E:\E-COMMERCE NEW\IncludingLibrary2\app\build\intermediates\incremental\mergeDebugResources\merged.dir\values-v21\values-v21.xml
Error:(50) resource dimen/abc_text_size_menu_header_material (aka com.asif047.includinglibrary2:dimen/abc_text_size_menu_header_material) not found.
Error:(49) resource string/abc_font_family_title_material (aka com.asif047.includinglibrary2:string/abc_font_family_title_material) not found.
Error:(113) resource dimen/abc_floating_window_z (aka com.asif047.includinglibrary2:dimen/abc_floating_window_z) 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
在这里给出了gradle文件的信息:
> apply plugin: 'com.android.application'
android {
compileSdkVersion 26
defaultConfig {
applicationId "com.asif047.includinglibrary2"
minSdkVersion 15
targetSdkVersion 26
versionCode 1
versionName "1.0"
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
} }
dependencies {
implementation fileTree(dir: 'libs', include: ['*.jar'])
implementation 'com.android.support:appcompat-v7:26.1.0'
implementation 'com.android.support.constraint:constraint-layout:1.1.2'
testImplementation 'junit:junit:4.12'
}
答案 0 :(得分:0)
此错误可能有多种原因。由于我不确定您的项目级别gradle和使用的gradle版本,因此,如果您使用任何较旧的版本,建议您更新gradle。有SO post可能对您有帮助。
答案 1 :(得分:0)
我有这个问题,而且我使用的是经过修改的android.jar(其中显示了所有隐藏的API)。 我不使用单元测试,并且在Android Studio 2.2.2中没有明显的方法来禁用它,因此我找到了解决此问题的方法:
1. Go to File -> Settings -> Build, Execution, Deployment -> Compiler
2. Add to "Command-line Options":
-x :app:prepareReleaseUnitTestDependencies -x :app:mockableAndroidJar -x
:app:compileReleaseUnitTestSources
3. Press "OK" and try to Rebuild Project again.
现在将始终跳过单元测试编译任务,并且不会引发任何错误。