2

I want to modify the library CompactCalendarView as per my requirement, so I have to add it as a submodule to my project. However, when I am trying to build the app it gives me this error, "Configuration with name 'default' not found".

I know it is related to some dependency and gradle build. But, I have 0 experience with gradle files and I have been trying to solve this from past 3-4 hours with no success. Please help me in resolving this issue.

This is what the android studio log says about the error.

2017-01-10 03:53:30,852 [2082900] WARN - nal.AbstractExternalSystemTask - Configuration with name 'default' not found.
com.intellij.openapi.externalSystem.model.ExternalSystemException: Configuration with name 'default' not found.
at org.jetbrains.plugins.gradle.service.project.AbstractProjectImportErrorHandler.createUserFriendlyError(AbstractProjectImportErrorHandler.java:106)
at org.jetbrains.plugins.gradle.service.project.BaseProjectImportErrorHandler.getUserFriendlyError(BaseProjectImportErrorHandler.java:158)
at org.jetbrains.plugins.gradle.service.project.BaseGradleProjectResolverExtension.getUserFriendlyError(BaseGradleProjectResolverExtension.java:579)
at org.jetbrains.plugins.gradle.service.project.AbstractProjectResolverExtension.getUserFriendlyError(AbstractProjectResolverExtension.java:158)
at com.android.tools.idea.gradle.project.AndroidGradleProjectResolver.getUserFriendlyError(AndroidGradleProjectResolver.java:405)
at org.jetbrains.plugins.gradle.service.project.GradleProjectResolver$ProjectConnectionDataNodeFunction.fun(GradleProjectResolver.java:772)
at org.jetbrains.plugins.gradle.service.project.GradleProjectResolver$ProjectConnectionDataNodeFunction.fun(GradleProjectResolver.java:752)
at org.jetbrains.plugins.gradle.service.execution.GradleExecutionHelper.execute(GradleExecutionHelper.java:238)
at org.jetbrains.plugins.gradle.service.project.GradleProjectResolver.resolveProjectInfo(GradleProjectResolver.java:112)
at org.jetbrains.plugins.gradle.service.project.GradleProjectResolver.resolveProjectInfo(GradleProjectResolver.java:73)
at com.intellij.openapi.externalSystem.service.remote.RemoteExternalSystemProjectResolverImpl$1.produce(RemoteExternalSystemProjectResolverImpl.java:41)
at com.intellij.openapi.externalSystem.service.remote.RemoteExternalSystemProjectResolverImpl$1.produce(RemoteExternalSystemProjectResolverImpl.java:37)
at com.intellij.openapi.externalSystem.service.remote.AbstractRemoteExternalSystemService.execute(AbstractRemoteExternalSystemService.java:59)
at com.intellij.openapi.externalSystem.service.remote.RemoteExternalSystemProjectResolverImpl.resolveProjectInfo(RemoteExternalSystemProjectResolverImpl.java:37)
at com.intellij.openapi.externalSystem.service.remote.wrapper.ExternalSystemProjectResolverWrapper.resolveProjectInfo(ExternalSystemProjectResolverWrapper.java:49)
at com.intellij.openapi.externalSystem.service.internal.ExternalSystemResolveProjectTask.doExecute(ExternalSystemResolveProjectTask.java:51)
at com.intellij.openapi.externalSystem.service.internal.AbstractExternalSystemTask.execute(AbstractExternalSystemTask.java:138)
at com.intellij.openapi.externalSystem.service.internal.AbstractExternalSystemTask.execute(AbstractExternalSystemTask.java:124)
at com.intellij.openapi.externalSystem.util.ExternalSystemUtil$3.execute(ExternalSystemUtil.java:419)
at com.intellij.openapi.externalSystem.util.ExternalSystemUtil$4$2.run(ExternalSystemUtil.java:500)
at com.intellij.openapi.progress.impl.CoreProgressManager$TaskRunnable.run(CoreProgressManager.java:563)
at com.intellij.openapi.progress.impl.CoreProgressManager$2.run(CoreProgressManager.java:142)
at com.intellij.openapi.progress.impl.CoreProgressManager.registerIndicatorAndRun(CoreProgressManager.java:446)
at com.intellij.openapi.progress.impl.CoreProgressManager.executeProcessUnderProgress(CoreProgressManager.java:392)
at com.intellij.openapi.progress.impl.ProgressManagerImpl.executeProcessUnderProgress(ProgressManagerImpl.java:54)
at com.intellij.openapi.progress.impl.CoreProgressManager.runProcess(CoreProgressManager.java:127)
at com.intellij.openapi.progress.impl.ProgressManagerImpl$1.run(ProgressManagerImpl.java:126)
at com.intellij.openapi.application.impl.ApplicationImpl$8.run(ApplicationImpl.java:369)
at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511)
at java.util.concurrent.FutureTask.run(FutureTask.java:266)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
at java.lang.Thread.run(Thread.java:745)

