2014-04-07 7 views
6

मैंने अपने जार * पुस्तकालयों को हटाने की कोशिश की और उन्हें मैवेन-रिपोजिटरी-निर्भरताओं के रूप में जोड़ें। यह बहुत ही आशाजनक लग रहा है, लेकिन मैं इसे करने में सक्षम नहीं हूं। मैं एक भी पुस्तकालय (gson) के साथ यह परीक्षण किया है और अब मेरे gradle.build इस तरह दिखता है:एंड्रॉइड/ग्रेडल: भंडार का उपयोग करने में सक्षम नहीं

buildscript { 
    repositories { 
     mavenCentral() 
    } 
    dependencies { 
     classpath 'com.android.tools.build:gradle:0.5.+' 
    } 
} 
apply plugin: 'android' 

dependencies { 
    compile fileTree(dir: 'libs', include: '*.jar') 
compile 'com.google.code.gson:gson:2.2.4' 
} 

android { 
    compileSdkVersion 18 
    buildToolsVersion "18.1.0" 

    defaultConfig { 
    minSdkVersion 10 
    targetSdkVersion 18 
} 

sourceSets { 
     main { 
      manifest.srcFile 'AndroidManifest.xml' 
      java.srcDirs = ['src'] 
      resources.srcDirs = ['src'] 
      aidl.srcDirs = ['src'] 
      renderscript.srcDirs = ['src'] 
      res.srcDirs = ['res'] 
      assets.srcDirs = ['assets'] 
     } 

     instrumentTest.setRoot('tests') 
     debug.setRoot('build-types/debug') 
     release.setRoot('build-types/release') 
    } 
} 

लेकिन एक सरल sudo gradle build रिटर्न निम्न त्रुटि:

FAILURE: Build failed with an exception. 

* What went wrong: 
A problem occurred configuring root project 'android'. 
> Failed to notify project evaluation listener. 
    > Could not resolve all dependencies for configuration ':_DebugCompile'. 
     > Could not find com.google.code.gson:gson:2.2.4. 
     Required by: 
      :android:unspecified 

* Try: 
Run with --stacktrace option to get the stack trace. Run with 
--info or --debug option to get more log output. 

BUILD FAILED 

Total time: 3.541 secs 

मैं इंटरनेट से जुड़ा रहा हूँ और मैं उबंटू का उपयोग कर रहा हूँ।

repositories { 
    mavenCentral() 
} 

apply plugin: 'android' रूप में एक ही स्तर पर:

उत्तर

14

जोड़ने की कोशिश करो।

+0

बढ़िया! एक जादू की तरह काम करता है :) – NaN

संबंधित मुद्दे