天天看點

ANDROID 65536錯誤

先說說我的情況吧

原來項目是用eclipse開發的,出現了65536的問題,按照大神們的文章裝gradle插件啥的,最後也沒搞OK。既然goodle提供了解決方案,于是就把項目搬到android studio。

目前我的環境是android studio 2.1.3,jdk 1.8。最後我的問題解決了。如果跟各位跟我的情況差不多的,希望幫到你們吧。

android studio 建構項目OK後,

在build.gradle中需要添加依賴

compile 'com.android.support:multidex:1.0.1'

需要将自己的Application繼成MultiDexApplication,并添加 multiDexEnabled true

中間碰到了一些問題

1,VM with version 1.6.0 does not have multidex support

2,VM with version 2.1.0 has multidex support, MultiDex support library is disabled.

3,FragmentTabHost的問題

4,arm64-v8a的問題

下面貼出我的最終版的build.gradle

<span style="font-size:18px;">apply plugin: 'com.android.application'
android {
    signingConfigs {
        config {
            keyAlias 'androiddebugkey'
            keyPassword 'android'
            storeFile file('D:/debug.keystore')
            storePassword 'android'
        }
    }
    compileSdkVersion 24
    buildToolsVersion '24.0.1'
    defaultConfig {
        applicationId "com.xxx.xxx"
        minSdkVersion 15
        targetSdkVersion 24
        versionCode 63
        versionName "2.7.8"
        multiDexEnabled true
        ndk {
            abiFilters "armeabi", "armeabi-v7a", "x86"
        }
        packagingOptions {
            exclude "arm64-v8a"
        }
        signingConfig signingConfigs.config
    }
    buildTypes {
        release {
            minifyEnabled false
            proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro', 'proguard.cfg'
            ndk {
                abiFilters "armeabi", "armeabi-v7a", "x86"
            }
            packagingOptions {
                exclude "arm64-v8a"
            }
        }
        debug {
            signingConfig signingConfigs.config
        }
    }
    dexOptions {
        preDexLibraries = false
        javaMaxHeapSize "2g"
    }
    compileOptions {
        sourceCompatibility JavaVersion.VERSION_1_7
        targetCompatibility JavaVersion.VERSION_1_7
    }
    productFlavors {
    }
}


dependencies {
    compile fileTree(include: ['*.jar'], dir: 'libs')
    testCompile 'junit:junit:4.12'
    compile 'com.android.support:appcompat-v7:24.2.0'
    compile 'com.facebook.fresco:fresco:0.9.0+'
    compile 'com.android.support:support-v4:24.2.0'
    compile 'com.android.support:multidex:1.0.1'
    compile project(':OneSDK')
}</span>
           

繼續閱讀