【问题标题】:2 errors at build gradle in Android StudioAndroid Studio 中构建 gradle 的 2 个错误
【发布时间】:2017-01-10 09:28:37
【问题描述】:

大家好,阅读这篇文章的人,我正在尝试一种方法,它说我在我的 gradle.build 中需要它:compile 'org.apache.ant:ant:1.8.0' 然后我尝试构建我的 gradle,但它不起作用。好吧,所以我从我的 gradle 中删除了它,它让我一直说我在编译我的 gradle 时遇到了这个错误:

Executing tasks: [:app:generateDebugSources, :app:mockableAndroidJar, :app:prepareDebugUnitTestDependencies, :app:generateDebugAndroidTestSources]

Configuration on demand is an incubating feature.
Incremental java compilation is an incubating feature.
:app:preBuild UP-TO-DATE
:app:preDebugBuild UP-TO-DATE
:app:checkDebugManifest
:app:preReleaseBuild UP-TO-DATE
:app:prepareComAndroidSupportAnimatedVectorDrawable2421Library UP-TO-DATE
:app:prepareComAndroidSupportAppcompatV72421Library UP-TO-DATE
:app:prepareComAndroidSupportConstraintConstraintLayout100Alpha9Library UP-TO-DATE
:app:prepareComAndroidSupportDesign2421Library UP-TO-DATE
:app:prepareComAndroidSupportMediarouterV72400Library UP-TO-DATE
:app:preDebugAndroidTestBuild UP-TO-DATE
:app:prepareComAndroidSupportMultidex101Library UP-TO-DATE
:app:prepareComAndroidSupportPaletteV72400Library UP-TO-DATE
:app:prepareComAndroidSupportRecyclerviewV72421Library UP-TO-DATE
:app:prepareComAndroidSupportSupportCompat2421Library UP-TO-DATE
:app:prepareComAndroidSupportSupportCoreUi2421Library UP-TO-DATE
:app:prepareComAndroidSupportSupportCoreUtils2421Library UP-TO-DATE
:app:prepareComAndroidSupportSupportFragment2421Library UP-TO-DATE
:app:prepareComAndroidSupportSupportMediaCompat2421Library UP-TO-DATE
:app:prepareComAndroidSupportSupportV42421Library UP-TO-DATE
:app:prepareComAndroidSupportSupportVectorDrawable2421Library UP-TO-DATE
:app:prepareComAndroidVolleyVolley100Library UP-TO-DATE
:app:prepareComGoogleAndroidGmsPlayServices961Library UP-TO-DATE
:app:prepareComGoogleAndroidGmsPlayServicesAds961Library UP-TO-DATE
:app:prepareComGoogleAndroidGmsPlayServicesAdsLite961Library UP-TO-DATE
:app:prepareComGoogleAndroidGmsPlayServicesAnalytics961Library UP-TO-DATE
:app:prepareComGoogleAndroidGmsPlayServicesAnalyticsImpl961Library UP-TO-DATE
:app:prepareComGoogleAndroidGmsPlayServicesAppindexing961Library UP-TO-DATE
:app:prepareComGoogleAndroidGmsPlayServicesAppinvite961Library UP-TO-DATE
:app:prepareComGoogleAndroidGmsPlayServicesAuth961Library UP-TO-DATE
:app:prepareComGoogleAndroidGmsPlayServicesAuthBase961Library UP-TO-DATE
:app:prepareComGoogleAndroidGmsPlayServicesAwareness961Library UP-TO-DATE
:app:prepareComGoogleAndroidGmsPlayServicesBase961Library UP-TO-DATE
:app:prepareComGoogleAndroidGmsPlayServicesBasement961Library UP-TO-DATE
:app:prepareComGoogleAndroidGmsPlayServicesCast961Library UP-TO-DATE
:app:prepareComGoogleAndroidGmsPlayServicesCastFramework961Library UP-TO-DATE
:app:prepareComGoogleAndroidGmsPlayServicesClearcut961Library UP-TO-DATE
:app:prepareComGoogleAndroidGmsPlayServicesDrive961Library UP-TO-DATE
:app:prepareComGoogleAndroidGmsPlayServicesFitness961Library UP-TO-DATE
:app:prepareComGoogleAndroidGmsPlayServicesGames961Library UP-TO-DATE
:app:prepareComGoogleAndroidGmsPlayServicesGass961Library UP-TO-DATE
:app:prepareComGoogleAndroidGmsPlayServicesGcm961Library UP-TO-DATE
:app:prepareComGoogleAndroidGmsPlayServicesIdentity961Library UP-TO-DATE
:app:prepareComGoogleAndroidGmsPlayServicesIid961Library UP-TO-DATE
:app:prepareComGoogleAndroidGmsPlayServicesInstantapps961Library UP-TO-DATE
:app:prepareComGoogleAndroidGmsPlayServicesLocation961Library UP-TO-DATE
:app:prepareComGoogleAndroidGmsPlayServicesMaps961Library UP-TO-DATE
:app:prepareComGoogleAndroidGmsPlayServicesNearby961Library UP-TO-DATE
:app:prepareComGoogleAndroidGmsPlayServicesPanorama961Library UP-TO-DATE
:app:prepareComGoogleAndroidGmsPlayServicesPlaces961Library UP-TO-DATE
:app:prepareComGoogleAndroidGmsPlayServicesPlus961Library UP-TO-DATE
:app:prepareComGoogleAndroidGmsPlayServicesSafetynet961Library UP-TO-DATE
:app:prepareComGoogleAndroidGmsPlayServicesTagmanager961Library UP-TO-DATE
:app:prepareComGoogleAndroidGmsPlayServicesTagmanagerApi961Library UP-TO-DATE
:app:prepareComGoogleAndroidGmsPlayServicesTasks961Library UP-TO-DATE
:app:prepareComGoogleAndroidGmsPlayServicesVision961Library UP-TO-DATE
:app:prepareComGoogleAndroidGmsPlayServicesWallet961Library UP-TO-DATE
:app:prepareComGoogleAndroidGmsPlayServicesWearable961Library UP-TO-DATE
:app:prepareComGoogleFirebaseFirebaseAnalytics961Library UP-TO-DATE
:app:prepareComGoogleFirebaseFirebaseAnalyticsImpl961Library UP-TO-DATE
:app:prepareComGoogleFirebaseFirebaseAuth961Library UP-TO-DATE
:app:prepareComGoogleFirebaseFirebaseAuthCommon961Library UP-TO-DATE
:app:prepareComGoogleFirebaseFirebaseAuthModule961Library UP-TO-DATE
:app:prepareComGoogleFirebaseFirebaseCommon961Library UP-TO-DATE
:app:prepareComGoogleFirebaseFirebaseConfig961Library UP-TO-DATE
:app:prepareComGoogleFirebaseFirebaseCore961Library UP-TO-DATE
:app:prepareComGoogleFirebaseFirebaseCrash961Library UP-TO-DATE
:app:prepareComGoogleFirebaseFirebaseDatabase961Library UP-TO-DATE
:app:prepareComGoogleFirebaseFirebaseDatabaseConnection961Library UP-TO-DATE
:app:prepareComGoogleFirebaseFirebaseIid961Library UP-TO-DATE
:app:prepareComGoogleFirebaseFirebaseMessaging961Library UP-TO-DATE
:app:prepareComGoogleFirebaseFirebaseStorage961Library UP-TO-DATE
:app:prepareComGoogleFirebaseFirebaseStorageCommon961Library UP-TO-DATE
:app:prepareDebugDependencies
:app:compileDebugAidl UP-TO-DATE
:app:compileDebugRenderscript UP-TO-DATE
:app:generateDebugBuildConfig UP-TO-DATE
:app:generateDebugResValues UP-TO-DATE
:app:processDebugGoogleServices
Parsing json file: C:\Users\Rafa\AndroidStudioProjects\XabiaGame\app\google-services.json
:app:generateDebugResources
:app:mergeDebugResources
Error: java.util.concurrent.ExecutionException: com.android.ide.common.process.ProcessException: 
:app:mergeDebugResources FAILED

