:app:transformClassesWithMultidexlistForDebug任务失败

时间:2018-04-29 06:28:50

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

    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. 删除.gradle&&构建&& .idea&& [模块]构建
  4. 然后重建我的项目
  5. 但是我无法解决它。有谁可以帮我解决这个问题? THX。

    这是我的build.gradle(应用)。

    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(BcClaLibirary)的一部分。

    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'
    

1 个答案:

答案 0 :(得分:0)

尝试一下:

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