Android Studio Gradle project refresh failed:Configuration with name 'default' not found

浪子不回头ぞ 提交于 2020-01-01 19:49:49

问题


I want to import library wheel to my project. What I have done:

1. I imported library wheel to Android Studio in order to have build.gradle in it.
2. I created new folder in my project called libraries and put wheel library to it.
3. I put this code to my settings.gradle: include ':app:libraries:wheel'
4. I put this code to build.gradle: compile project('libraries:wheel');
5. I tried to sync gradle but it failed

That's how my project's structure looks like:

my build.gradle here:

apply plugin: 'android'

android {
    compileSdkVersion 19
    buildToolsVersion "19.0.3"

    buildTypes {
        defaultConfig {
            minSdkVersion 8
            targetSdkVersion 19
            versionCode 1
            versionName "1.0"
        }
        release {
            runProguard false
            proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.txt'
        }
    }
}

dependencies {
    compile 'com.android.support:appcompat-v7:+'
    compile fileTree(dir: 'libs', include: ['*.jar'])
    compile project('libraries:wheel');

}

my settings gradle:

include ':app'
include ':app:libraries:wheel'

My failure message:

Gradle 'LiteTap' project refresh failed:
Configuration with name 'default' not found.

How can I fix it?


回答1:


Try command gradlew tasks --info in terminal,

you may see "Evaluating project ':libraries:wheel' using empty build file."

maybe its because wheel is not an android studio project, AS didn't find build.gradle file

I fix this problem by import the library with android studio rather than direct copy it the YOURPRO\libraries.

How to use a library project in android studio And it works.

Note that it will be more tidy if your create a libraries folder and drag

wheel file after your import. Remember to add

include:libraries:pullToRefreshListView in your settings.gradle file




回答2:


compile fileTree(dir: 'libraries', include: ['wheel'])

Use this in app's gradle file in dependencies instead of

compile project('libraries:wheel')




回答3:


Add your library folder in your root location of your project and copy all the library files there. For ex YourProject/library then sync it and rest things seems OK to me.

Too check Configuration with name 'default' not found. Android Studio and Android Studio Gradle Configuration with name 'default' not found.



来源:https://stackoverflow.com/questions/23845009/android-studio-gradle-project-refresh-failedconfiguration-with-name-default-n

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!