dev*_*per 60 android android-studio
我创建一个简单的项目,然后右键单击该项目,然后我使用该make mudole app选项.现在我有两个build.gradle文件夹:1- build.gradle:project My Application.2- build.gradle: Mudole app.第一个build.gradle如下:
// Top-level build file where you can add configuration options common to all sub-projects/modules.
apply plugin: 'com.android.library'
buildscript {
repositories {
jcenter()
}
dependencies {
classpath 'com.android.tools.build:gradle:1.3.0'
// NOTE: Do not place your application dependencies here; they belong
// in the individual module build.gradle files
}
}
allprojects {
repositories {
jcenter()
}
}
Run Code Online (Sandbox Code Playgroud)
第二个Build.gradle文件夹如下:
apply plugin: 'com.android.application'
android {
compileSdkVersion 23
buildToolsVersion "23.0.0"
defaultConfig {
applicationId "com.exam.exam.myapplication"
minSdkVersion 7
targetSdkVersion 23
versionCode 1
versionName "1.0"
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
}
dependencies {
compile fileTree(dir: 'libs', include: ['*.jar'])
}
Run Code Online (Sandbox Code Playgroud)
现在我点击run选项aar从这个项目创建文件但是我收到以下错误:
Error:Cause: buildToolsVersion is not specified.
Run Code Online (Sandbox Code Playgroud)
Aks*_*hay 80
我遇到过同样的问题.我做错了是将apply plugin语句放在项目的根gradle中.当我把它放在app gradle中时,问题就解决了.
我建议的是检查你是否在根gradle中放置了一些你应该放在app gradle中的语句.
Sag*_*gar 10
添加buildToolsVersion到您的build.gradle文件,这将解决您的问题.
buildToolsVersion "27.0.1"
Gradle文件代码
android{
compileSdkVersion 27
buildToolsVersion "27.0.1"
useLibrary 'org.apache.http.legacy'
}
Run Code Online (Sandbox Code Playgroud)
将buildToolsVersion属性添加到本地build.gradle文件.
android {
compileSdkVersion 27
buildToolsVersion "26.0.1"
defaultConfig {
targetSdkVersion 27
}
}
Run Code Online (Sandbox Code Playgroud)
根据您的要求!! 然后尝试构建 - >您将获得构建失败和此消息:
无法找到Build Tools修订版26.0.1
安装Build Tools 26.0.1并同步项目
然后单击以安装构建工具,您的项目已配置好,您就可以开始了!
小智 7
在文件... build.gradle(项目:XXX):
repositories{
//put pluging repository here
//e.g.:
mavenCentral()
}
dependencies{
//classpath to plugin here
classpath 'com.XXXX.xXXxxXX.XXXX'
}
Run Code Online (Sandbox Code Playgroud)
在文件.... build.gradle(模块:app)
//add on top:
apply plugin: 'com.YOUR.PLUGIN.XXX'
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
87239 次 |
| 最近记录: |