FAILURE: Build failed with an exception.

* What went wrong:
Execution failed for task ':app:mergeDebugResources'.
> Error: java.util.concurrent.ExecutionException: com.android.ide.common.process.ProcessException: 

* Try:
Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output.

BUILD FAILED

我试图将我的所有服务都更新到最新版本,我的意思是 10.0.1,但它让我一直在说同样的话......

查看我的 gradle 项目:

   apply plugin: 'com.android.application'


android {
    compileSdkVersion 24
    buildToolsVersion "24.0.3"
    defaultConfig {
        applicationId "com.example.informatica.xabiagame"
        minSdkVersion 15
        targetSdkVersion 24
        versionCode 1
        versionName "1.0"
        testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
        multiDexEnabled true

        jackOptions {
            enabled true
        }
    }
buildTypes {
    release {
        minifyEnabled false
        proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
    }
    /*repositories {
        maven { url 'https://oss.sonatype.org/content/repositories/ksoap2-android-releases/' }
    }*/
}
compileOptions {
    sourceCompatibility JavaVersion.VERSION_1_8
    targetCompatibility JavaVersion.VERSION_1_8
}
}
dependencies {
    compile fileTree(include: ['*.jar'], dir: 'libs')
    androidTestCompile('com.android.support.test.espresso:espresso-core:2.2.2', {
        exclude group: 'com.android.support', module: 'support-annotations'
    })
    compile 'com.android.support:appcompat-v7:24.2.1'
    compile 'com.android.support.constraint:constraint-layout:1.0.0-alpha9'
    compile 'com.android.support:design:24.2.1'
    compile 'com.google.android.gms:play-services-maps:9.6.1'
    compile 'com.google.android.gms:play-services-ads:9.6.1'
    compile 'com.google.android.gms:play-services:9.6.1'
    testCompile 'junit:junit:4.12'
    compile 'com.google.android.gms:play-services-auth:9.6.1'
    compile 'com.google.code.gson:gson:2.2.2'
    compile 'com.android.volley:volley:1.0.0'
    //compile 'org.apache.ant:ant:1.8.0'
}

