2016-03-18 16 views
0

私はアプリケーションと開発環境でアンドロイドライブラリを持っています。プロジェクトレベルの依存関係を提供したいと思います。つまり、 (Project:XXX)build.gradleファイル。 これは私がエラーGradle DSL method not found : compile()を取得する方法私のプロジェクト・レベルのbuild.gradleのルックス(部分図)どのようにプロジェクトレベルの依存関係をgradleに追加するには

buildscript { 
    repositories { 
     jcenter() 
    } 
    dependencies { 
     classpath 'com.android.tools.build:gradle:1.5.0' 

     compile 'io.reactivex:rxandroid:1.1.0' 
// Because RxAndroid releases are few and far between, it is recommended you also 
// explicitly depend on RxJava's latest version for bug fixes and new features. 
     compile 'io.reactivex:rxjava:1.1.0' 
     // NOTE: Do not place your application dependencies here; they belong 
     // in the individual module build.gradle files 
    } 
} 

です。

共通のプロジェクトレベルの依存関係を提供する方法はありますか。

答えて

0

buildscriptブロックのclasspath以外のスコープに依存関係を追加することはできません。 は、ここでは、(別のプロジェクトでは、ないbuildscriptで)プロジェクトの依存関係を宣言する方法は次のとおりです。

dependencies { 
     compile project(':shared') 
    } 
0

あなたはbuildscriptdependenciesブロックを使用しています。違います。

buildscript { 
    repositories { 
     jcenter() 
    } 
    dependencies { 
     classpath 'com.android.tools.build:gradle:1.5.0' 
    } 
} 



dependencies { 
    compile 'io.reactivex:rxandroid:1.1.0' 
    compile 'io.reactivex:rxjava:1.1.0'   
} 
関連する問題