【问题标题】::app:transformClassesWithMultidexlistForDebug task failed:app:transformClassesWithMultidexlistForDebug 任务失败
【发布时间】:2018-04-29 06:28:49
【问题描述】:
    com.android.build.api.transform.TransformException : 
Error while generating the main dex list.
    com.android.tools.r8.errors.CompilationError: 
Program type already present: com.xyja.bcclalib.BuildConfig

我已经尝试了这些方法:

  1. 构建清理我的模块
  2. 清理项目
  3. delete .gradle && build && .idea && [module]build
  4. 然后重建我的项目

但我无法解决它。谁能帮我解决这个问题?谢谢。

这是我的build.gradle(app)。

apply plugin: 'com.android.application'

android {
    compileSdkVersion 26
    defaultConfig {
        applicationId "com.xyja.bcclalib"
        minSdkVersion 19
        targetSdkVersion 26
        versionCode 1
        versionName "1.0"
        multiDexEnabled true
        testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
    }

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

repositories{
    flatDir {
        dirs 'libs'
    }
}

dependencies {
    implementation 'com.android.support:appcompat-v7:26.1.0'
    implementation project(':BcClaLibirary')
    implementation 'com.android.support:multidex:1.0.3'
}

这是我的build.gradle(BcClaLibrary) 的一部分。

apply plugin: 'com.android.library'

android {
    ...
}

dependencies {
    implementation files('libs/bcprov-jdk15on-157.jar')
    implementation files('libs/ksoap2-android-assembly-3.6.0-jar-with-dependencies.jar')
    implementation files('libs/sun.misc.BASE64Decoder.jar')
    implementation (name: 'ESecurityLib-release', ext: 'aar')
}
configurations.all {
    resolutionStrategy.cacheChangingModulesFor 0, 'seconds'
}

apply from: './nexus_maven.gradle'

【问题讨论】:

  • 添加有问题的build.gradle

标签: android android-studio android-gradle-plugin android-multidex


【解决方案1】:

试试这个:

//app
repositories{
    flatDir {
        dirs 'libs'
        dirs.project(':BcClaLibirary').files('libs')
        //or you can use this way
        //dirs 'libs', '../BcClaLibirary/libs'
    }
}

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 2018-06-10
    • 2019-11-02
    • 2019-07-14
    • 2020-07-06
    • 1970-01-01
    • 1970-01-01
    • 2019-09-25
    • 1970-01-01
    相关资源
    最近更新 更多