Error:Cause: buildToolsVersion is not specified

前端 未结 12 2267
慢半拍i
慢半拍i 2020-12-24 00:50

I create a simple project and then I right-click on the project and then I use the make mudole app option. Now I have two build.gradle folders: 1-

相关标签:
12条回答
  • 2020-12-24 01:08

    Android Project > setting.gradle

    include ':app' , ':xxx'
    

    I imported one of module and this coused this error. I remove it is fixed.

    include ':app'
    
    0 讨论(0)
  • 2020-12-24 01:10

    Add buildToolsVersion to your build.gradle file this will solve your problem.

    buildToolsVersion "27.0.1"

    Gradle file code

     android{
              compileSdkVersion 27
              buildToolsVersion "27.0.1"
              useLibrary 'org.apache.http.legacy'
            }
    
    0 讨论(0)
  • 2020-12-24 01:10

    Not really sure what the underlying problem was, but I found the solution in a concurrent problem that was occurring: https://stackoverflow.com/a/32490472/1544046

    Essentially, I had to change my gradle target to use the wrapper and not a defined path. I've had it set to the Gradle Wrapper in the past, but it seems to revert from time to time without notice. Once I switched back and recompiled it worked fine.

    In the project's settings: Build, Execution, Deployment->Build Tools->Gradle and select "Use default gradle wrapper".

    0 讨论(0)
  • 2020-12-24 01:11

    The issue for me was that andorid-versionCode can only be integer value. in build.xml:

    eg:android-versionCode="1"

    It cannot be "1.1" etc... The error code is not helpful at all.

    0 讨论(0)
  • 2020-12-24 01:13

    Check if android studio version in build.gradle is same as the one you are running.

    buildscript {
    
       repositories {
           google()
           jcenter()
       }
     dependencies {
        classpath 'com.android.tools.build:gradle:3.0.0'
    
    
        // NOTE: Do not place your application dependencies here; they belong
        // in the individual module build.gradle files
      }
    }   
    

    In my case, I opened/imported the project created on android studio 2.3.3 in android studio 3 and i was able to get rid of this issue after updating the build.gradle with 3.0.0

    0 讨论(0)
  • 2020-12-24 01:15

    in file... build.gradle(Project: XXX):

    repositories{
         //put pluging repository here
         //e.g.:
         mavenCentral()
    }
    dependencies{
         //classpath to plugin here
         classpath 'com.XXXX.xXXxxXX.XXXX' 
    }
    

    in file.... build.gradle(Module: app)

    //add on top:
    apply plugin: 'com.YOUR.PLUGIN.XXX'
    
    0 讨论(0)
提交回复
热议问题