Class 尝试从另一个 Android 模块访问 android 模块库中的 class 时未找到

Class Not found when try to acces the class in the library of a android module from another Android module

我有一个 Android 库模块(通用),它有一个库依赖项 (com.android.support:multidex:1.0.1)。除了 "Common" 模块,我还有一个 Android 模块 (Module1)ich 需要 "MultiDex" (位于 "Common" 库模块中的依赖项),但我收到错误消息:android.support.multidex.MultiDex 不存在。

Common Library build.gradle:

apply plugin: 'com.android.library'

dependencies {
    compile 'com.android.support:multidex:1.0.1'
}

Module1  build.gradle:

dependencies {
    compile project(':Common');
}
But in Module1 i am unable to use MultiDex

在您的 build.gradle 中,您需要启用 multidex 为:

android {
compileSdkVersion 21
buildToolsVersion "21.1.0"

defaultConfig {
    ...
    minSdkVersion 14
    targetSdkVersion 21
    ...

    // Enabling multidex support.
    multiDexEnabled true


   }
    ...
}
dependencies {
  compile 'com.android.support:multidex:1.0.0'
}

希望这对您有所帮助..