I am facing following issue while running application.
Error:Execution failed for task ':app:transformJackWithJackForDebug'.
com.android.sched.scheduler.RunnerProcessException: Error during
'MethodIdMerger' runner on '': GC overhead limit exceeded
I have also declared heap size in gradle file
dexOptions {
preDexLibraries = false
javaMaxHeapSize "4g"
}
I am using android studio 2.2 and JackOption is enabled.
Update : build.gradle included
apply plugin: 'com.android.application'
repositories {
mavenCentral()
}
android {
compileSdkVersion 23
buildToolsVersion '24.0.2'
compileOptions.encoding = 'ISO-8859-1'
useLibrary('org.apache.http.legacy')
lintOptions{
abortOnError false
}
packagingOptions {
exclude 'META-INF/LICENSE'
exclude 'META-INF/NOTICE.txt'
exclude 'META-INF/LICENSE.txt'
exclude 'META-INF/NOTICE'
exclude 'META-INF/services/com.fasterxml.jackson.core.JsonFactory'
}
defaultConfig {
applicationId "appID"
minSdkVersion 14
targetSdkVersion 22
versionCode 2033
versionName "6.1"
multiDexEnabled true
ndk {
abiFilters "armeabi", "x86"
}
jackOptions {
enabled true
}
}
dexOptions {
preDexLibraries = false
javaMaxHeapSize "4g"
}
buildTypes {
release {
minifyEnabled true
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
compileOptions {
sourceCompatibility JavaVersion.VERSION_1_8
targetCompatibility JavaVersion.VERSION_1_8
}
}
dependencies {
compile fileTree(include: ['*.jar'], dir: 'libs')
compile project(':SettingsPluginv9')
compile project(':DragLib')
compile 'com.android.support:multidex:1.0.1'
compile 'com.squareup.picasso:picasso:2.5.2'
compile project(':PDFViewCtrlTools')
compile project(':PullToRefreshLibrary')
compile project(':SmoothProgressBar')
compile project(':ViewpagerLibrary')
compile project(':BoxAndroidLibraryV2')
compile 'com.android.support:recyclerview-v7:23.0.1'
compile 'com.nuance:speechkit:2.1+#aar'
compile 'com.parse:parse-android:1.10.1'
}
any possible solution for it?
I am able to solve above problem by increasing memory size of Gradle Daemon VM to 2GB. To do that , You need to modify gradle.properties
Add following line in your properties file.
org.gradle.jvmargs=-Xmx2048m
Related
When I try to compile my project I get this weird error:
What went wrong:
Execution failed for task ':android:transformClassesWithDexBuilderForProdDevelopmentDebug'.
com.android.build.api.transform.TransformException: com.android.builder.dexing.DexArchiveBuilderException: com.android.builder.dexing.DexArchiveBuilderException: Failed to process /Users/.../.gradle/caches/transforms-1/files-1.1/play-services-location-11.2.2.aar/f5b9886774f73d8b64cfd9701f91e8cc/jars/classes.jar
What I tried:
Added multiDexEnabled true to app gradle.
Added android.enableD8.desugaring = true and android.enableD8=true to gradle.properties
Also removed .gradle folder and did rebuild + clean
Also did the following: SDK manager -> Google play services -> updated. Rebuild + clean afterwards.
AS version: 3.1.4
App gradle file:
apply plugin: 'com.android.application'
apply plugin: 'kotlin-android'
apply plugin: 'kotlin-android-extensions'
apply plugin: 'kotlin-kapt'
android {
compileSdkVersion Android.compileSdkVersion
buildToolsVersion Android.buildToolsVersion
flavorDimensions "...", "type"
defaultConfig {
applicationId "xxx"
versionName 'xxx'
versionCode xxx
minSdkVersion 21
targetSdkVersion Android.targetSdkVersion //Android.targetSdkVersion holds value "27"
multiDexEnabled true
}
dexOptions {
javaMaxHeapSize "6g"
preDexLibraries = true
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
productFlavors {
test {
dimension "xxx"
applicationIdSuffix '.xxx'
versionNameSuffix 'x'
manifestPlaceholders = [onesignal_app_id : "",
onesignal_google_project_number: ""]
}
production {
dimension "xxx"
manifestPlaceholders = [onesignal_app_id : "",
onesignal_google_project_number: ""]
}
development {
dimension "type"
resConfigs "xxhdpi"
}
normal {
dimension "type"
}
}
android.applicationVariants.all { variant ->
variant.outputs.all {
outputFileName = "..."
}
}
packagingOptions {
exclude 'META-INF/LICENSE'
exclude 'META-INF/NOTICE'
exclude 'META-INF/LICENSE.txt'
exclude 'META-INF/NOTICE.txt'
exclude 'META-INF/services/javax.annotation.processing.Processor'
exclude 'jsr305_annotations/Jsr305_annotations.gwt.xml'
exclude 'build-data.properties'
exclude 'error_prone/Annotations.gwt.xml'
exclude 'third_party/java_src/error_prone/project/annotations/Annotations.gwt.xml'
exclude 'third_party/java_src/error_prone/project/annotations/Google_internal.gwt.xml'
}
compileOptions {
sourceCompatibility JavaVersion.VERSION_1_8
targetCompatibility JavaVersion.VERSION_1_8
}
androidExtensions {
experimental = true
}
}
dependencies {
implementation project(':projectxxx')
implementation project(':tifCompanion')
implementation fileTree(include: ['*.jar'], dir: 'libs')
implementation files('libs/YouTubeAndroidPlayerApi.jar')
kapt "android.arch.lifecycle:compiler:1.1.1"
implementation "android.arch.lifecycle:extensions:1.1.1"
implementation "com.android.support.constraint:constraint-layout:1.1.0-beta5"
kapt "com.google.dagger:dagger-compiler:2.16"
api "com.android.support:leanback-v17:27.1.1"
implementation "com.android.support:leanback-v17:27.1.1"
api "com.android.support:recommendation:27.1.1"
implementation "com.android.support:recyclerview-v7:27.1.1"
implementation "com.android.support:support-vector-drawable:27.1.1"
}
projectxxx which was implemented has these dependencies:
dependencies {
api fileTree(include: ['*.jar'], dir: 'libs')
api project(':JsonAPI') //https://github.com/faogustavo/JSONApi
api "org.jetbrains.kotlin:kotlin-stdlib-jdk8:1.2.61"
implementation "com.onesignal:OneSignal:3.6.5"
api "com.google.android.gms:play-services-base:15.0.1"
api "com.google.android.gms:play-services-analytics:15.0.0"
api "com.android.support:support-annotations:27.1.1"
}
You are using all play-services with versions 15.x.x, and error is mentioning 11.2.2, this means that some other library is bringing in this dependency.
This type of error can be solved by following steps:
run ./gradlew :app:dependencies command in terminal. (This will generate dependency hierarchy)
Check for the dependency bringing in play-services-location dependency and exclude it from that dependency like below:
compile ('<dependency-bringing-play-services-location>') {
exclude group:'com.google.android.gms'
}
Add play-services location dependency explicitly.
While building APK for my android app the following error is shown:
Error:Execution failed for task ':app:transformClassesWithDexForDebug'.
> com.android.build.api.transform.TransformException: com.android.ide.common.process.ProcessException: java.util.concurrent.ExecutionException: com.android.dex.DexException: Multiple dex files define Lcom/google/firebase/iid/zzb;
I couldn't find what the error was. My module:app gradle file is:
apply plugin: 'com.android.application'
android {
compileSdkVersion 26
buildToolsVersion "27.0.0"
defaultConfig {
applicationId "//my application"
minSdkVersion 15
targetSdkVersion 26
versionCode 1
versionName "1.0"
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
}
dependencies {
compile fileTree(dir: 'libs', include: ['*.jar'])
androidTestCompile('com.android.support.test.espresso:espresso-core:2.2.2', {
exclude group: 'com.android.support', module: 'support-annotations'
})
compile 'com.android.support:design:26.+'
compile 'com.android.support:support-v4:26.+'
compile 'com.google.android.gms:play-services-fitness:11.0.0'
compile 'com.google.firebase:firebase-messaging:9.0.1'
compile 'com.mcxiaoke.volley:library:1.0.19'
compile 'com.google.code.gson:gson:2.6.1'
compile 'com.github.bumptech.glide:glide:3.7.0'
compile 'com.android.support:recyclerview-v7:26.+'
compile 'com.android.support:cardview-v7:26.+'
compile 'com.android.support:appcompat-v7:26.+'
compile 'com.android.support.constraint:constraint-layout:1.0.2'
testCompile 'junit:junit:4.12'
}
I read somewhere that Unless you have an absolute need to enable multiDex in your build.gradle DO NOT DO IT!
But when i removed the line from gradle file,
compile 'com.google.firebase:firebase-messaging:9.0.1'
then building apk was successful.
Since i need firebase in my application, this wouldn't be a solution for me.
can anyone help me?
You need to use same version of dependencies
Use this
compile 'com.google.android.gms:play-services-fitness:11.0.0'
compile 'com.google.firebase:firebase-messaging:11.0.0'
Instead of this
compile 'com.google.android.gms:play-services-fitness:11.0.0'
compile 'com.google.firebase:firebase-messaging:9.0.1'
Build gradle file
apply plugin: 'com.android.application'
android {
signingConfigs {
}
compileSdkVersion 26
buildToolsVersion "26.0.1"
defaultConfig {
applicationId "com.imageditor.Image"
minSdkVersion 19
targetSdkVersion 26
versionCode 1
versionName "1.0"
multiDexEnabled true
}
packagingOptions {
exclude 'META-INF/DEPENDENCIES'
exclude 'META-INF/NOTICE'
exclude 'META-INF/LICENSE'
exclude 'META-INF/license.txt'
exclude 'META-INF/notice.txt'
}
buildTypes {
release {
minifyEnabled true
proguardFiles getDefaultProguardFile('proguard-android.txt')
}
}
compileOptions {
sourceCompatibility JavaVersion.VERSION_1_7
targetCompatibility JavaVersion.VERSION_1_7
}
I am writing android project. Some of the external libraries requires the use of Java8. However, when I add Java8 using Jack, the project isn't recognizing the components of Java8. What might be the problem?
apply plugin: 'com.android.application'
android {
compileSdkVersion 25
buildToolsVersion "25.0.2"
defaultConfig {
applicationId "com.infiniteloop.android.translateyandex"
minSdkVersion 19
targetSdkVersion 25
versionCode 1
versionName "1.0"
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
multiDexEnabled true
jackOptions {
enabled true
}
}
dexOptions {
incremental true
}
packagingOptions {
exclude 'META-INF/DEPENDENCIES.txt'
exclude 'META-INF/LICENSE.txt'
exclude 'META-INF/NOTICE.txt'
exclude 'META-INF/NOTICE'
exclude 'META-INF/LICENSE'
exclude 'META-INF/DEPENDENCIES'
exclude 'META-INF/notice.txt'
exclude 'META-INF/license.txt'
exclude 'META-INF/dependencies.txt'
exclude 'META-INF/LGPL2.1'
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
compileOptions {
sourceCompatibility JavaVersion.VERSION_1_8
targetCompatibility JavaVersion.VERSION_1_8
}
buildscript {
tasks.withType(JavaCompile) {
}
}
configurations.all {
resolutionStrategy.force 'com.google.code.findbugs:jsr305:3.0.1'
}
repositories {
maven {
url "https://jitpack.io"
}
}
dependencies {
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'
})
compile 'com.android.support:appcompat-v7:25.2.0'
compile 'com.android.support.constraint:constraint-layout:1.0.2'
compile 'com.android.support:design:25.2.0'
compile 'com.github.vbauer:yandex-translate-api:1.2.5'
testCompile 'junit:junit:4.12'
}
And here is the error list
Errorlist
You use
multiDexEnabled true
Add above link to AndroidManifest.xml:
android:name="android.support.multidex.MultiDexApplication"
OR
MultiDex.install(this);
in your custom Application's attachBaseContext method
or your custom Application extend MultiDexApplication
and add above
compileOptions {
sourceCompatibility JavaVersion.VERSION_1_8
targetCompatibility JavaVersion.VERSION_1_8
}
Hope it help.
You can use this gradle plugin for getting java lambda support in java 6, 7 and android
Just add: apply plugin: 'me.tatarka.retrolambda'
line in your app level build.gradle file below the line: apply plugin: 'com.android.application'
Now in your project level build.gradle add :
classpath 'me.tatarka:gradle-retrolambda:3.6.0'
in your dependencies section
EG:
dependencies {
classpath 'com.android.tools.build:gradle:2.3.0'
classpath 'me.tatarka:gradle-retrolambda:3.6.0'
}
And sync it :)
Am getting en error while try to run the project
Error:Execution failed for task ':app:transformClassesWithJarMergingForDebug'.
> com.android.build.api.transform.TransformException: java.util.zip.ZipException: duplicate entry: android/support/annotation/DimenRes.class
Here is my build.gradle
apply plugin: 'com.android.application'
android {
compileSdkVersion 'Google Inc.:Google APIs:23'
buildToolsVersion "24.0.0"
compileOptions.encoding = 'windows-1251'
defaultConfig {
applicationId "org.radiomango.app"
minSdkVersion 11
targetSdkVersion 23
multiDexEnabled true
compileOptions {
sourceCompatibility JavaVersion.VERSION_1_7
targetCompatibility JavaVersion.VERSION_1_7
}
}
dexOptions {
javaMaxHeapSize "4g"
preDexLibraries = false
}
buildTypes {
release {
minifyEnabled true
proguardFiles 'proguard.cfg'
}
}
}
dependencies {
compile 'com.google.code.gson:gson:2.2.2'
compile files('libs/acra-4.5.0.jar')
compile files('libs/android-support-v13.jar')
compile files('libs/org.apache.commons.httpclient.jar')
compile files('libs/org.apache.http.legacy.jar')
compile project(':seekArc_library')
compile project(':socialauthandroid')
compile project(':SwipeMenuListView')
compile 'com.android.support:design:24.0.0'
}
i tried by cleaning the project
Build - > Clean
after that rebuild, But no effect
The i sync and clean the project, still no result.
Finally i restart the android studio, but the issue still exciting.
Can any one please help me
I think this is because you use compile files('libs/android-support-v13.jar') and compile 'com.android.support:design:24.0.0' may be this library are conflicting with each other.
Exclude part of library which is common in both of them.
Using exclude
e.g.
compile('com.commonsware.cwac:camera-v9:0.5.4') {
exclude module: 'support-v4'
}
Replace
compile files('libs/android-support-v13.jar')
with
com.android.support:support-v13:24.0.0
You added the design library, which also makes use of the support-v4 lib. If you add both via maven-dependency, this should be handled by gradle.
Replace
compile files('libs/android-support-v13.jar')
with
com.android.support:support-v13:24.0.0
Apply this in gradle also add packagingOptions
apply plugin: 'com.android.application'
android {
compileSdkVersion 'Google Inc.:Google APIs:23'
buildToolsVersion "24.0.0"
compileOptions.encoding = 'windows-1251'
defaultConfig {
applicationId "org.radiomango.app"
minSdkVersion 11
targetSdkVersion 23
multiDexEnabled true
compileOptions {
sourceCompatibility JavaVersion.VERSION_1_7
targetCompatibility JavaVersion.VERSION_1_7
}
}
packagingOptions {
exclude 'META-INF/NOTICE.txt' // will not include NOTICE file
exclude 'META-INF/LICENSE.txt' // will not include LICENSE file
}
dexOptions {
javaMaxHeapSize "4g"
preDexLibraries = false
}
buildTypes {
release {
minifyEnabled true
proguardFiles 'proguard.cfg'
}
}
}
dependencies {
compile 'com.google.code.gson:gson:2.2.2'
compile files('libs/acra-4.5.0.jar')
compile 'com.android.support:appcompat-v7:23.4.0'
complie `com.android.support:support-v13:24.0.0` //or you used 23.4.0
compile files('libs/org.apache.commons.httpclient.jar')
compile files('libs/org.apache.http.legacy.jar')
compile project(':seekArc_library')
compile project(':socialauthandroid')
compile project(':SwipeMenuListView')
compile 'com.android.support:design:24.0.0'//or you used compile 'com.android.support:design:23.4.0'
}
I try launch android project and get error
Error Code: 2
Output: UNEXPECTED TOP-LEVEL EXCEPTION: com.android.dex.DexException: Multiple dex files define Landroid/support/annotation/AnimRes;
My gradle file:
apply plugin: 'com.android.application'
android {
compileSdkVersion 21
buildToolsVersion "21.1.0"
defaultConfig {
applicationId "nit.livetex.livetexsdktestapp"
minSdkVersion 10
targetSdkVersion 21
versionCode 1
versionName "1.0"
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
compileOptions {
sourceCompatibility JavaVersion.VERSION_1_7
targetCompatibility JavaVersion.VERSION_1_7
}
}
dependencies {
compile files("libs/sdk.jar")
compile 'com.android.support:appcompat-v7:21.0.0'
}
I think It occurs because of using support-library in sdk.jar.
Where I should add exclude rule?
I am not sure but can you try that please?
compile('com.android.support:appcompat-v7:21.0.0') {
exclude group: 'com.android.support', module: 'support-v4'
}
or
compile files("libs/sdk.jar"){
exclude group: 'com.android.support', module: 'support-v4'
}