Reputation: 16857
I was trying to add the v4 support library in Android Studio.
My build.gradle lookes like this so far :
buildscript {
repositories {
mavenCentral()
}
dependencies {
classpath 'com.android.tools.build:gradle:0.9.+'
}
}
allprojects {
apply plugin: 'android'
android {
compileSdkVersion 19
buildToolsVersion "19.0.3"
}
repositories {
mavenCentral()
}
dependencies {
compile 'com.android.support:support-v4:18.0.+'
}
}
It started giving me the error (my project name is DataSharing-1):
AndroidStudioProjects/DataSharing-1/src/main/AndroidManifest.xml (No such file or directory)
I tried adding the following under 'android {' :
sourceSets {
main {
manifest.srcFile 'DataSharing-1/app/src/main/AndroidManifest.xml'
}
}
I get the error :
DataSharing-1/app/app/src/main/AndroidManifest.xml (No such file or directory)
If I change the srcFile to
'src/main/AndroidManifest.xml'
I get the error :
DataSharing-1/src/main/AndroidManifest.xml (No such file or directory)
My folder structure is :
AndroidStudioProjects/DataSharing-1/app/src/main/AndroidManifest.xml
Can someone suggest on how to resolve this problem ?
Upvotes: 1
Views: 4526
Reputation: 59671
The best way to add the support library to your project:
android
and dependencies
element).dependencies
add compile 'com.android.support:support-v4:+'
It should look as follows:
dependencies {
compile 'com.android.support:support-v4:+'
//... your previous existing dependencies after here
}
You can replace the +
symbol with a specific version, but the +
symbol is preferable since it ensures you will get the latest version of the library.
Upvotes: 1