私のコードはデバイス上で正常に動作していますが、署名付き APK を生成しようとすると、エラーが発生し始めます。
Information:Gradle tasks [:assembleRelease]
Error:UNEXPECTED TOP-LEVEL ERROR:
Error:java.lang.OutOfMemoryError: GC overhead limit exceeded
Error:Execution failed for task ':transformClassesWithDexForRelease'.
> com.android.build.api.transform.TransformException:com.android.ide.common.process.ProcessException:java.util.concurrent.ExecutionException:
java.lang.UnsupportedOperationException
Information:BUILD FAILED
私のGradleファイルで問題を引き起こしているのはこの行だけです.この行を削除すると、署名されたAPKが生成されます.
compile 'com.google.android.gms:play-services:9.6.1'
これが私のGradleファイルです。
buildscript {
repositories {
mavenCentral()
}
dependencies {
classpath 'com.android.tools.build:gradle:2.2.1'
}
}
apply plugin: 'com.android.application'
android {
compileSdkVersion 23
buildToolsVersion "23.0.1"
useLibrary 'org.apache.http.legacy'
defaultConfig {
minSdkVersion 15
targetSdkVersion 23
versionCode = 2
versionName = "1.0.2"
multiDexEnabled true
}
sourceSets {
main {
manifest.srcFile 'AndroidManifest.xml'
java.srcDirs = ['src']
resources.srcDirs = ['src']
aidl.srcDirs = ['src']
renderscript.srcDirs = ['src']
res.srcDirs = ['res']
assets.srcDirs = ['assets']
jniLibs.srcDirs = ['libs']
jni.srcDirs = []
}
instrumentTest.setRoot('tests')
}
signingConfigs {
release
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
packagingOptions {
exclude 'META-INF/DEPENDENCIES'
exclude 'META-INF/NOTICE'
exclude 'META-INF/LICENSE'
exclude 'META-INF/LICENSE.txt'
exclude 'META-INF/NOTICE.txt'
}
}
// ~/.gradle/gradle.properties
if (project.hasProperty('keystoreFile') &&
project.hasProperty('keystorePassword') &&
project.hasProperty('keystoreAliasPassword')) {
android.signingConfigs.release.storeFile = file(keystoreFile)
android.signingConfigs.release.storePassword = keystorePassword
android.signingConfigs.release.keyPassword = keystoreAliasPassword
android.signingConfigs.release.keyAlias = keystoreAlias
} else {
android.buildTypes.release.signingConfig = null
}
dependencies {
compile fileTree(include: ['*.jar'], dir: 'libs')
compile 'com.android.support:support-v4:23.0.1'
compile 'com.google.android.gms:play-services:9.6.1'
}