Maven Dependencies with Android Studio / Gradle -


i using gradle build system bundled android studio. far, able build multi-project setups using dependencies stored in project structure. use maven dependency, no avail. have written simple build.gradle file fails :

    buildscript {         repositories {             maven { url 'http://repo1.maven.org/maven2' }         }         dependencies {             classpath 'com.android.tools.build:gradle:0.4'         }     }     apply plugin: 'android'      dependencies {         compile 'com.google.android:support-v4:r7'     }      android {         compilesdkversion 17         buildtoolsversion "17.0.0"          defaultconfig {             minsdkversion 7             targetsdkversion 16         }     } 

with following message :

    * went wrong:         problem occurred configuring project ':absabs'.         > failed notify project evaluation listener.            > not resolve dependencies configuration ':absabs:compile'.               > not find com.google.android:support-v4:r7.                 required by:                     absabs:absabs:unspecified .... caused by: org.gradle.api.internal.artifacts.ivyservice.moduleversionnotfoundexception: not find com.google.android:support-v4:r7. 

it happens artifact have tried far. idea of what's wrong ?

thanks

the "repositories" block in buildscript section applies build environment. need specify repository use when resolving dependencies building project, need put following in build.gradle file:

repositories {     mavencentral() } 

your complete file this:

buildscript {     repositories {         maven { url 'http://repo1.maven.org/maven2' }     }     dependencies {         classpath 'com.android.tools.build:gradle:0.4'     } } apply plugin: 'android'  repositories {     mavencentral() }  dependencies {     compile 'com.google.android:support-v4:r7' }  android {     compilesdkversion 17     buildtoolsversion "17.0.0"      defaultconfig {         minsdkversion 7         targetsdkversion 16     } } 

note 2 instances of "repositories". can read more means in the gradle docs.


Comments

Popular posts from this blog

blackberry 10 - how to add multiple markers on the google map just by url? -

php - guestbook returning database data to flash -

delphi - Dynamic file type icon -