Build error ,Gradle -> Error:Execution failed for task ':app:preDexDebug'. > org.gradle.process.internal.ExecException:

旧巷老猫 提交于 2019-12-23 01:43:26

问题


I use Android Studio.

Module App:

apply plugin: 'com.android.application'
android {
    compileSdkVersion 21
    buildToolsVersion '22.0.1'
    compileOptions {
        encoding "UTF-8"

    }
    defaultConfig {
        applicationId "com.my.app"
        minSdkVersion 10
        targetSdkVersion 22
        versionCode 1
        versionName '1'
    }
    buildTypes {
        release {
            minifyEnabled true
            proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
        }
    }
    productFlavors {
    }
}

dependencies {
    compile files('libs/volley.jar')
    compile 'com.google.android.gms:play-services:7.5.0'
}

Project com.my.app

// 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:1.2.3'

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

allprojects {
    repositories {
        jcenter()
    }
}

But I get this error:

error : Error:Execution failed for task ':app:preDexDebug'.
org.gradle.process.internal.ExecException: A problem occurred starting process 'command 'C:\Program
Files\Java\jdk1.8.0_45\bin\java.exe''

With gradlew compileDebug --stacktrace :

* Exception is:
org.gradle.execution.TaskSelectionException: Task 'compileDebug' is ambiguous in
 root project 'BillionsOfPeople'. Candidates are: 'compileDebugAidl', 'compileDe
bugAndroidTestAidl', 'compileDebugAndroidTestJava', 'compileDebugAndroidTestNdk'
, 'compileDebugAndroidTestRenderscript', 'compileDebugAndroidTestSources', 'comp
ileDebugJava', 'compileDebugNdk', 'compileDebugRenderscript', 'compileDebugSourc
es', 'compileDebugUnitTestJava', 'compileDebugUnitTestSources'.

 at org.gradle.launcher.bootstrap.ProcessBootstrap.run(ProcessBootstrap.java:35)
     at org.gradle.launcher.GradleMain.main(GradleMain.java:23)

    at org.gradle.wrapper.BootstrapMainStarter.start(BootstrapMainStarter.java:33)

     at org.gradle.wrapper.WrapperExecutor.execute(WrapperExecutor.java:130)

    at org.gradle.wrapper.GradleWrapperMain.main(GradleWrapperMain.java:48)

gradlew compileDebug :

FAILURE: Build failed with an exception.

  • What went wrong: Task 'compileDebug' is ambiguous in root project 'MyApp'. Candidates are: 'compileDebugAidl', 'compileDebugAndroidTestAidl', 'compileDebugAndroidTest Java', 'compileDebugAndroidTestNdk', 'compileDebugAndroidTestRenderscript', 'com pileDebugAndroidTestSources', 'compileDebugJava', 'compileDebugNdk', 'compileDeb ugRenderscript', 'compileDebugSources', 'compileDebugUnitTestJava', 'compileDebu gUnitTestSources'.

NOTE: I cannot run sdk manager.


回答1:


I think the problem is the value of your applicationId in the build.gradle. It should contain the fully qualified package name of your application because it will be the identifier used by the system to install your app. "/**/" looks like a really conflicting name for the dex packaging.



来源:https://stackoverflow.com/questions/31351191/build-error-gradle-errorexecution-failed-for-task-apppredexdebug-org

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!