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.
I think the problem is the value of your
applicationId
in thebuild.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.