[英]Android Multidex issue
升级到Android Studio 2.2
之后,我的应用出现了问题: Multidex 64k methods limit
。
但是,我的应用程序是一个非常简单的应用程序,它只有几个库。
这是我的成就:
apply plugin: 'com.android.application'
android {
compileSdkVersion 25
buildToolsVersion "23.0.2"
defaultConfig {
applicationId "com.digitalborder.webappessentials"
minSdkVersion 19
targetSdkVersion 23
versionCode 24
versionName "2.2.2"
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
useLibrary 'org.apache.http.legacy'
}
dependencies {
compile fileTree(dir: 'libs', include: ['*.jar'])
testCompile 'junit:junit:4.12'
compile 'com.android.support:appcompat-v7:25.0.0'
compile 'com.android.support:support-v4:25.0.0'
compile 'com.android.support:design:25.0.0'
compile 'com.google.android.gms:play-services:9.6.1'
compile 'com.google.firebase:firebase-core:9.2.0'
}
apply plugin: 'com.google.gms.google-services'
有人能帮我吗?
谢谢!
问题的原因很可能是播放服务:
compile 'com.google.android.gms:play-services:9.6.1'
如果您确实需要此功能,请尝试选择其中的专用部分。 它被分成几个较小的库,例如:
com.google.android.gms:play-services-auth:9.8.0
com.google.android.gms:play-services-ads:9.8.0
com.google.android.gms:play-services-games:9.8.0
完整列表在这里 。
要么
您可以尝试以下代码;
defaultConfig {
applicationId "com.digitalborder.webappessentials"
minSdkVersion 19
targetSdkVersion 23
versionCode 24
versionName "2.2.2"
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
multiDexEnabled true
}
dependencies {
compile fileTree(dir: 'libs', include: ['*.jar'])
testCompile 'junit:junit:4.12'
compile 'com.android.support:appcompat-v7:25.0.0'
compile 'com.android.support:support-v4:25.0.0'
compile 'com.android.support:design:25.0.0'
compile 'com.google.android.gms:play-services:9.6.1'
compile 'com.google.firebase:firebase-core:9.2.0'
compile 'com.android.support:multidex:1.0.1'
}
并创建新的班级
public class myApplicationClass extends Application{
@Override
public void onCreate() {
MultiDex.install(getApplicationContext());
super.onCreate();
}
}
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.