Bot*_*Bot 117 android android-studio android-volley android-gradle-plugin
我正在使用凌空库在android中执行网络操作.所以我试图在我的项目中添加这个库,该项目是在Android Studio和gradle系统中创建的.
我在我的项目中添加了凌空库,但是当我与gradle同步时,我收到错误消息.我尝试了我在这里看到的所有答案,但没有任何对我有用.
错误消息:在Android Studio中找不到名称为"default"的配置
凌空/的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'
        }
    }
}
应用程序/的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')
}
根/的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
include ':app'
include ':library:volley'
Vil*_*usK 96
尝试:
git submodule init
git submodule update
Aja*_*y S 68
将库文件夹添加到项目的根位置,并将所有库文件复制到那里.对于ex YourProject/library然后同步它,休息对我来说似乎没问题.
ale*_*mix 22
这可能是一种罕见的情况,但对我来说,settings.gradle中包含的库不存在.
我有:include ':libraries:Android-RateThisApp:library'在我的settings.gradle中
但是文件夹Android-RateThisApp是空的.一旦我检查了这个子模块,就完成了gradle同步.
Bjö*_*hel 14
如果要对多个项目使用相同的库文件夹,可以将其在gradle中引用到外部位置,如下所示:
settings.gradle:
include 'app', ':volley'
project(':volley').projectDir = new File('../libraries/volley')
在你的app build.gradle中
dependencies {
    ...
    compile project(':volley')
...}
我也面临这个问题,但我按照以下步骤: - 1)我将模块(库)添加到特定的文件夹名称ThirdPartyLib
要解决此问题,我去settings.gradle而不仅仅是添加以下内容: -
project(':').projectDir = new File('ThirdPartyLib /')
: - 是模块名称......
| 归档时间: | 
 | 
| 查看次数: | 161378 次 | 
| 最近记录: |