先说说我的情况吧
原来项目是用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>