Why won't Android Support Libraries work in my project?

天大地大妈咪最大 提交于 2019-12-05 06:25:01

I think you're placing these lines in the wrong file.

They should go in the module's build.gradle file, not in the project's one (which this would seem to be, from the screenshot).

Also, the dependencies tag should not be a child of anything else. something like:

apply plugin: 'com.android.application'

android {
    compileSdkVersion 20
    ...
}

dependencies {
    compile fileTree(dir: 'libs', include: ['*.jar'])
    compile "com.android.support:support-v4:18.0.+"
    ...
}

EDIT Did you see the comment? :)

// NOTE: Do not place your application dependencies here; they belong
// in the individual module build.gradle files

My problem was that after letting Android Studio upgrade the Gradle plugin to the latest version, it had messed up the dependency section of my module's build file. It had concatenated the dependency declaration lines together (except for the lines that were mere comments). Separating the lines (placing each dependency declaration in a single line) fixed the issue.

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!