分享

com.android.ide.common.process.ProcessException: Failed to execute aapt

 MLLWF 2017-12-25

情景:创建项目后报错

com.android.ide.common.process.ProcessException:Failed to execute aapt




原因:在build.gradle文件中,

compileSdkVersion 和buildToolsVersion 不匹配

解决:

匹配 compileSdkVersion 和buildToolsVersion 

通过SDK Manager工具安装最新的sdk版本,和buildToos的版本

修改

  1. apply plugin: 'com.android.application'  
  2.   
  3. android {  
  4.     compileSdkVersion 23  
  5.     buildToolsVersion '23.0.2'  
  6.     defaultConfig {  
  7.         applicationId "com.example.hp.myapplication2"  
  8.         minSdkVersion 15  
  9.         targetSdkVersion 21  
  10.         versionCode 1  
  11.         versionName "1.0"  
  12.         testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"  
  13.     }  
  14.     buildTypes {  
  15.         release {  
  16.             minifyEnabled false  
  17.             proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'  
  18.         }  
  19.     }  
  20. }  
  21.   
  22. dependencies {  
  23.     compile fileTree(include: ['*.jar'], dir: 'libs')  
  24.     androidTestCompile('com.android.support.test.espresso:espresso-core:2.2.2', {  
  25.         exclude group: 'com.android.support', module: 'support-annotations'  
  26.     })  
  27.     compile 'com.android.support:appcompat-v7:23.4.0'  
  28.     compile 'com.android.support:design:23.4.0'  
  29.     compile 'com.android.support.constraint:constraint-layout:1.0.0-beta4'  
  30.     testCompile 'junit:junit:4.12'  
  31. }  

参考资料:

Android Studio创建完android项目编译的时候报错

Android Studio 常见 Build 问题 Error:failed to find Build Tools revision 23.0.2



    本站是提供个人知识管理的网络存储空间,所有内容均由用户发布,不代表本站观点。请注意甄别内容中的联系方式、诱导购买等信息,谨防诈骗。如发现有害或侵权内容,请点击一键举报。
    转藏 分享 献花(0

    0条评论

    发表

    请遵守用户 评论公约

    类似文章 更多