android - Gradle sync Error:Configuration with name 'default' not found -
i want add external library guillotinemenu-android in application. followed steps given in upvoted answer existing question how add library project android studio? facing error when try build project after step 6 i.e. when added dependency in app/build.gradle
compile project(":guillotinemenu")
. tried stackoverflow links related error not working out. have made folder named libs in app directory , copied project folder guillotine menu there. here build.gradle(module:app)
file
apply plugin: 'com.android.application' android { compilesdkversion 22 buildtoolsversion "22.0.1" defaultconfig { applicationid "com.sunshine.bbreaker.appet_i" minsdkversion 14 targetsdkversion 22 versioncode 1 versionname "1.0" } buildtypes { release { minifyenabled false proguardfiles getdefaultproguardfile('proguard-android.txt'), 'proguard-rules.pro' } } productflavors { } } dependencies { compile filetree(dir: 'libs', include: ['*.jar']) compile 'com.android.support:recyclerview-v7:+' compile 'com.github.navasmdc:materialdesign:1.+@aar' compile 'com.android.support:appcompat-v7:22.0.+' // guillotinemenu compile project(":guillotinemenu") }
settings.gradle(project settings) file:
include ':app', ':guillotinemenu' project(':guillotinemenu').projectdir = new file('libs/guillotinemenu')
build.gradle(project:guillotinemenu) file:
buildscript { repositories { jcenter() } dependencies { classpath 'com.android.tools.build:gradle:1.2.3' // note: not place application dependencies here; belong // in individual module build.gradle files }} allprojects { repositories { jcenter() }}
settings.gradle(project:guillotinemenu) file:
include ':app', ':library'
build.gradle(guillotinemenu) file:
apply plugin: 'com.android.application' android { compilesdkversion 22 buildtoolsversion "21.1.2" defaultconfig { applicationid "com.yalantis.guillotine.sample" minsdkversion 15 targetsdkversion 22 versioncode 1 versionname "1.0" } buildtypes { release { minifyenabled false proguardfiles getdefaultproguardfile('proguard-android.txt'), 'proguard-rules.pro' } } } dependencies { compile project(':library') compile filetree(dir: 'libs', include: ['*.jar']) compile 'com.android.support:appcompat-v7:22.1.1' compile 'com.jakewharton:butterknife:6.1.0' }
let me know if need more information. in advance.
you should have structure this:
projectroot app build.gradle library build.gradle build.gradle settings.gradle
each module has own build.gradle
file. root/settings.gradle
defines modules inside project. don't use settings.gradle inside module.
in settings.gradle :
include ':app', ':library'
in build.gradle
buildscript { repositories { jcenter() } dependencies { classpath 'com.android.tools.build:gradle:1.2.3' // note: not place application dependencies here; belong // in individual module build.gradle files } } allprojects { repositories { jcenter() } }
in library/build.gradle
apply plugin: 'com.android.library' android { compilesdkversion ... buildtoolsversion ... defaultconfig { .... } } dependencies { //.... }
in app/build.gradle use file change:
dependencies { //... // guillotinemenu compile project(":library") }
update:
after comment below, think in case library folder root folder of project. means should refer module inside project.
projectroot app build.gradle libs guillotinemenu build.gradle //top level file of guillotinemenu project -->> module build.gradle //build.gradle of module
so change settings.gradle of projectroot.
include ':app', ':guillotinemenu' project(':guillotinemenu').projectdir = new file('libs/guillotinemenu/module')
the module (libs/guillotinemenu/module) should have build.gradle
library/build.gradle described above.
Comments
Post a Comment