In almost all cases, your dependencies should be put into the individual module’s build.gradle files rather than at the top most level build.gradle file. In your case, that means the dependency should be added to the app
module’s build.gradle file:
dependencies {
compile fileTree(dir: 'libs', include: ['*.jar'])
compile "com.android.support:support-v4:18.0.+"
}
And you should remove the entire allprojects
part of the top level build.gradle.