android 工作室构建失败
Build failure in android studio
我在 gradle 在线时遇到这个错误。
Error:Gradle:
FAILURE: Build failed with an exception.
* What went wrong:
Task 'testClasses' not found in project ':ProwessPride_V1.01'.
* Try:
Run gradle tasks to get a list of available tasks. Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output.
其中 ProwessPride_V1.01 是我包含在项目中的 jar 文件。
我在工作室做 Invalidate Caches/Restart。也重建和清理项目,但我无法解决此错误。所以请帮助我如何解决它。
build.gradle
apply plugin: 'com.android.application'
android {
compileSdkVersion 23
buildToolsVersion "23.0.0"
defaultConfig {
applicationId "com.example.technopits.dcn"
minSdkVersion 17
targetSdkVersion 23
versionCode 1
versionName "1.0"
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
}
dependencies {
compile fileTree(include: ['*.jar'], dir: 'libs')
compile 'com.android.support:appcompat-v7:23.0.0'
compile 'com.android.support:recyclerview-v7:23.0.0'
compile 'org.jbundle.util.osgi.wrapped:org.jbundle.util.osgi.wrapped.org.apache.http.client:4.1.2'
compile 'com.google.android.gms:play-services-gcm:7.3.0'
compile project(':ProwessPride_V1.01')
}
buil.gradle 项目
// 顶级构建文件,您可以在其中添加所有 sub-projects/modules.
通用的配置选项
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()
}
}
按照以下步骤操作:
- 撤消添加库时所做的任何更改(删除任何依赖项或 JAR)
- 将 jar 文件拖放到 libs 文件夹中(在 android studio 中)
- 清理构建
正在定义 compile project(':ProwessPride_V1.01')
,gradle 正在 settings.gradle
.
中搜索具有相同名称的 项目
既然是jar就错了
只需删除此行。
compile project(':ProwessPride_V1.01')
如果你在libs文件夹中添加jar,这一行就足够了。
compile fileTree(include: ['*.jar'], dir: 'libs')
我在 gradle 在线时遇到这个错误。
Error:Gradle:
FAILURE: Build failed with an exception.
* What went wrong:
Task 'testClasses' not found in project ':ProwessPride_V1.01'.
* Try:
Run gradle tasks to get a list of available tasks. Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output.
其中 ProwessPride_V1.01 是我包含在项目中的 jar 文件。
我在工作室做 Invalidate Caches/Restart。也重建和清理项目,但我无法解决此错误。所以请帮助我如何解决它。
build.gradle
apply plugin: 'com.android.application'
android {
compileSdkVersion 23
buildToolsVersion "23.0.0"
defaultConfig {
applicationId "com.example.technopits.dcn"
minSdkVersion 17
targetSdkVersion 23
versionCode 1
versionName "1.0"
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
}
dependencies {
compile fileTree(include: ['*.jar'], dir: 'libs')
compile 'com.android.support:appcompat-v7:23.0.0'
compile 'com.android.support:recyclerview-v7:23.0.0'
compile 'org.jbundle.util.osgi.wrapped:org.jbundle.util.osgi.wrapped.org.apache.http.client:4.1.2'
compile 'com.google.android.gms:play-services-gcm:7.3.0'
compile project(':ProwessPride_V1.01')
}
buil.gradle 项目
// 顶级构建文件,您可以在其中添加所有 sub-projects/modules.
通用的配置选项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()
}
}
按照以下步骤操作:
- 撤消添加库时所做的任何更改(删除任何依赖项或 JAR)
- 将 jar 文件拖放到 libs 文件夹中(在 android studio 中)
- 清理构建
正在定义 compile project(':ProwessPride_V1.01')
,gradle 正在 settings.gradle
.
既然是jar就错了
只需删除此行。
compile project(':ProwessPride_V1.01')
如果你在libs文件夹中添加jar,这一行就足够了。
compile fileTree(include: ['*.jar'], dir: 'libs')