0

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:

screenshot of 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').
mokagio
  • 16,391
  • 3
  • 51
  • 58
Luuk D. Jansen
  • 4,402
  • 8
  • 47
  • 90
  • It looks, on the surface, to me that you could have some leftover IntelliJ files in your workspace that may be confusing it? – Eric Woodruff Feb 04 '14 at 16:52
  • That is what I was thinking. Any suggestions where to look, what to do? – Luuk D. Jansen Feb 04 '14 at 16:53
  • 2
    Move the .idea *.xml files out of the way? – Eric Woodruff Feb 04 '14 at 17:00
  • You really have to move all the old IDEA project stuff out and re-import from scratch. It'll re-create those files in the new system. – Scott Barta Feb 04 '14 at 18:10
  • Great. I did it another way, by removing all dependencies from the old project before converting o gradle. Any suggestions however how to properly add the play_services again? do I do it like I used to in IDEA? – Luuk D. Jansen Feb 04 '14 at 18:44
  • http://stackoverflow.com/questions/16624827/android-studio-with-google-play-services – Scott Barta Feb 04 '14 at 18:57
  • I ended up removing everything in my original project which was not code related, and imported the project then. That seemed to do the trick. Thanks Eric. Would you like to port a answer? – Luuk D. Jansen Feb 04 '14 at 22:16

0 Answers0