问题描述
我正在使用 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.