I am new to Gradle build system, I have a library project that includes dependencies like Retrofit, okhttp, etc.
I compiled my project and created aar file. I created a dummy project and added my library as a dependency.
Now, if I do not add Retrofit and okhttp as dependencies in my build.gradle file of the dummy file, my application crashes with no exception found.
My question is: since the library aar file already includes Retrofit and okhttp as a dependency, why should I explicitly add them to the dummy build.gradle file of the application? There is a workaround.
Here is my build.gradle library
apply plugin: 'com.android.library' buildscript { repositories { mavenCentral() jcenter() } dependencies { classpath 'com.android.tools.build:gradle:1.0.+' } } allprojects { repositories { jcenter() } } android { compileSdkVersion 22 buildToolsVersion "21.1.2" defaultConfig { minSdkVersion 14 targetSdkVersion 22 versionCode 1 versionName "1.0" } buildTypes { release { minifyEnabled false proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro' } }} dependencies { compile fileTree(dir: 'libs', include: ['*.jar']) compile 'com.android.support:appcompat-v7:22.+' compile 'com.android.support:recyclerview-v7:21.+' compile 'com.android.support:cardview-v7:21.+' compile 'com.google.android.gms:play-services:6.5.87' compile 'com.squareup.okhttp:okhttp:2.2.0' compile 'com.squareup.retrofit:retrofit:1.9.0' }
Akhil latta
source share