Does anyone has any good step by step tutorial for integrating gradle with android studio. I am following this official google docs for setting up gradle:
http://tools.android.com/tech-docs/new-build-system/user-guide#TOC-Simple-build-files and so far gradle keeps complaining at each step. I am not even sure about how the build.gradle file should look like for a simple hello world application. This is my current build.gradle file:
buildscript {
repositories {
mavenCentral()
}
dependencies {
classpath 'com.android.tools.build:gradle:0.5.6'
}
}
apply plugin: 'android'
android {
compileSdkVersion 17
}
android {
buildToolsVersion "17.0"
compileSdkVersion 17
}
Gradle is throwing the following error:
Error Code:
1
Output:
/Users/xxx/Downloads/MyApplication/App/build/res/all/debug/values/values.xml:12: error: Error retrieving parent for item: No resource found that matches the given name 'Theme.AppCompat.Light.DarkActionBar'.
I am a newbie with respect to gradle. Any help is appreciated. Thanks
About your error message: No resource found that matches the given name 'Theme.AppCompat.Light.DarkActionBar'.
You are using the ActionBarCompat style. So you have to add this dependency to your script. Add:
dependencies {
// Support Libraries
compile 'com.android.support:appcompat-v7:19.0.0'
}
In order to use it you have to download the last support-appcompat. Open your SDK Manager and install/update the Android Support Repository, Android Support Library v19.
Also I suggest you to update your script with the last versions. Use Android Studio 0.4.0.
buildscript {
repositories {
mavenCentral()
}
dependencies {
classpath 'com.android.tools.build:gradle:0.7.+'
}
}
apply plugin: 'android'
repositories {
mavenCentral()
}
android {
compileSdkVersion 19
buildToolsVersion "19.0.0"
defaultConfig {
minSdkVersion XX //Insert here your level
targetSdkVersion 19
}
}
dependencies {
// Support Libraries
compile 'com.android.support:appcompat-v7:19.0.0'
}
你没有添加编译com.android.support:appcompat-v7:21.0.3
或你的兼容版本。
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.