解决Exlipse工程转为Studio不能引用依赖的问题

从exlipse转过来的studio的时候就是多了一个build.gradle文件,其实就是将studio的根build和模块build和在一起,而少了allprojects选项,所以就不支持了,加上就好了

allprojects {
    repositories {
        jcenter {
            url "https://jcenter.bintray.com/"
        }
        maven  {
            url "https://repo1.maven.org/maven2"
        }
    }
}
buildscript {
    repositories {
        mavenCentral()
        jcenter{}
    }
    dependencies {
        classpath 'com.android.tools.build:gradle:2.3.1'
    }
}
apply plugin: 'android'
dependencies {
    compile fileTree(dir: 'libs', include: '*.jar')
    compile 'com.liuguodong:buglib:1.0.3'
}

android {
    compileSdkVersion 21
    buildToolsVersion '25.0.0'

    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')
        compileOptions {
            encoding "GBK"
        }
    }
}





猜你喜欢

转载自blog.csdn.net/liu3364575/article/details/79168795