Android:为什么看不到子模块中的类?

时间:2018-12-17 11:16:18

标签: gradle android-studio-3.0

Android Studio 3.2.1

我的主应用程序具有模块“ binding” 在dir的此模块中,有jar:/libs/androidbinding.jargueei.binding.*

好。模块“ binding”成功建立。

现在在 app / build.gradle中的主应用中:

apply plugin: 'com.android.application'

android {
    compileSdkVersion 28
    defaultConfig {
        applicationId "com.myproject"
        minSdkVersion 23
        targetSdkVersion 28
        versionCode 1
        versionName "1.1.1"
        testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"

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

    packagingOptions {
        exclude 'META-INF/DEPENDENCIES'
    }
}

// must be version 4.5.2
def AAVersion = '4.5.2'

dependencies {
    annotationProcessor "org.androidannotations:androidannotations:$AAVersion"
    annotationProcessor "org.androidannotations:ormlite:$AAVersion"

    implementation fileTree(dir: 'libs', include: ['*.jar'])

    implementation 'com.android.support:appcompat-v7:28.0.0'
    implementation 'com.android.support:animated-vector-drawable:28.0.0'
    implementation 'com.android.support:exifinterface:28.0.0'
    implementation 'com.android.support:cardview-v7:28.0.0'
    implementation 'com.android.support:customtabs:28.0.0'
    implementation 'com.android.support:support-media-compat:28.0.0'
    implementation 'com.android.support:support-v4:28.0.0'

    implementation 'com.android.support.constraint:constraint-layout:1.1.3'
    implementation 'org.apache.commons:commons-lang3:3.8.1'
    implementation 'org.apache.httpcomponents:httpclient:4.5.6'
    implementation 'com.google.android.gms:play-services-gcm:16.0.0'
    implementation 'com.google.code.gson:gson:2.8.2'
    implementation 'com.j256.ormlite:ormlite-android:5.1'
    implementation 'commons-io:commons-io:2.6'
    implementation "org.androidannotations:androidannotations-api:$AAVersion"
    implementation "org.androidannotations:ormlite-api:$AAVersion"

    implementation project(':binding')

}

如您所见,我使用:

 implementation project(':binding')

但是当我尝试构建主“ 应用”项目时,出现错误:

import gueei.binding.Binder.InflateResult;
import gueei.binding.observables.StringObservable;

error: package gueei.binding.Binder does not exist

但是lib androidbinding.jar 包含类“ gueei.binding.Binder.InflateResult”。

为什么主“ 应用”看不到模块“ 绑定”?

P.S。

如果我将androidbinding.jar复制到 app / libs / ,则会出现另一个错误:

AGPBI: {"kind":"error","text":"Program type already present: gueei.binding.AttributeBinder$RefViewAttributeProvider","sources":[{}],"tool":"D8"}
:app:transformDexArchiveWithExternalLibsDexMergerForDebug FAILED
:app:buildInfoGeneratorDebug

0 个答案:

没有答案