I am having a hard time moving one of my projects to Gradle. The reason I want to do this is to be able to use build flavours.
I imported my existing IDEA project in Android studio and created the build.gradle file:
buildscript {
repositories {
mavenCentral()
}
dependencies {
classpath 'com.android.tools.build:gradle:0.7.+'
}
}
apply plugin: 'android'
dependencies {
compile 'com.google.android.gms:play-services:3.2.+'
}
android {
compileSdkVersion 19
buildToolsVersion "19.0.1"
sourceSets {
main {
manifest.srcFile 'AndroidManifest.xml'
java.srcDirs = ['src']
resources.srcDirs = ['src']
aidl.srcDirs = ['src']
renderscript.srcDirs = ['src']
res.srcDirs = ['res']
assets.srcDirs = ['assets']
}
// Move the tests to tests/java, tests/res, etc...
instrumentTest.setRoot('tests')
// 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')
}
}
However, I get the following errors two errors:
Unsupported Modules Detected: Compilation is not supported for following modules: idoms-android, tests. Unfortunately you can't have non-Gradle Java modules and Android-Gradle modules in one project.
and also
No resource found that matches the given name (at 'value' with value '@integer/google_play_services_version').
I don't know what module it is about, and don't know how to include play_services properly in Android Studio other than including it in the build. There seems to be nothing under my project structure:
Fixing the project structure seems to work (i.e. remove the two references) but next time they are back.
edit: This is the second error:
Execution failed for task ':processDebugResources'.
> com.android.ide.common.internal.LoggedErrorException: Failed to run command:
/Applications/Android Studio.app/sdk/build-tools/android-4.4.2/aapt package -f --no-crunch -I /Applications/Android Studio.app/sdk/platforms/android-19/android.jar -M /Users/.../build/manifests/debug/AndroidManifest.xml -S /Users/.../build/res/all/debug -A /Users/.../build/assets/debug -m -J /Users/.../build/source/r/debug -F /Users/.../build/libs/idoms-android-debug.ap_ --debug-mode --custom-package org.idoms.iDomsAndroid --output-text-symbols /Users/.../build/symbols/debug
Error Code:
1
Output:
/Users/.../build/manifests/debug/AndroidManifest.xml:40: error: Error: No resource found that matches the given name (at 'value' with value '@integer/google_play_services_version').