如何修复android studio中的gradle构建错误?
我刚刚在Android Studio中创建了一个新项目,在gradle构建之后,它显示了以下错误。我不知道为什么会这样如何修复android studio中的gradle构建错误?,android,android-gradle-plugin,android-support-library,android-styles,Android,Android Gradle Plugin,Android Support Library,Android Styles,我刚刚在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-2
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'
}
这个错误可能有几个原因。由于我不确定您使用的项目级gradle和gradle版本,如果您使用任何旧版本,我建议您更新您的gradle。有一个可能会对您有所帮助。我有这个问题,而且我正在使用一个经过修改的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.
现在,单元测试编译任务将始终被跳过,不会抛出任何错误。put gradle file and gradle version details。我已经编辑并提供了gradle file信息@abhaykoradiya您是否尝试过
clean
和re build
project?检查。