如何将另一个库编译到库中?

时间:2015-12-30 04:28:00

标签: android android-gradle android-library android-build

我有一个使用com.android.support:appcompat-v7:23.1.1编译的Android库,依此类推,因为该库是一个自定义视图。但是当我构建我的库时,错误说:

    Error:(8, 33) error: package android.support.v7.widget does not exist
    Error:(9, 33) error: package android.support.v7.widget does not exist
    Error:(21, 5) error: cannot find symbol class RecyclerView
    Error:(57, 13) error: cannot find symbol class LinearLayoutManager

Error:package R does not exist
13 warnings
:mylibrary:javadoc FAILED
Error:Execution failed for task ':mylibrary:javadoc'.

> Javadoc generation failed. Generated Javadoc options file (useful for troubleshooting):

'~/Documents/WorkSpace/MyLibrary/mylibrary/build/tmp/javadoc/javadoc.options'

Information:BUILD FAILED

我的图书馆build.gradle

apply plugin: 'com.android.library'

android {
    compileSdkVersion 23
    buildToolsVersion "23.0.2"

    defaultConfig {
        minSdkVersion 16
        targetSdkVersion 23
        versionCode 1
        versionName "0.1.0"
    }
    buildTypes {
        release {
            minifyEnabled false
            proguardFiles getDefaultProguardFile('proguard-android.txt'),
                'proguard-rules.pro'
        }
    }
}

dependencies {
    compile 'com.android.support:appcompat-v7:23.1.1'
    compile 'com.android.support:recyclerview-v7:23.1.1'
}

apply from: 'deploy.gradle'

我的主要模块build.gradle

apply plugin: 'com.android.application'

android {
    compileSdkVersion 23
    buildToolsVersion "23.0.2"

    defaultConfig {
        applicationId "**.**.demo"
        minSdkVersion 16
        targetSdkVersion 23
        versionCode 1
        versionName "1.0"
    }
    buildTypes {
        release {
            minifyEnabled false
            proguardFiles getDefaultProguardFile('proguard-android.txt'),
                'proguard-rules.pro'
        }
    }
}

dependencies {
    compile fileTree(dir: 'libs', include: ['*.jar'])
    testCompile 'junit:junit:4.12'
    compile 'com.android.support:appcompat-v7:23.1.1'
    compile 'com.android.support:design:23.1.1'
    compile project(':mylibrary')
}

我的项目settings.gradle

include ':mylibrary', ':demo'

0 个答案:

没有答案