错误:配置名称为“默认”尝试导入项目作为库添加到Android的Studio时未找到 [英] Error:Configuration with name 'default' not found when trying to import project as library into Android Studio

查看:371
本文介绍了错误:配置名称为“默认”尝试导入项目作为库添加到Android的Studio时未找到的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我查了一下这个话题的所有其他线程也没有找到答案。
我试图导入幅增频双向视图项目作为一个库为 Android的工作室

这两个项目都在自己的运行很好,但我总是得到相同的摇篮错误:错误:一个名为默认的配置没有找到尝试导入时

我已经复制到一个项目目录在我的项目的根文件夹和以下结构的gradle:

我的项目settings.gradle:

 包括':库:双向视主',':应用程序

的应用程序的build.gradle:

 应用插件:'com.android.application安卓{
    compileSdkVersion 21
    buildToolsVersion21.1.2    defaultConfig {
        的applicationIDapp.com.jeldrik.teacherslittlehelper
        13的minSdkVersion
        targetSdkVersion 21
        版本code 1
        的versionName1.0
    }
    buildTypes {
        发布 {
            minifyEnabled假
            proguardFiles getDefaultProguardFile('proguard的-android.txt'),'proguard-rules.pro
        }
    }
}依赖{
    编译文件树(导演:'库',包括:['的* .jar'])
    编译com.android.support:appcompat-v7:21.0.3
    编制项目(':库:双向 - 视图 - 硕士)

和双向中视主的build.gradle:

  buildscript {
    库{
        mavenCentral()
    }    依赖{
        类路径'com.android.tools.build:gradle:1.0.0
    }
}


解决方案

twowayview主的build.gradle 文件不是一个独立的模块buildscript;它缺乏任何形式的应用插件声明将告诉摇篮应该如何编译的东西。这看起来像一个多模块结构的项目的顶层生成文件。在您的 settings.gradle 文件,你应该在你想包括,而不是在顶层的生成文件的项目模块点。

I checked all the other threads about this topic but couldn't find an answer. I am trying to import the Twoway View Project as a library into Android Studio.

Both projects run fine on their own but I always get the same Gradle Error: Error:Configuration with name 'default' not found when trying to import.

I have the project copied into a "libraries" directory in the root folder of my project and the following gradle structure:

settings.gradle of my project:

include ':libraries:twoway-view-master',':app'

build.gradle of "app":

  apply plugin: 'com.android.application'

android {
    compileSdkVersion 21
    buildToolsVersion "21.1.2"

    defaultConfig {
        applicationId "app.com.jeldrik.teacherslittlehelper"
        minSdkVersion 13
        targetSdkVersion 21
        versionCode 1
        versionName "1.0"
    }
    buildTypes {
        release {
            minifyEnabled false
            proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
        }
    }
}

dependencies {
    compile fileTree(dir: 'libs', include: ['*.jar'])
    compile 'com.android.support:appcompat-v7:21.0.3'
    compile project(':libraries:twoway-view-master')

and in twoway-view-master build.gradle:

buildscript {
    repositories {
        mavenCentral()
    }

    dependencies {
        classpath 'com.android.tools.build:gradle:1.0.0'
    }
}

解决方案

That twowayview-master build.gradle file isn't a buildscript for a standalone module; it lacks any sort of apply plugin statement that would tell Gradle how it should compile something. This looks like the top-level build file of a multimodule-structured project. In your settings.gradle file, you should point at the module in the project you're trying to include, not the build file at the top level.

这篇关于错误:配置名称为“默认”尝试导入项目作为库添加到Android的Studio时未找到的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