Build apk正在抛出此问题,但能够在无法通过Build Apk生成apk文件的设备上运行。好几个月前,它是好的,我能够制作一个构建apk,但经过几次更新,我得到了以下构建问题。我在互联网上搜索了很多,但没有什么对我有用我已经发布了下面的消息和build.gradle文件。
gradle.properties:
org.gradle.jvmargs=-Xmx1563M
build.gradle:
apply plugin: 'com.android.application'
apply plugin: 'com.google.firebase.firebase-crash'
apply plugin: 'realm-android'
android {
compileSdkVersion 25
buildToolsVersion "25.0.3"
defaultConfig {
applicationId "com.xxxxxxxx"
minSdkVersion 17
targetSdkVersion 25
versionCode 2
versionName "1.0"
multiDexEnabled true
vectorDrawables.useSupportLibrary = true
}
buildTypes {
debug {
debuggable true
}
release {
debuggable false
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
packagingOptions {
exclude 'META-INF/LICENSE.txt'
exclude 'META-INF/LICENSE'
exclude 'META-INF/NOTICE.txt'
exclude 'META-INF/NOTICE'
exclude 'LICENSE.txt'
exclude 'LICENSE'
exclude 'NOTICE'
exclude 'NOTICE.txt'
}
dexOptions {
javaMaxHeapSize "2g"
}
}
dependencies {
/*configurations {
all*.exclude group: 'com.android.support', module: 'support-v4'
}*/
compile fileTree(include: ['*.jar'], dir: 'libs')
/*androidTestCompile('com.android.support.test.espresso:espresso-core:2.2.2', {
exclude group: 'com.android.support', module: 'support-annotations'
})
testCompile 'junit:junit:4.12'*/
compile 'com.android.support:appcompat-v7:25.3.1'
compile 'com.android.support:multidex:1.0.1'
compile 'com.squareup.retrofit2:retrofit:2.0.2'
compile 'com.squareup.retrofit2:converter-gson:2.0.2'
compile 'com.squareup.okhttp3:logging-interceptor:3.2.0'
compile 'com.squareup.okhttp3:okhttp:3.2.0'
compile 'com.github.bumptech.glide:glide:3.7.0'
compile 'com.android.support:design:25.3.1'
compile 'com.android.support:cardview-v7:25.3.1'
compile 'com.afollestad.material-dialogs:core:0.9.4.3'
compile 'com.google.android.exoplayer:exoplayer:r2.2.0'
compile 'com.intuit.sdp:sdp-android:1.0.4'
compile 'com.android.support:recyclerview-v7:25.3.1'
compile 'org.apache.commons:commons-collections4:4.0'
compile 'org.apache.commons:commons-lang3:3.4'
compile ('com.squareup.retrofit2:converter-simplexml:2.0.2'){
exclude module: 'stax-api'
exclude module: 'stax'
exclude module: 'xpp3'
}
compile 'com.facebook.stetho:stetho:1.4.2'
compile 'com.uphyca:stetho_realm:2.0.0'
compile 'com.google.firebase:firebase-crash:10.2.0'
compile "io.reactivex.rxjava2:rxjava:2.1.3"
compile 'io.reactivex.rxjava2:rxandroid:2.0.1'
}
apply plugin: 'com.google.gms.google-services'
repositories {
mavenCentral()
}
错误讯息:
Information:Gradle tasks [:mobile:assembleDevDebug]
Error:UNEXPECTED TOP-LEVEL ERROR:
Error:java.lang.OutOfMemoryError: Java heap space
Error: at java.util.Arrays.copyOfRange(Arrays.java:3664)
Error: at java.lang.String.<init>(String.java:207)
Error: at com.android.dx.rop.cst.CstString.utf8BytesToString(CstString.java:158)
Error: at com.android.dx.rop.cst.CstString.<init>(CstString.java:200)
Error: at com.android.dx.cf.cst.ConstantPoolParser.parseUtf8(ConstantPoolParser.java:371)
Error: at com.android.dx.cf.cst.ConstantPoolParser.parse0(ConstantPoolParser.java:262)
Error: at com.android.dx.cf.cst.ConstantPoolParser.parse(ConstantPoolParser.java:150)
Error: at com.android.dx.cf.cst.ConstantPoolParser.parseIfNecessary(ConstantPoolParser.java:124)
Error: at com.android.dx.cf.cst.ConstantPoolParser.getPool(ConstantPoolParser.java:115)
Error: at com.android.dx.cf.direct.DirectClassFile.parse0(DirectClassFile.java:491)
Error: at com.android.dx.cf.direct.DirectClassFile.parse(DirectClassFile.java:406)
Error: at com.android.dx.cf.direct.DirectClassFile.parseToInterfacesIfNecessary(DirectClassFile.java:388)
Error: at com.android.dx.cf.direct.DirectClassFile.getMagic(DirectClassFile.java:251)
Error: at com.android.dx.command.dexer.Main.parseClass(Main.java:772)
Error: at com.android.dx.command.dexer.Main.access$1500(Main.java:85)
Error: at com.android.dx.command.dexer.Main$ClassParserTask.call(Main.java:1700)
Error: at com.android.dx.command.dexer.Main.processClass(Main.java:755)
Error: at com.android.dx.command.dexer.Main.processFileBytes(Main.java:723)
Error: at com.android.dx.command.dexer.Main.access$1200(Main.java:85)
Error: at com.android.dx.command.dexer.Main$FileBytesConsumer.processFileBytes(Main.java:1653)
Error: at com.android.dx.cf.direct.ClassPathOpener.processArchive(ClassPathOpener.java:284)
Error: at com.android.dx.cf.direct.ClassPathOpener.processOne(ClassPathOpener.java:166)
Error: at com.android.dx.cf.direct.ClassPathOpener.process(ClassPathOpener.java:144)
Error: at com.android.dx.command.dexer.Main.processOne(Main.java:677)
Error: at com.android.dx.command.dexer.Main.processAllFiles(Main.java:569)
Error: at com.android.dx.command.dexer.Main.runMultiDex(Main.java:366)
Error: at com.android.dx.command.dexer.Main.run(Main.java:275)
Error: at com.android.dx.command.dexer.Main.main(Main.java:245)
Error: at com.android.dx.command.Main.main(Main.java:106)
Error:Picked up _JAVA_OPTIONS: -Xmx512M
Error:Execution failed for task ':mobile:transformClassesWithDexForDevDebug'.
> com.android.build.api.transform.TransformException: com.android.ide.common.process.ProcessException: java.util.concurrent.ExecutionException: com.android.ide.common.process.ProcessException: Error while executing java process with main class com.android.dx.command.Main with arguments {--dex --num-threads=4 --multi-dex --main-dex-list D:\AndStudio\AndroidStudioProjects\Matrix\mobile\build\intermediates\multi-dex\dev\debug\maindexlist.txt --output D:\AndStudio\AndroidStudioProjects\Matrix\mobile\build\intermediates\transforms\dex\dev\debug\folders\1000\1f\main D:\AndStudio\AndroidStudioProjects\Matrix\mobile\build\intermediates\transforms\jarMerging\dev\debug\jars\1\1f\combined.jar}
Information:BUILD FAILED
Information:Total time: 4 mins 38.409 secs
Information:33 errors
Information:0 warnings
Information:See complete output in console
对此的解决方案将是非常好的,并感谢所有人。
答案 0 :(得分:0)
尝试替换此Google服务版本并检查
com.google.android.gms:play-services-base:6.5.87