I watched so many threads here and still didnt find working solution.
When I want to BUILD APK, I get this main error:
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.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
C:\Users\ratik\Desktop\BUILDBOX\VOLUNTEER\STUDIO\app\build\intermediates\multi-dex\debug\maindexlist.txt
--output C:\Users\ratik\Desktop\BUILDBOX\VOLUNTEER\STUDIO\app\build\intermediates\transforms\dex\debug\folders\1000\1f\main
C:\Users\ratik\Desktop\BUILDBOX\VOLUNTEER\STUDIO\app\build\intermediates\transforms\jarMerging\debug\jars\1\1f\combined.jar}
There is few more errors, but then apear only sometimes, some of them:
Error: at
com.android.dx.cf.direct.ClassPathOpener.processArchive(ClassPathOpener.java:284)
Error: at
com.android.dx.command.dexer.Main.processFileBytes(Main.java:723)
Error: at
com.android.dx.cf.direct.DirectClassFile.parseToInterfacesIfNecessary(DirectClassFile.java:388)
Error:java.lang.OutOfMemoryError: GC overhead limit exceeded
What I tried:
In build.gradle
apply plugin: 'com.android.application'
android {
compileSdkVersion 25
buildToolsVersion "25.0.2"
defaultConfig {
applicationId "com.biif.volunteer"
minSdkVersion 14
targetSdkVersion 25
multiDexEnabled true
ndk {
moduleName "player_shared"
}
}
buildTypes {
release {
minifyEnabled false
shrinkResources false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.txt'
}
}
sourceSets.main {
jni.srcDirs = []// <-- disable automatic ndk-build call
}
}
dependencies {
compile ('com.google.android.gms:play-services:+'){exclude module: 'support-v4'}
compile files('libs/dagger-1.2.2.jar')
compile files('libs/javax.inject-1.jar')
compile files('libs/nineoldandroids-2.4.0.jar')
compile files('libs/support-v4-19.0.1.jar')
compile ('com.android.support:multidex:1.0.1')
}
In Manifest
android:name="android.support.multidex.MultiDexApplication"
Plus I turned off Instant run (saw in one thread here).
Nothing helped :( Any ideas please? Thanks for help guys :)
I included gradle.properties file in the project with:
org.gradle.jvmargs=-Xmx10248m -XX:+HeapDumpOnOutOfMemoryError -Dfile.encoding=UTF-8
and it works.
Related
hey when i try to build my apk on android i got this error i don't what it means can you help me ? :
Error:Execution failed for task ':app:transformClassesWithJarMergingForDebug'. > com.android.build.api.transform.TransformException: java.util.zip.ZipException: duplicate entry: android/support/v4/print/PrintHelper$PrintHelperStubImpl.class
here is my build.gradle file :
apply plugin: 'com.android.application'
android {
compileSdkVersion 26
buildToolsVersion "26.0.1"
defaultConfig {
applicationId "com.frgg.apps.thetri"
minSdkVersion 14
targetSdkVersion 23
multiDexEnabled true
dexOptions {
javaMaxHeapSize "4g"
}
ndk {
moduleName "player_shared"
}
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.txt'
}
}
sourceSets.main {
jni.srcDirs = []// <-- disable automatic ndk-build call
}
productFlavors {
}
}
dependencies {
compile('com.google.android.gms:play-services:+') { exclude module: 'support-v4' }
compile files('libs/dagger-1.2.2.jar')
compile files('libs/javax.inject-1.jar')
compile files('libs/nineoldandroids-2.4.0.jar')
compile files('libs/support-v4-19.0.1.jar')
}
Error does not show up during gradle sync. But show up when i try to build the apk
What could be the problem?
EDIT
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.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 C:\Users\hotrod\Desktop\APPS\android5\app\build\intermediates\multi-dex\debug\maindexlist.txt --output C:\Users\hotrod\Desktop\APPS\android5\app\build\intermediates\transforms\dex\debug\folders\1000\1f\main C:\Users\hotrod\Desktop\APPS\android5\app\build\intermediates\transforms\jarMerging\debug\jars\1\1f\combined.jar}
Remove
compile('com.google.android.gms:play-services:+') { exclude module: 'support-v4' }
compile files('libs/support-v4-19.0.1.jar') //Remove from Local Drive
Use
compile 'com.android.support:support-v4:23.0.1'
compile 'com.google.android.gms:play-services:11.0.4'
FYI
Remove above library from local libs folder also
Finally, Clean-Rebuild and Run .
Would you please explain about the error message and solution?
I was working on android studio , My task was very easy , just adding 2 numbers using a library . Last time when it run successfully , I didn't add the jar file
. But After adding the jar file , the project run no longer . When I press run , it shows the error message and stop working .
Error:Execution failed for task ':app:transformClassesWithDexForDebug'.
com.android.build.api.transform.TransformException: java.lang.RuntimeException: com.android.ide.common.process.ProcessException: java.util.concurrent.ExecutionException: com.android.ide.common.process.ProcessException: org.gradle.process.internal.ExecException: Process 'command 'C:\Program Files\Java\jdk1.8.0_74\bin\java.exe'' finished with non-zero exit value 1
Information:BUILD FAILED
Information:Total time: 5.158 secs
Information:3 errors
Information:0 warnings
Information:See complete output in console
Full error message log
My Full Java and XML code
Library
project : build.gradle code
Gradle file
apply plugin: 'com.android.application'
android {
compileSdkVersion 23
buildToolsVersion "23.0.3"
defaultConfig {
applicationId "com.blogspot.virtualn0t3b00k.myapplication"
minSdkVersion 8
targetSdkVersion 23
versionCode 1
versionName "1.0"
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
}
dependencies {
compile fileTree(include: ['*.jar'], dir: 'libs')
testCompile 'junit:junit:4.12'
compile 'com.android.support:appcompat-v7:23.3.0'
compile files('libs/flanagan.jar')
}
So after downloading your code, the real error is below...
The problem is that Android can't run Java 8 compiled code, which is what the library uses if you read
The current version of Java Platform 8 used in compiling the classes in flanagan.jar is jdk1.8.0.
Also, the JAR file includes some AWT and Swing packages that aren't included in the Android SDK, so the code wouldn't compile completely, anyway.
And that would explain why you say
After adding the jar file , the project run no longer
The error
Dex: Error converting bytecode to dex:
Cause: java.lang.RuntimeException: Exception parsing classes
UNEXPECTED TOP-LEVEL EXCEPTION:
java.lang.RuntimeException: Exception parsing classes
at com.android.dx.command.dexer.Main.processClass(Main.java:752)
at com.android.dx.command.dexer.Main.processFileBytes(Main.java:718)
at com.android.dx.command.dexer.Main.access$1200(Main.java:85)
at com.android.dx.command.dexer.Main$FileBytesConsumer.processFileBytes(Main.java:1645)
at com.android.dx.cf.direct.ClassPathOpener.processArchive(ClassPathOpener.java:284)
at com.android.dx.cf.direct.ClassPathOpener.processOne(ClassPathOpener.java:166)
at com.android.dx.cf.direct.ClassPathOpener.process(ClassPathOpener.java:144)
at com.android.dx.command.dexer.Main.processOne(Main.java:672)
at com.android.dx.command.dexer.Main.processAllFiles(Main.java:574)
at com.android.dx.command.dexer.Main.runMonoDex(Main.java:311)
at com.android.dx.command.dexer.Main.run(Main.java:277)
at com.android.dx.command.dexer.Main.main(Main.java:245)
at com.android.dx.command.Main.main(Main.java:106)
Caused by: com.android.dx.cf.iface.ParseException: bad class file magic (cafebabe) or version (0034.0000)
at com.android.dx.cf.direct.DirectClassFile.parse0(DirectClassFile.java:472)
at com.android.dx.cf.direct.DirectClassFile.parse(DirectClassFile.java:406)
at com.android.dx.cf.direct.DirectClassFile.parseToInterfacesIfNecessary(DirectClassFile.java:388)
at com.android.dx.cf.direct.DirectClassFile.getMagic(DirectClassFile.java:251)
at com.android.dx.command.dexer.Main.parseClass(Main.java:764)
at com.android.dx.command.dexer.Main.access$1500(Main.java:85)
at com.android.dx.command.dexer.Main$ClassParserTask.call(Main.java:1684)
at com.android.dx.command.dexer.Main.processClass(Main.java:749)
... 12 more
1 error; aborting
:app:transformClassesWithDexForDebug FAILED
Add this in your build.gradle after buildTypes and before dependencies and yes don't forget to remove unused jar files and compile files(libraries).
android {
packagingOptions {
exclude 'META-INF/DEPENDENCIES'
exclude 'META-INF/NOTICE'
exclude 'META-INF/LICENSE'
exclude 'META-INF/LICENSE.txt'
exclude 'META-INF/NOTICE.txt'
exclude 'META-INF/ASL2.0'
exclude 'META-INF/notice.txt'
exclude 'META-INF/license.txt'
}
}
Clean your project once after doing all.
Enable multidex support in build.gradle configuration.
apply plugin: 'com.android.application'
android {
compileSdkVersion 23
buildToolsVersion "23.0.3"
defaultConfig {
applicationId "com.blogspot.virtualn0t3b00k.myapplication"
multiDexEnabled true
minSdkVersion 8
targetSdkVersion 23
versionCode 1
versionName "1.0"
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
dexOptions {
javaMaxHeapSize "4g"
preDexLibraries = false
}
}
dependencies {
compile fileTree(include: ['*.jar'], dir: 'libs')
testCompile 'junit:junit:4.12'
compile 'com.android.support:appcompat-v7:23.3.0'
}
If also failed then add following code in your application class
protected void attachBaseContext(Context base)
{
super.attachBaseContext(base);
MultiDex.install(this);
}
Probably your problem will be solved.
Try adding this in build.gradle file
defaultConfig {
// Enabling multidex support.
multiDexEnabled true
}
Please remove the line
compile files('libs/flanagan.jar')
from app's build.gradle file because
compile fileTree(include: ['*.jar'], dir: 'libs')
line includes the library flanagan.jar which is in libs folder.So adding
compile files('libs/flanagan.jar') is duplicating and giving the error
I'm working on Android Studio 1.5 and my gradle is the following:
apply plugin: 'com.android.application'
android {
compileSdkVersion 14
buildToolsVersion "23.0.2"
defaultConfig {
applicationId "com.beatzplayer"
minSdkVersion 14
targetSdkVersion 14
multiDexEnabled true
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.txt'
}
debug {
minifyEnabled false
}
}
}
dependencies {
compile files('libs/jl1.0.1.jar')
compile files('libs/JLayer1.0.1.jar')
compile files('libs/mp3spi1.9.4.jar')
compile files('libs/tritonus_share.jar')
}
I've sync, cleaned and rebuilt the Gradle but when I tried to run the app after choosing the device the app gave me this error:
Error:Execution failed for task ':app:transformClassesWithJarMergingForDebug'.
> com.android.build.api.transform.TransformException: java.util.zip.ZipException: duplicate entry: javazoom/jl/converter/Converter$PrintWriterProgressListener.class
After that, I read Error after adding play-services library : ':app:transformClassesWithJarMergingForDebug' so I add the following code:
compile('libs/JLayer1.0.1.jar') {
exclude module: 'converter'
}
When I sync again the gradle it reported me this one:
Error:(29, 0) Gradle DSL method not found: 'exclude()'
I thing as error say you have one jar file with different name having same classes
compile files('libs/jl1.0.1.jar')
compile files('libs/JLayer1.0.1.jar')
Both are same if one is not need delete that than build gradel
once again
I am getting an ':app:packageAllDebugClassesForMultiDex' Error when I try to build an application using the YouTubeData API. I have researched several other threads that cover this error and the conclusion that I have come to is that I have libraries in my build file that are creating a duplicated reference to build files. I know that the file triggering the error is:
'com/google/api/client/googleapis/json/GoogleJsonErrorContainer.class'
but how do I exclude the reference from the build file with out removing the entire library?
This is my build file
apply plugin: 'com.android.application'
android {
compileSdkVersion 21
buildToolsVersion "21.1.2"
defaultConfig {
applicationId "co.hannalupi.fitnessblenderapp"
minSdkVersion 16
targetSdkVersion 21
versionCode 1
versionName "1.0"
multiDexEnabled true
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
}
repositories {
mavenCentral()
}
dependencies {
compile fileTree(dir: 'libs', include: ['*.jar'])
compile 'com.android.support:multidex:1.0.0'
compile 'com.android.support:appcompat-v7:22.0.0'
compile files('libs/YouTubeAndroidPlayerApi.jar')
compile 'com.squareup.picasso:picasso:2.5.2'
compile 'com.google.apis:google-api-services-youtube:v3-rev136-1.20.0'
}
This is the error I get:
FAILURE: Build failed with an exception.
* What went wrong:
Execution failed for task ':app:packageAllDebugClassesForMultiDex'.
> java.util.zip.ZipException: duplicate entry: com/google/api/client/googleapis/json/GoogleJsonErrorContainer.class
I am new to Android, any direction you can point me in would be greatly appreciated. Thanks in advance.
An update for folks having a similar error - As a last resort I deleted the project file that I was working in from my desktop and cloned a fresh copy from GitHub. Importing and running the fresh copy gave me no errors!!
I didn't modified library dependencies or even build.gradle script at all, just modified some code but this error showed up suddenly while it didn't before.
>Execution failed for task ':app:dexDebug'.
> com.android.ide.common.process.ProcessException: org.gradle.process.internal.ExecException: Process 'command 'C:\Program Files\Java\jdk1.7.0_15\bin\java.exe'' finished with non-zero exit value 2
I tried using --stacktrace --debug but not quite understand what I saw and it seemed the error just popped up suddenly like so
>Merged dex A (3701 defs/5082.9KiB) with dex B (266 defs/275.0KiB). Result is 3967 defs/5328.6KiB. Took 1.3s
Result compacted from 10118.4KiB to 8222.8KiB to save 1895.6KiB
Merged dex A (3967 defs/5328.6KiB) with dex B (3293 defs/2941.1KiB). Result is 7260 defs/8222.8KiB. Took 1.6s
>AGPBI: {"kind":"SIMPLE","text":"UNEXPECTED TOP-LEVEL EXCEPTION:","position":{},"original":"UNEXPECTED TOP-LEVEL EXCEPTION:"}
Now, what could be wrong or what can I do to understand what went wrong?
This is my gradle script, for reference
android {
compileSdkVersion 21
buildToolsVersion "21.1.2"
defaultConfig {
applicationId "com.xxx.yyy"
minSdkVersion 16
targetSdkVersion 21
versionCode 24
versionName "2.1.2"
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
dexOptions {
javaMaxHeapSize "2g"
}
}
dependencies {
compile fileTree(include: ['*.jar'], dir: 'libs')
compile 'com.google.android.gms:play-services:6.1.71'
compile 'com.actionbarsherlock:actionbarsherlock:4.4.0#aar'
compile 'com.facebook.android:facebook-android-sdk:3.21.1'
compile 'net.simonvt.menudrawer:menudrawer:3.0.+#aar'
compile 'com.commonsware.cwac:sacklist:1.0.0'
compile 'com.commonsware.cwac:merge:1.1.+'
compile 'com.loopj.android:android-async-http:1.4.5'
compile project(':library')
}
I managed to solve it by adding multiDexEnabled true under defaultConfig section in my gradle script, don't know for sure why though.
UPDATE
It is due to 65K limit just as #clemp6r explained in the comment.