I'm a newbie with gradle and I'm having a dependecy problem. I have the follow project structure:
-MyApp -MyAppLibrary -MyAppPro -MyAppFree -ThirdPartyLibraryWrapper --libs\ThirdPartyLibrary.aar Both MyAppPro and MyAppFree depend on MyAppLibrary, which depends on ThirdPartyLibraryWrapper. As the name suggests, ThirdPartyLibraryWrapper is a wrapper on an external library, namely ThirdPartyLibrary.aar.
This is my configuration:
build.gradle MyAppPro
apply plugin: 'com.android.application' android { compileSdkVersion 22 buildToolsVersion "22.0.1" defaultConfig { applicationId "com.example" minSdkVersion 8 targetSdkVersion 22 } buildTypes { release { minifyEnabled true proguardFiles 'proguard.cfg' } } } dependencies { compile project(':MyAppLibrary') } build.gradle MyAppLibrary
apply plugin: 'com.android.library' android { compileSdkVersion 22 buildToolsVersion "22.0.1" defaultConfig { minSdkVersion 8 targetSdkVersion 22 compileOptions { sourceCompatibility JavaVersion.VERSION_1_7 targetCompatibility JavaVersion.VERSION_1_7 } } buildTypes { release { minifyEnabled true proguardFiles 'proguard.cfg' } } } dependencies { compile project(':ThirdPartyLibraryWrapper') compile 'com.squareup.picasso:picasso:2.5.2' } build.gradle ThirdPartyLibraryWrapper
apply plugin: 'com.android.library' android { compileSdkVersion 22 buildToolsVersion "22.0.1" defaultConfig { minSdkVersion 8 targetSdkVersion 22 } buildTypes { release { minifyEnabled true proguardFiles 'proguard.cfg' } } } repositories { flatDir { dirs 'libs' } } dependencies { compile(name: 'ThirdPartyLibrary-0.1.0', ext: 'aar') compile "com.android.support:support-v4:22.0.0" compile fileTree(dir: 'libs', include: 'volley.jar') compile 'com.nostra13.universalimageloader:universal-image-loader:1.9.3' } When gradle sync completes, I have got this error:
MyApp/MyAppFre/ build.gradle: failed to resolve ThirdPartyLibrary-0.1.0 MyApp/MyAppLibrary/ build.gradle: failed to resolve ThirdPartyLibrary-0.1.0 MyApp/MyAppPro/ build.gradle: failed to resolve ThirdPartyLibrary-0.1.0 Can someone help me figure out where is the issue?
-char in the name of aar. Try to useThirdPartyLibrary_0.1.0changing the name in the libs folder and in the gradle file.