3

I ported my app from Eclipse to Android Studio, and now my app won't run. Just to be clear, I did not export from Eclipse. I created a new project in Android Studio, and manually cut/pasted every class in my project.

I am running Android Studio on a new Macbook Pro - Yosemite. I am having some issues running my app, even though it compiles. From what I can see, my problem might be that I am using JDK 1.8. Well, I cannot figure out how the heck to get JDK 6.

Here is the error I get when I run the project in Android Studio

Error:Execution failed for task ':app:preDexDebug'. com.android.ide.common.process.ProcessException: org.gradle.process.internal.ExecException: Process 'command '/Library/Java/JavaVirtualMachines/jdk1.8.0_40.jdk/Contents/Home/bin/java'' finished with non-zero exit value 1

When I scroll up in the Gradle Event Log, I see this error:

com.android.dx.cf.iface.ParseException: bad class file magic (cafebabe) or version (0034.0000)

In addition to the app not running, Android Studio freezes a lot! Again, is this because of the version of Java I have installed?

asked Mar 28, 2015 at 17:21

2 Answers 2

0

Wait, why didn't you IMPORT the project using Android Studio? It will build the gradle files for you.

enter image description here

Choose New/Import Project...

Then you will see it will let you just point to the root directory of your eclipse project:

enter image description here

answered Mar 28, 2015 at 17:39
Sign up to request clarification or add additional context in comments.

10 Comments

I tried that several times. I was running Eclipse Kepler with ADT on my Linux Laptop. But, I cannot find an ADT bundle for Mac anymore, so I just decided to move to Android Studio since Google is kinda pushing that. When I imported the project, I had all kinds of challenges. So I said forget it, I will create the project as brand new. That way, I don't have to worry about Legacy structures getting in the way.
It's not JDK 1.8, I have been using that with Gradle/Android studio for a long time.
Although bad class file magic sure sounds like a JDK issue. You are on the mac which makes going between versions more problematic, since that's turned into a total mess. You could use Homebrew to do that and then try it. Also, you probably know this, but there is the JDK you are running AS with and the JDK that is set on the project. For sure you can use 1.8 for either.
There is no support for 1.8 in Android is the reason for that.
You have to get that one from Apple. That's one of the reasons Java is such a mess on Mac: stewardship reverted to Oracle after 1.6.
|
0

Ok, installing JDK 7 fixed the issue. So, this Macbook is brand new, running Yosemite. It didn't have a JDK installed already. When I ran Android Studio, it said no JVM found. So, I went and got the latest from Oracle. So the only JDK I had was JDK 8.

So, for whatever reason, installing JDK 7 has made it so my app will actually run... Whoo Hoo! I'm back in business.

answered Mar 28, 2015 at 18:35

1 Comment

Did you removed the later version ?

Your Answer

Draft saved
Draft discarded

Sign up or log in

Sign up using Google
Sign up using Email and Password

Post as a guest

Required, but never shown

Post as a guest

Required, but never shown

By clicking "Post Your Answer", you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.