Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Getting error when trying to run new project in Android Studio 2.2.1

I just updated to Android Studio 2.2.1 for Mac. Then I updated the JDK to version 8. Tried to start a new project and run it. I got the following error:

Error:(1, 1) A problem occurred evaluating project ':app'.

java.lang.UnsupportedClassVersionError: com/android/build/gradle/AppPlugin : Unsupported major.minor version 52.0

I also tried going back to JDK version 7 as it says on google site that JDK 8 is unstable for Mac. still got the same error.

like image 914
IntangibleTech Avatar asked May 19 '16 01:05

IntangibleTech


People also ask

Why Android Studio is not running the app?

Unplug your device from the USB port on the computer. Restart the device by powering off and back on. Verify that Settings => Developer options => USB Debugging is enabled. Quit and re-launch Android Studio.

How do I open a downloaded project in Android Studio?

Open Android Studio and select Open an Existing Android Studio Project or File, Open. Locate the folder you downloaded from Dropsource and unzipped, choosing the “build. gradle” file in the root directory. Android Studio will import the project.


2 Answers

Check your android build tools dependencies. In your build.gradle if its something like:

classpath "com.android.tools.build:gradle:+" 

It has likely downloaded the alpha of 2.2 and that can cause the error you are seeing.

Try

classpath "com.android.tools.build:gradle:2.1.0" 

If you are already using the right build tools version but keep getting this error, maybe one of the third party Android libraries you are using is causing the problem due to the same reason. You can force the dependency version to be used (including transitive) by changing

classpath "com.android.tools.build:gradle:2.1.0" 

to

classpath('com.android.tools.build:gradle:2.1.0') {         force = true     } 

Documentation: gist and official gradle docs.

like image 147
EricMorentin Avatar answered Nov 01 '22 19:11

EricMorentin


select Mark

I was also facing same problem. I upgraded Android Studio and as it forced to But we need to configure same in App Settings as well.

like image 23
Ashish Chaugule Avatar answered Nov 01 '22 19:11

Ashish Chaugule