简体   繁体   中英

Gradle build error in Android Project

I am getting following build error

Execution failed for task ':app:transformClassesWithDexForDebug'.

com.android.ide.common.process.ProcessException: org.gradle.process.internal.ExecException: Process 'command '/Library/Java/JavaVirtualMachines/jdk1.8.0_25.jdk/Contents/Home/bin/java'' finished with non-zero exit value 1

build --debug

build --stacktrace

build --info

Look at the --debug log. There is a very verbose error description starting with the text:

trouble processing "javax/transaction/HeuristicCommitException.class":

Ill-advised or mistaken usage of a core class (java.* or javax.*) when not building a core library.

This is often due to inadvertently including a core library file in your application's project, when using an IDE (such as Eclipse). If you are sure you're not intentionally defining a core class, then this is the most likely explanation of what's going on.

I think the bottom line is that you shouldn't be including libraries that contain classes defined in java.* or javax.*. You'll have to trim down your dependencies. Android development can not normally handle J2EE type code.

  1. Try cleaning your project.

  2. If that doesn't works then: Try adding multiDexEnabled true to your app build.gradle file

Add

dexOptions {
            preDexLibraries = false
            additionalParameters=['--core-library']
}

In you app level gradel inside android..It will work 100%

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM