問題描述
我正在使用 volley 庫在 android 中執行網絡操作.所以我試圖在我的項目中添加這個庫,它是在 Android Studio 和 gradle 系統中創建的.
I am using the volley library to perform network operation in android. So I am trying to add this library in my project which is created in Android Studio and gradle system.
我在我的項目中添加了 volley 庫,但是當我與 gradle 同步時,我收到了錯誤消息.我嘗試了我在這里看到的所有答案,但對我沒有任何幫助.
I added the volley library in my project but when I sync with gradle then I am getting error message. I tried all the answers which I see here but nothing worked for me.
錯誤消息:在 Android Studio 中找不到名為默認"的配置
Error message : Configuration with name 'default' not found in Android Studio
Volley/build.gradle
Volley/build.gradle
apply plugin: 'android-library'
android {
compileSdkVersion 19
buildToolsVersion '19.0.1'
sourceSets {
defaultConfig {
minSdkVersion 8
targetSdkVersion 19
}
main {
assets.srcDirs = ['assets']
res.srcDirs = ['res']
aidl.srcDirs = ['src']
resources.srcDirs = ['src']
renderscript.srcDirs = ['src']
java.srcDirs = ['src']
manifest.srcFile 'AndroidManifest.xml'
}
}
}
app/build.gradle
app/build.gradle
apply plugin: 'android'
android {
compileSdkVersion 19
buildToolsVersion '19.0.1'
defaultConfig {
minSdkVersion 8
targetSdkVersion 19
versionCode 1
versionName "1.0"
}
buildTypes {
release {
runProguard false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.txt'
}
}
}
dependencies {
compile 'com.android.support:appcompat-v7:19.+'
compile project(':library:volley')
}
root/build.gradle
root/build.gradle
// Top-level build file where you can add configuration options common to all sub-projects/modules.
buildscript {
repositories {
mavenCentral()
}
dependencies {
classpath 'com.android.tools.build:gradle:0.9.1'
}
}
allprojects {
repositories {
mavenCentral()
}
}
settings.gradle
settings.gradle
include ':app'
include ':library:volley'
推薦答案
在項目的根目錄中添加庫文件夾,并將所有庫文件復制到那里.對于 ex YourProject/library 然后同步它,其余的東西對我來說似乎沒問題.
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.
這篇關于錯誤:在 Android Studio 中找不到名稱為“默認"的配置的文章就介紹到這了,希望我們推薦的答案對大家有所幫助,也希望大家多多支持html5模板網!