xingCome 2018-02-05 08:07 采纳率: 0%
浏览 3873
已结题

Execution failed for task 'packageDebug'.

Warning:Ignoring Android API artifact com.google.android:android:2.1_r1 for debug
Error:Execution failed for task ':xxx:packageDebug'.

android/util/Log
Information:BUILD FAILED

直接在android studio里面启动或者debug就会产生上面的错误,但是能通过gradle命令安装到手机上,请问哪位大侠雨果这个错我,请告知一下,谢谢

主Module的build.gradle配置

//repositories {
// mavenLocal()
// mavenCentral()
//}

android {
// useLibrary 'org.apache.http.legacy'
buildTypes {
release {
minifyEnabled true
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
debug {
// multiDexEnabled true
}
}
packagingOptions {
exclude 'META-INF/DEPENDENCIES'
exclude 'META-INF/NOTICE'
exclude 'META-INF/LICENSE'
exclude 'META-INF/LICENSE.txt'
exclude 'META-INF/NOTICE.txt'
}
}

configurations {
all {
exclude module: 'httpclient'
exclude module: 'commons-logging'
}
}
dependencies {
compile 'com.google.protobuf:protobuf-java:2.5.0'
compile 'com.android.support:appcompat-v7:19.+'
compile 'com.nineoldandroids:library:2.4.+'
compile 'com.google.zxing:core:3.1.0@jar'
compile 'com.android.support:multidex:1.0.0'
compile('com.github.tony19:logback-android-classic:1.0.10-2@jar') {
// Work around for gradle 0.9 and 0.10
transitive = true
}
// compile project(':bitherj')
compile (project(':bitherj')){
exclude group: 'org.json', module: 'json'
exclude group: 'com.google.android'
}
// compile ('com.github.nkzawa:socket.io-client:0.4.1'){
// exclude group: 'org.json', module: 'json'
// }
compile project(':wheel')
compile project(':android-charts')
//加入日志依赖
// compile 'org.slf4j:slf4j-api:1.7.25'
}

整个项目的build.gradle

apply plugin: 'com.android.library'

buildscript {
repositories {
jcenter()
mavenCentral()
// maven {
// url 'https://maven.google.com/'
// name 'Google'
// }
}
dependencies {
// classpath 'com.android.tools.build:gradle:2.3.2'
// classpath 'com.android.tools.build:gradle:3.0.0'
classpath 'com.android.tools.build:gradle:2.2.2'
}
}

project(':bither-android') {
apply plugin: 'android'
}
project(':wheel') {
apply plugin: 'com.android.library'
}
project(':android-charts') {
apply plugin: 'com.android.library'
}
project(':bitherj') {
apply plugin: 'java'
}
subprojects {

android {
    compileSdkVersion 22
    buildToolsVersion '26.0.2'
    defaultConfig {

// minSdkVersion 9
minSdkVersion 15
targetSdkVersion 22
multiDexEnabled true
}

    dexOptions {
        preDexLibraries = false
        additionalParameters = ['--core-library']
    }

    sourceSets {
        main {
            manifest.srcFile 'AndroidManifest.xml'
            java.srcDirs = ['src']
            res.srcDirs = ['res']
            assets.srcDirs = ['assets']
            jniLibs.srcDirs = ['native-libs']
            jni.srcDirs = []
        }

        // Move the build types to build-types/<type>
        // For instance, build-types/debug/java, build-types/debug/AndroidManifest.xml, ...
        // This moves them out of them default location under src/<type>/... which would
        // conflict with src/ being used by the main source set.
        // Adding new build types or product flavors should be accompanied
        // by a similar customization.
        debug.setRoot('build-types/debug')
        release.setRoot('build-types/release')
    }
    packagingOptions {
        exclude 'META-INF/NOTICE.txt'
        exclude 'META-INF/LICENSE.txt'
        exclude 'META-INF/NOTICE'
        exclude 'META-INF/LICENSE'
        exclude 'META-INF/DEPENDENCIES'
        exclude 'org/apache/http/entity/mime/version.properties'
        exclude 'org/apache/http/version.properties'
        exclude 'lib/x86_64/darwin/libscrypt.dylib'
        exclude 'lib/x86_64/freebsd/libscrypt.so'
        exclude 'lib/x86_64/linux/libscrypt.so'
    }
    lintOptions {
        abortOnError false
        disable "ResourceType"
    }
}

}
//repositories {
// maven {
// url 'https://maven.google.com/'
// name 'Google'
// }
//}
allprojects {
repositories {
jcenter()
maven {
url 'https://maven.google.com'
}
}
}

  • 写回答

1条回答 默认 最新

  • 白萝卜。 2018-02-05 10:02
    关注

    你编译都不通过,居然能安装?你用gradle命令 安装到手机应该是只是把apk复制到手机上吧,所以安装命令并不能证明编译没问题吧,可以贴出来gradle和,setting下的compile子项 看下啥情况。

    评论

报告相同问题?

悬赏问题

  • ¥15 用三极管设计—个共射极放大电路
  • ¥15 请完成下列相关问题!
  • ¥15 drone 推送镜像时候 purge: true 推送完毕后没有删除对应的镜像,手动拷贝到服务器执行结果正确在样才能让指令自动执行成功删除对应镜像,如何解决?
  • ¥15 求daily translation(DT)偏差订正方法的代码
  • ¥15 js调用html页面需要隐藏某个按钮
  • ¥15 ads仿真结果在圆图上是怎么读数的
  • ¥20 Cotex M3的调试和程序执行方式是什么样的?
  • ¥20 java项目连接sqlserver时报ssl相关错误
  • ¥15 一道python难题3
  • ¥15 牛顿斯科特系数表表示