您的位置:首页 > 移动开发 > Android开发

解决android打包dex文件方法数溢出的问题

2017-01-23 16:02 435 查看
apply
plugin:
'com.android.application'

android {

    compileSdkVersion
19

   
buildToolsVersion
'23.0.1'

   

defaultConfig {

        applicationId
"com.shjy.jingin"

       

minSdkVersion
14

       
targetSdkVersion
21

       
versionCode
1

       
versionName
"1.0"

       

multiDexEnabled
true  //  add this 

   

}

    buildTypes {

        release {

            minifyEnabled
false

           

proguardFiles getDefaultProguardFile(
'proguard-android.txt'),
'proguard-rules.pro'

       

}

    }

    dexOptions {    //  add this   不加入会内存溢出

        incremental
true

       

javaMaxHeapSize
"4g"

   

}

    sourceSets {

        main {

            jniLibs.srcDirs = ['libs']

        }

    }

    packagingOptions {

        exclude
'META-INF/DEPENDENCIES'

       

exclude
'META-INF/LICENSE'

       

exclude
'META-INF/LICENSE.txt'

       

exclude
'META-INF/license.txt'

       

exclude
'META-INF/NOTICE'

       

exclude
'META-INF/NOTICE.txt'

       

exclude
'META-INF/notice.txt'

       

exclude
'META-INF/ASL2.0'

       

exclude
'META-INF/DEPENDENCIES'

       

exclude
'META-INF/NOTICE'

       

exclude
'META-INF/LICENSE'

   

}

}

dependencies {

    compile
'com.android.support:multidex:'   //  add this  

   

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

    compile project(':swipelistview'
)

    compile project(':library'
)

    compile project(':android-support-v7-appcompat'
)

}
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息