1

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.

UtopiaIsGood
  • 169
  • 3
  • 15

1 Answers1

0

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.

droidpl
  • 5,872
  • 4
  • 35
  • 47
  • 2
    This error is quite generic and can have tons of sources. Please provide more context of what are you doing, how is the architecture of this app, which are other build.gradle files and so. Update accordingly the applicationId in the question – droidpl Jul 10 '15 at 22:28
  • 1
    The gradle stacktrace is not fully qualified so I can't see if the error is a NullPointer or another thing. – droidpl Jul 10 '15 at 22:43
  • And are you sure there is no more info about the execution error with the JDK route? – droidpl Jul 10 '15 at 22:45
  • I had "gradlew compileDebug" section. – UtopiaIsGood Jul 10 '15 at 22:54
  • Let us [continue this discussion in chat](http://chat.stackoverflow.com/rooms/83004/discussion-between-feantury-and-utopiaisgood). – droidpl Jul 10 '15 at 22:59