Android Studio: Gradle build fails — Execution failed for task ':compileDebugAidl'

前端 未结 10 2119
孤街浪徒
孤街浪徒 2021-02-06 22:18

After changes to source and building with gradle in Android Studio (I/O preview) AI - 130.677228 the build fails with the following error:

Gradle: 
FAILURE: Buil         


        
10条回答
  •  眼角桃花
    2021-02-06 23:03

    Add:

    compileSdkVersion 17 to your buid.gradel file (below).

    And use version 3 of the plugin: com.android.tools.build:gradle:0.3 (or higher for future questions,etc)

    Edit: reference project I just created. Builds, signs,etc https://github.com/yegdroid/gradle_demo

    //
    // A basic Android application that follows all the conventions
    //
    buildscript {
        repositories {
            mavenCentral()
        }
        dependencies {
            classpath 'com.android.tools.build:gradle:0.3'
        }
    }
    apply plugin: 'android'
    
    android {
        testBuildType = "debug"
    
        defaultConfig {
            versionCode = 1
            versionName = "0.1"
            minSdkVersion = 9
            targetSdkVersion = 17
    
    
            compileSdkVersion 17
            buildConfig "private final static boolean DEFAULT = true;", \
                        "private final static String FOO = \"foo\";"
        }
    
        buildTypes {
            debug {
                packageNameSuffix = ".debug"
    
                buildConfig "private final static boolean DEBUG2 = false;"
            }
        }
    
        aaptOptions {
            noCompress "txt"
        }
        sourceSets {
              main {
                  manifest {
                      srcFile 'AndroidManifest.xml'
                  }
                  java {
                      srcDir 'src'
                  }
                  res {
                      srcDir 'res'
                  }
                  assets {
                      srcDir 'assets'
                  }
                  resources {
                      srcDir 'src'
                  }
              }
          }
    }
    

提交回复
热议问题