【发布时间】:2018-08-14 11:42:49
【问题描述】:
我正在将 Appbrain Sdk for Ads 添加到我的应用 gradle
compile 'com.appbrain:appbrain-sdk:14.30'
现在我收到此错误:
错误:.dex 文件中的方法引用数不能超过 64K。
我按照说明将multiDexEnabled true 添加到我的代码中,得到OutOfMemoryException
这是我的代码
我的app build.gradle
apply plugin: 'com.android.application'
android {
compileSdkVersion 26
buildToolsVersion "26.0.2"
defaultConfig {
applicationId "com.webstore.footballscores"
minSdkVersion 17
targetSdkVersion 26
versionCode 8
versionName "1.7"
multiDexEnabled true
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
dexOptions {
jumboMode true
}
}
dependencies {
compile fileTree(dir: 'libs', include: ['*.jar'])
compile 'com.android.support:appcompat-v7:26.1.0'
compile 'com.google.code.gson:gson:2.7'
compile 'com.squareup.retrofit2:retrofit:2.3.0'
compile 'com.squareup.retrofit2:converter-gson:2.3.0'
compile 'com.squareup.okhttp3:okhttp-urlconnection:3.4.1'
compile 'com.android.support:design:26.1.0'
compile 'com.android.support:recyclerview-v7:26.1.0'
compile 'com.android.support:support-v4:26.1.0'
compile 'com.google.android.gms:play-services-ads:15.0.1'
compile 'com.facebook.android:audience-network-sdk:4.23.0'
compile 'com.google.firebase:firebase-core:16.0.0'
compile 'com.google.firebase:firebase-iid:16.0.0'
compile 'com.google.firebase:firebase-messaging:17.0.0'
compile 'com.google.android.gms:play-services-analytics:16.0.0'
compile 'com.google.android.gms:play-services-tagmanager:16.0.0'
compile 'com.firebase:firebase-jobdispatcher-with-gcm-dep:0.8.0'
compile 'com.android.support.constraint:constraint-layout:1.0.2'
compile 'com.startapp:inapp-sdk:3.9.3'
compile 'com.appbrain:appbrain-sdk:14.30'
testCompile 'junit:junit:4.12'
}
apply plugin: 'com.google.gms.google-services'
com.google.gms.googleservices.GoogleServicesPlugin.config.disableVersionCheck=true
【问题讨论】:
-
请添加您的堆栈跟踪或 gradle 输出。您测试的 sdk 也会很有趣
-
使用
compile 'com.appbrain:appbrain-sdk:14.20'并设置dexOptions { javaMaxHeapSize "Xg" } -
@IntelliJAmiya 我应该添加
multiDexEnabled true还是删除它? -
@Tito 的不要删除。阅读stackoverflow.com/a/33430306/3395198
-
@IntelliJAmiya 我再次点击链接,它可以工作,谢谢
标签: android firebase google-play-services