apply plugin: 'com.google.gms.google-services'

________________________________-

添加了我的项目 gradle 项目

    // Top-level build file where you can add configuration options common to all sub-projects/modules.

buildscript {
    repositories {
        jcenter()
    }
    dependencies {
        classpath 'com.android.tools.build:gradle:2.2.3'
        classpath 'com.google.gms:google-services:3.0.0'

        // NOTE: Do not place your application dependencies here; they belong
        // in the individual module build.gradle files
    }
}

allprojects {
    repositories {
        jcenter()
    }
}

task clean(type: Delete) {
    delete rootProject.buildDir
}

有什么问题?它让我每次都说同样的话...谢谢。

我添加一个截图:

Error

【问题讨论】:

  • 已尝试文件 --> 使缓存无效/在 android studio 中重新启动
  • 让我说同样的话@MaharithAdityaSS
  • @siva35 我尝试了一个新版本的谷歌服务,但没有用
  • @siva35 它构建成功,但现在我正在等待构建我的项目以查看它的内容,谢谢

标签: java android exception android-gradle-plugin build.gradle


【解决方案1】:

在你的模块 build.gradle 上尝试代码:

android {
 compileSdkVersion 24
    buildToolsVersion "24.0.3"
    defaultConfig {
        applicationId "com.example.informatica.xabiagame"
        minSdkVersion 15
        targetSdkVersion 24
        versionCode 1
        versionName "1.0"
        testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
        multiDexEnabled true

        jackOptions {
            enabled true
        }
// ...
aaptOptions.cruncherEnabled = false
aaptOptions.useNewCruncher = false
// ...
}

【讨论】:

    【解决方案2】:

    您已经注释掉了 repositories 块,所以 Gradle 不知道在哪里可以找到该库。确保您有这样的存储库块:

    repositories {
        jcenter()
    }
    

    【讨论】:

    • 谢谢你的回答,但它让我一直说同样的话。我已经添加了,在 :app:mergeDebugResources 它让我失望了......而且我想我有一个想法,但不起作用..
    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2018-04-10
    • 2019-01-14
    • 2013-05-13
    • 2015-02-06
    • 2016-08-05
    • 2017-03-25
    相关资源
    最近更新 更多