我的应用程序无法识别在另一个自定义库中导入的库

时间:2018-04-18 13:21:53

标签: android android-custom-view android-library

我是Android开发的新手。

我创建了一个带有圆形按钮的简单自定义按钮库,我正在另一个自定义库中使用。我使用file-> import-> module-> myCustomButtonLibrary到我的另一个自定义库。

该自定义库正在识别按钮库及其所有功能。

现在我正在使用应用程序中的另一个库。我以同样的方式导入了库,应用程序正在识别其他库的所有功能,但它无法从按钮库访问类。

这是我得到的错误

Cannot access class 'com.example.CustomButton'. Check your module classpath for missing or conflicting dependencies 

应用程序的build.gradle

apply plugin: 'com.android.application'

apply plugin: 'kotlin-android'

apply plugin: 'kotlin-android-extensions'

android {
    compileSdkVersion 27
    defaultConfig {
        applicationId "com.example.screenpatterns"
        minSdkVersion 21
        targetSdkVersion 27
        versionCode 1
        versionName "1.0"
        testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
    }
    buildTypes {
        release {
            minifyEnabled false
            proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
        }
    }
}

dependencies {
    implementation fileTree(include: ['*.jar'], dir: 'libs')
    implementation "org.jetbrains.kotlin:kotlin-stdlib-jre7:$kotlin_version"
    implementation 'com.android.support:appcompat-v7:27.1.1'
    implementation 'com.android.support.constraint:constraint-layout:1.0.2'
    testImplementation 'junit:junit:4.12'
    androidTestImplementation 'com.android.support.test:runner:1.0.1'
    androidTestImplementation 'com.android.support.test.espresso:espresso-core:3.0.1'
    implementation project(':screenpattern')    }

自定义库的build.gradle

apply plugin: 'com.android.library'
apply plugin: 'kotlin-android'

android {
    compileSdkVersion 27



    defaultConfig {
        minSdkVersion 21
        targetSdkVersion 27
        versionCode 1
        versionName "1.0"

        testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"

    }

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

}

dependencies {
    implementation fileTree(include: ['*.jar'], dir: 'libs')
    implementation 'com.android.support:appcompat-v7:27.1.1'
    implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlin_version"
    testImplementation 'junit:junit:4.12'
    androidTestImplementation 'com.android.support.test:runner:1.0.1'
    androidTestImplementation 'com.android.support.test.espresso:espresso-core:3.0.1'
    implementation project(':custombutton')

}
repositories {
    mavenCentral()
}

如您所见,屏幕模式库已包含自定义按钮库。

任何帮助表示赞赏 提前谢谢。

0 个答案:

没有答案
相关问题