This what my apps build.gradle dependencies section looks like.

    dependencies {
    compile fileTree(dir: 'libs', include: ['*.jar'])
    androidTestCompile('com.android.support.test.espresso:espresso-core:2.2.2', {
        exclude group: 'com.android.support', module: 'support-annotations'
    })
    compile 'com.android.support:appcompat-v7:23.4.0'
    compile 'com.android.support:support-v4:23.4.0'
    compile project(':CompactCalendarView')
    testCompile 'junit:junit:4.12'
}

The build.gradle file inside the CompactCalendarView folder. This was supplied with the library.

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

        // NOTE: Do not place your application dependencies here; they belong
        // in the individual module build.gradle files
    }
}

allprojects {
    repositories {
        jcenter()
    }
}

build.gradle file at CompactCalendarView/ library/ This was also supplied with the library.

apply plugin: 'com.android.library'
apply plugin: 'idea'

    idea {
        module {
            downloadJavadoc = false

            downloadSources = true
        }
    }

    repositories {
        jcenter()
        mavenCentral()
    }


    android {
        compileSdkVersion 24
        buildToolsVersion '24.0.3'

        defaultConfig {
            minSdkVersion 15
            targetSdkVersion 24
            versionCode 1
            versionName "1.0"
        }
        buildTypes {
            release {
                minifyEnabled false
                proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
            }
        }
    }

    dependencies {
        compile fileTree(include: ['*.jar'], dir: 'libs')
        compile 'com.android.support:appcompat-v7:24.2.1'
        //mockito dependencies
        testCompile 'junit:junit:4.12'
        testCompile 'org.mockito:mockito-core:1.9.0'
    }

My settings.gradle

include ':app', ':CompactCalendarView'

My project structure

/Project
    /app
        -build.gradle

    /CompactCalendarView
        /library
            -build.gradle       
        -build.gradle

    -build.gradle
    -settings.gradle

I have tried

  • Updating the gradle version in the library to same as of my project.

  • Deleting the .gradle file from 'Users' folder in C drive and from the project.

  • Redownloading a new version of gradle. And setting it up manually.

Saran Sankaran
  • 2,335
  • 2
  • 19
  • 34

2 Answers2

1

I think compile project line is giving the problem, use the alternative method to compile the project library.

compile fileTree(dir: 'Location of the CompactCalendarView(Relative to project)', include: ['CompactCalendarView'])

This and This link can help you further.

Community
  • 1
  • 1
Madhukar Hebbar
  • 3,113
  • 5
  • 41
  • 69
  • Do you mean something like this? `compile fileTree(dir:'CompactCalendarView', include: ['CompactCalendarView'])` – Saran Sankaran Jan 10 '17 at 13:13
  • Yes, It should be if your `CompactCalendarView` in the current directory of app. We do it for libs directory like `compile fileTree(include: ['*.jar'], dir: 'libs')` Have you checked it? – Madhukar Hebbar Jan 10 '17 at 13:20
  • I tried adding the line which I have posted above in the comment. It builds the project without any error. However, I am not able to reference the library from the project. :( – Saran Sankaran Jan 11 '17 at 09:54
  • Is it showing any error? Try to rebuild the project or clear the studio cache. – Madhukar Hebbar Jan 11 '17 at 10:02
  • Hey, thanks a lot for the help. What worked for me was this --> https://github.com/SundeepK/CompactCalendarView/issues/150 – Saran Sankaran Jan 11 '17 at 19:13
0

What worked for me was.

  1. Download the library as.zip from GitHub and extract it somewhere.
  2. In Android Studio go to File -> New -> Import Module and then select the extracted folder.
  3. Uncheck the import sample checkbox
  4. Give it some relevant name.
  5. Sync/build the project.
  6. In the build.gradle of the app, add line compile project(':name-you-gave')
  7. Sync/build the project again.

See the solution here

Saran Sankaran
  • 2,335
  • 2
  • 19
  • 34