TabLayout属性在我的库中不可用

时间:2019-01-09 07:40:09

标签: android gradle

我制作了一个使用AndroidX的库,还在布局文件中使用了TabLayout,该文件具有app:tabBackgroundapp:tabGravityapp:tabIndicatorHeightapp:tabMaxWidth之类的属性等等

为使用此TabLayout,我包括了此依赖项

implementation 'com.google.android.material:material:1.1.0-alpha02'

在此依赖项中较早(在AndroidX之前)

implementation 'com.android.support:design:28.0.0'

现在,当我使用JCenter打包该库并将其包含在其他项目中时,它会显示错误

  

Android资源链接失败

对于材料TabLayout的上述四个属性,

现在,当我在测试项目中明确包含TabLayout依赖项时,该错误将得到解决,并且所有工作均按预期进行。但是,当我实际上已经在库的build.gradle文件中包含相同的依赖项时,不需要显式包括该库就不行了。谁能帮我解决这个问题?

我的图书馆的build.gradle

apply plugin: 'com.android.library'
apply plugin: 'com.github.dcendents.android-maven'
group = 'com.github.technolifestyle'

ext {
    bintrayRepo = 'AutoImageFlipper'
    bintrayName = 'AutoImageFlipper'

    publishedGroupId = 'com.github.technolifestyle'
    libraryName = 'AutoImageFlipper'
    artifact = 'imageslider'

    libraryDescription = 'A carousel like implementation for Android with many functionalities'

    siteUrl = 'https://github.com/therealshabi/AutoImageFlipper/'
    gitUrl = 'https://github.com/therealshabi/AutoImageFlipper.git'

    libraryVersion = '1.5.6'

    developerId = 'therealshabi'
    developerName = 'Shahbaz Hussain'
    developerEmail = 'shahbaz.h96@gmail.com'

    licenseName = 'The Apache Software License, Version 2.0'
    licenseUrl = 'http://www.apache.org/licenses/LICENSE-2.0.txt'
    allLicenses = ["Apache-2.0"]
}

android {
    compileSdkVersion 28
    buildToolsVersion '28.0.3'

    defaultConfig {
        minSdkVersion 17
        targetSdkVersion 28
        versionCode 1
        versionName "1.0"

        testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"

    }
    buildTypes {
        release {
            minifyEnabled false
            useProguard false
            proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
        }
    }
}

dependencies {
    api fileTree(include: ['*.jar'], dir: 'libs')
    implementation 'androidx.appcompat:appcompat:1.1.0-alpha01'
    implementation 'com.google.android.material:material:1.1.0-alpha02'
    testImplementation 'junit:junit:4.12'
    implementation files('libs/picasso-2.5.2.jar')
}

apply from: 'https://raw.githubusercontent.com/nuuneoi/JCenter/master/installv1.gradle'
apply from: 'https://raw.githubusercontent.com/nuuneoi/JCenter/master/bintrayv1.gradle'

我的应用的build.gradle

apply plugin: 'com.android.application'

android {
    compileSdkVersion 28
    defaultConfig {
        applicationId "com.example.shahbaz.testapplication"
        minSdkVersion 17
        targetSdkVersion 28
        versionCode 1
        versionName "1.0"
        testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
    }
    buildTypes {
        debug {

        }
        release {
            minifyEnabled false
            proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
        }
    }
}

dependencies {
    implementation fileTree(dir: 'libs', include: ['*.jar'])
    implementation 'androidx.appcompat:appcompat:1.1.0-alpha01'
    implementation 'androidx.constraintlayout:constraintlayout:2.0.0-alpha3'
    api 'com.github.technolifestyle:imageslider:1.5.6'
    testImplementation 'junit:junit:4.12'
    androidTestImplementation 'androidx.test:runner:1.1.1'
    androidTestImplementation 'androidx.test.espresso:espresso-core:3.1.1'
}

我的logcat错误:

Android resource linking failed
/Users/therealshabi/.gradle/caches/transforms-1/files-1.1/imageslider-1.5.6.aar/7613a0787048f4fcec061a14a3d7277f/res/layout/flipper_layout.xml:15: error: attribute tabBackground (aka technolifestyle.com.kotlin_practice:tabBackground) not found.
/Users/therealshabi/.gradle/caches/transforms-1/files-1.1/imageslider-1.5.6.aar/7613a0787048f4fcec061a14a3d7277f/res/layout/flipper_layout.xml:15: error: attribute tabGravity (aka technolifestyle.com.kotlin_practice:tabGravity) not found.
/Users/therealshabi/.gradle/caches/transforms-1/files-1.1/imageslider-1.5.6.aar/7613a0787048f4fcec061a14a3d7277f/res/layout/flipper_layout.xml:15: error: attribute tabIndicatorHeight (aka technolifestyle.com.kotlin_practice:tabIndicatorHeight) not found.
/Users/therealshabi/.gradle/caches/transforms-1/files-1.1/imageslider-1.5.6.aar/7613a0787048f4fcec061a14a3d7277f/res/layout/flipper_layout.xml:15: error: attribute tabMaxWidth (aka technolifestyle.com.kotlin_practice:tabMaxWidth) not found.

0 个答案:

没有答案