2014-04-07 3 views
6

내 jar 라이브러리를 제거하고 maven-repository-dependencies로 추가하려고했습니다. 그것은 매우 유망 해 보이지만 그것을 할 수는 없습니다. 나는 하나의 라이브러리 (GSON)와 함께 테스트 지금 내 gradle.build은 다음과 같습니다Android/gradle : 리포지토리를 사용할 수 없습니다.

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

관련 문제