Build Java ver error on Android Studio - java

I am hoping someone could shed some light on the following build error I get when trying to launch a project in Android Studio just imported form Eclipse:
Error:Execution failed for task ':dIveApp:dexDebug'.
com.android.ide.common.process.ProcessException: org.gradle.process.internal.ExecException: Process 'command '/Library/Java/JavaVirtualMachines/jdk1.7.0_11.jdk/Contents/Home/bin/java'' finished with non-zero exit value 2
I am running on OS X Yosemite 10.10 and running java 8.0 Update 60 (build 1.8.8_60-b27). the url above seems to reference jdk1.7.0_11jdk, not sure if this is the issue or how to check.
Cheers

Look at gradle console log, most probably you will see an exact error.
Most of the time this is because you added the same package few times - library for different modules or in different places.
If not - try to clean - rebuild project.
p.s. You can change JDK for project in File -> Project Structure
Also, there is already answers for this question
Error:Execution failed for task ':app:dexDebug'. com.android.ide.common.process.ProcessException

Related

Error: Program type already present: com.rom4ek.arcnavigationview.R

Successfully compiled app eventually got stuck when I an changed icon color. Hence I closed the emulator. After that when I rerun the emulator , I always receive below build gradle error. And a previous version of the app is available in the emulator but not the new changes.
Any idea on how to fix this issue ?
build failed 11 s 936 ms
Run build 10 s 560 ms
Program type already present: com.rom4ek.arcnavigationview.R
org.gradle.workers.internal.DefaultWorkerExecutor$WorkExecutionException: A failure occurred while executing
com.android.build.gradle.internal.transforms.DexArchiveBuilderTransform$DexConversionWorkAction
org.gradle.tooling.BuildException: Failed to process C:\Users\Desktop\Project\testapp\app\build\intermediates\javac\debug\classes
com.android.builder.dexing.DexArchiveBuilderException: Failed to process C:\Users\Desktop\Project\testapp\app\build\intermediates\javac\debug\classes
com.android.builder.dexing.DexArchiveBuilderException: Error while dexing.
com.android.tools.r8.CompilationFailedException: Compilation failed to complete
com.android.tools.r8.utils.AbortException: Error: Program type already present: com.rom4ek.arcnavigationview.R
Build > Clean Project > Rebuild Project solved the issue.
Build > Clean Project > Rebuild Project solved the issue.

Android Studio 2.1 won't run my App [duplicate]

This question already has answers here:
com.android.build.transform.api.TransformException
(25 answers)
Closed 6 years ago.
I've just updated my Android Studio version to the new 2.1.
The problem is after I've launched my AVD, and I try to run my App, it crashes giving me a list of errors:
1st:
Error:Error converting bytecode to dex:
Cause: java.lang.RuntimeException: Exception parsing classes
2nd:
Error:1 error; aborting
:app:transformClassesWithDexForDebug FAILED
3rd:
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_45\bin\java.exe'' finished with non-zero exit value 1
EDIT:
Going to the right-top corner all the way through "Gradel" panel > :app > Tasks > build > double clicking on clean solved my issue!
I think this post might be useful to you:
com.android.build.transform.api.TransformException
From the post:
First clean your project. Go to the right hand side "gradle" pane, look for the clean task and execute it. Many times I've had this problem and I could get it to work just by cleaning the project.
If it does not work, then set the multiDexEnabled property to true:
defaultConfig {
multiDexEnabled true
}
Do it in your app's build.gradle.
I hope it helps!

Android Studio Error at compiling - :app:preDexDebug

:app:preDexDebug
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) ...
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)
Hope you will find the error, cause I didn't although I have looked for an answer ...
Error:Execution failed for task ':app:preDexDebug'.
> com.android.ide.common.process.ProcessException: org.gradle.process.internal.ExecException: Process 'command 'C:\Program Files\Java\jdk1.7.0_79\bin\java.exe'' finished with non-zero exit value 1
I had similar issues because the compiler didn't have enough memory to execute. Try to increase the memory for gradle or the build system you are using.
In the Project SDK section, when you add an Android SDK you should provide the Java SDK and all my Android SDKs uses Java 8 as SDK so it create the class files with the wrong version even if the Project level is 1.7 (i don't know why, i supposed that everything was choosed by Project level).
Now i changed the SDK (the java version "1.x.0" part.)
Here The Image TO View
and it seems to compile fine.
The reason that worked before today was because my SDK was 1.8 and not Android API x

Setting up firebase in android studio gives error

I am currently working on an app in android studio, and i need some simple server implementation to log some data. I've run through the setup tutorial on the firebase website: https://www.firebase.com/docs/android/quickstart.html, but when i try to run the app it gives me this error:
Error:Execution failed for task ':app:dexDebug'.
com.android.ide.common.process.ProcessException: org.gradle.process.internal.ExecException: Process 'command 'C:\Program Files\Java\jdk1.8.0_60\bin\java.exe'' finished with non-zero exit value 2
I figured that maybe it has something to do with the .jar file that i had to place into my libs folder, or maybe i have the wrong jdk?
Any help would be appreciated
Add this in your gradle. This will solve the issue for me.
dexOptions{
javaMaxHeapSize "4g"
}

IntelliJ 14 Unable to generate JavaFX exe

I am trying to package an app to an exe file, (including java8, so it is self contained). The app needs to run on any machine even if java is not installed.
Here is a screenshot of my settings:
I get this as an error:
Error:Java FX Packager:
BUILD FAILED
/home/foo/.IntelliJIdea14/system/compile-server/_temp_/build0.xml:11:
Total time: 0 seconds
Error:Java FX Packager: Buildfile: /home/foo/.IntelliJIdea14/system/compile-server/_temp_/build0.xml
build artifact:
Error:Java FX Packager: fx:deploy task has failed.
Now what am I supposed to get from this error ?
How can I fix this and get my app executable?

Categories

Resources