问题
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