Android的工作室摇篮配置一个名为“默认”不使用库项目shinobicharts发现 [英] Android Studio Gradle Configuration with name 'default' not found using library project shinobicharts

查看:142
本文介绍了Android的工作室摇篮配置一个名为“默认”不使用库项目shinobicharts发现的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

settings.gradle 的:

include ':app'
include ':app:libraries:shinobicharts-android-library'

的build.gradle 的:

apply plugin: 'com.android.application'

android {
    compileSdkVersion 21
    buildToolsVersion "21.1.2"

    defaultConfig {
        applicationId "com.example.rohit2906.myhistogram"
        minSdkVersion 11
        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:shinobicharts-android-library')
}

我想补充库项目是shinobicharts-Android的图书​​馆,它是在图书馆folder.Please帮助我。

I am trying to add library project which is shinobicharts-android-library and it is in libraries folder.Please help me with this.

推荐答案

您已经在项目中定义每个模块的build.gradle。

You have to define a build.gradle for each module in your project.

此外,它是不是一个好主意,定义另一个模块中的一个模块。

Also it is not a good idea to define a module inside another module.

您应该有这样的结构:

root
  app
    build.gradle
  libraries
    shinobicharts-android-library
       build.gradle
  build.gradle   //top level
  settings.gradle

在你的 settings.gradle 的变化:

include ':app'
include ':libraries:shinobicharts-android-library'

在你的应用程序/的build.gradle 更改

compile project(':libraries:shinobicharts-android-library')

shinobicharts-的Andr​​oid库/的build.gradle

apply plugin: 'com.android.library'

android {
   compileSdkVersion 21
   buildToolsVersion "21.1.2"

   defaultConfig {
     minSdkVersion 11
     targetSdkVersion 21
   }
}

dependencies {
    compile fileTree(dir: 'libs', include: ['*.jar'])
    //...other
}

这篇关于Android的工作室摇篮配置一个名为“默认”不使用库项目shinobicharts发现的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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