Android Studioでサードパーティーのライブラリを使おうとしたらエラーになった
自分用のメモです。
Eclipseで作成したプロジェクトをEclipseのgradleファイルexport機能を使ってAndroid Studio向けにしたプロジェクトの話です。
Android Studioから作成したプロジェクトでは起こらないことです。
とあるライブラリを使おうとしてappレベルのbuiled.gradleのdependenciesに記述したらgradleに怒られました。
dependencies { compile fileTree(dir: 'libs', include: '*.jar') compile 'com.android.support:support-v4:22.2.1' compile "com.android.support:appcompat-v7:22.2.1" compile 'com.google.android.gms:play-services-analytics:7.8.0' compile 'com.android.support:gridlayout-v7:22.2.1' compile 'com.android.support:support-annotations:22.2.1' compile 'uk.co.chrisjenx:calligraphy:2.1.0' }
一番下のライブラリを記述したところ・・・↓
Error:(42, 17) Failed to resolve: uk.co.chrisjenx:calligraphy:2.0.1
というエラーメッセージが出てしまいました。
そんなバカな!ということで他のプロジェクトと見比べて次のようにトップレベルのbuiled.gradleに付け加えたら
解決しました。
allprojects { repositories { jcenter() } }