Import tests from eclipse to android studio

121 views Asked by At

I have an android application with following project structure in eclipse: Myapp -src -assets -res -libs -tests --res --src --assests --AndroidManifest.xml(this is for tests) -AndroidManifest.xml(this is for main)

I am able to import and build the project from eclipse to studio. But, not able to import the tests from eclipse to studio. I am using the import option in studio and pointing to main project 'Myapp' which has manifest file.

My build.gradle looks like :

sourceSets {
        main {
            manifest.srcFile 'AndroidManifest.xml'
            java.srcDirs = ['src']
            resources.srcDirs = ['src']
            aidl.srcDirs = ['src']
            renderscript.srcDirs = ['src']
            res.srcDirs = ['res']
            assets.srcDirs = ['assets']
        }

        //instrumentTest.setRoot('src/test')
        test {
            androidTest.setRoot('test')
        }
        // 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')
    }

Any help how to modify the build.gradle so that I can get the test folder in my studio and build it using gradle ?

0

There are 0 answers