Welcome to the Treehouse Community

Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.

Start your free trial

Android

Problem running the fun fact project

Information:Gradle tasks [:app:clean, :app:generateDebugSources, :app:generateDebugAndroidTestSources, :app:prepareDebugUnitTestDependencies, :app:mockableAndroidJar, :app:assembleDebug] :app:clean :app:preBuild UP-TO-DATE :app:preDebugBuild UP-TO-DATE :app:checkDebugManifest :app:preReleaseBuild UP-TO-DATE :app:prepareComAndroidSupportAnimatedVectorDrawable2330Library :app:prepareComAndroidSupportAppcompatV72330Library :app:prepareComAndroidSupportSupportV42330Library :app:prepareComAndroidSupportSupportVectorDrawable2330Library :app:prepareDebugDependencies :app:compileDebugAidl :app:compileDebugRenderscript :app:generateDebugBuildConfig :app:generateDebugAssets UP-TO-DATE :app:mergeDebugAssets :app:generateDebugResValues UP-TO-DATE :app:generateDebugResources :app:mergeDebugResources :app:processDebugManifest :app:processDebugResources :app:generateDebugSources :app:preDebugAndroidTestBuild UP-TO-DATE :app:prepareDebugAndroidTestDependencies :app:compileDebugAndroidTestAidl :app:processDebugAndroidTestManifest :app:compileDebugAndroidTestRenderscript :app:generateDebugAndroidTestBuildConfig :app:generateDebugAndroidTestAssets UP-TO-DATE :app:mergeDebugAndroidTestAssets :app:generateDebugAndroidTestResValues UP-TO-DATE :app:generateDebugAndroidTestResources :app:mergeDebugAndroidTestResources :app:processDebugAndroidTestResources :app:generateDebugAndroidTestSources :app:preDebugUnitTestBuild UP-TO-DATE :app:prepareDebugUnitTestDependencies :app:mockableAndroidJar UP-TO-DATE :app:compileDebugJavaWithJavac :app:compileDebugNdk UP-TO-DATE :app:compileDebugSources :app:buildInfoDebugLoader :app:transformClassesWithExtractJarsForDebug :app:transformClassesWithInstantRunVerifierForDebug :app:transformClassesWithJavaResourcesVerifierForDebug UP-TO-DATE :app:mergeDebugJniLibFolders :app:transformNative_libsWithMergeJniLibsForDebug :app:processDebugJavaRes UP-TO-DATE :app:transformResourcesWithMergeJavaResForDebug :app:transformResourcesAndNative_libsWithJavaResourcesVerifierForDebug UP-TO-DATE :app:transformClassesWithInstantRunForDebug :app:transformClasses_enhancedWithInstant+reloadDexForDebug UP-TO-DATE :app:incrementalDebugTasks :app:prePackageMarkerForDebug :app:fastDeployDebugExtractor :app:generateDebugInstantRunAppInfo :app:coldswapKickerDebug :app:transformClassesWithInstantRunSlicerForDebug :app:transformClassesWithDexForDebug Error:java.lang.UnsupportedClassVersionError: com/android/dx/command/Main : Unsupported major.minor version 52.0 Error:java.lang.UnsupportedClassVersionError: com/android/dx/command/Main : Unsupported major.minor version 52.0 Error: at java.lang.ClassLoader.defineClass1(Native Method) Error: at java.lang.ClassLoader.defineClass1(Native Method) Error: at java.lang.ClassLoader.defineClass(ClassLoader.java:800) Error: at java.lang.ClassLoader.defineClass(ClassLoader.java:800) Error: at java.security.SecureClassLoader.defineClass(SecureClassLoader.java:142) Error: at java.security.SecureClassLoader.defineClass(SecureClassLoader.java:142) Error: at java.net.URLClassLoader.defineClass(URLClassLoader.java:449) Error: at java.net.URLClassLoader.defineClass(URLClassLoader.java:449) Error: at java.net.URLClassLoader.access$100(URLClassLoader.java:71) Error: at java.net.URLClassLoader.access$100(URLClassLoader.java:71) Error: at java.net.URLClassLoader$1.run(URLClassLoader.java:361) Error: at java.net.URLClassLoader$1.run(URLClassLoader.java:355) Error: at java.security.AccessController.doPrivileged(Native Method) Error: at java.net.URLClassLoader.findClass(URLClassLoader.java:354) Error: at java.lang.ClassLoader.loadClass(ClassLoader.java:425) Error: at java.net.URLClassLoader$1.run(URLClassLoader.java:361) Error: at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:308) Error: at java.net.URLClassLoader$1.run(URLClassLoader.java:355) Error: at java.lang.ClassLoader.loadClass(ClassLoader.java:358) Error: at java.security.AccessController.doPrivileged(Native Method) Error: at sun.launcher.LauncherHelper

I am getting this error message... In the message tab below... When i try to run the app... It says completed with 61 errors and doesn't run.... Plz.. Plz.. Help mee..

5 Answers

Jacob Biros
Jacob Biros
2,241 Points

Ok. Im not 100% sure what the problem is, but it looks like Android Studio is having some problems with Java. Can you first check to see if there are any updates for android studio and then also see if you have Android Studio 2.0 or an older version?

If none of that works, try searching some of the errors on google or stack overflow to see if anyone else had similar problems.

Is this your first time running android studio, or have you built an app before?

Jacob Biros
Jacob Biros
2,241 Points

Its giving you a java.lang.UnsupportedClassVersionError which could mean that the version of Java you are using is incompatible with the code.

Maybe try updating Java on your computer and then running the program again?

FAILED

FAILURE: Build failed with an exception.

  • What went wrong: 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.7.0_79\bin\java.exe'' finished with non-zero exit value 1

  • Try: Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output.

BUILD FAILED

Total time: 46.41 secs.......

No jacob it didn't solved the problem... It showed all errors again... Ani this above message in gradle console.. Was shown to mee.. Plz.. Help me understand that..!!

Jacob Biros
Jacob Biros
2,241 Points

Ok. Im not 100% sure what the problem is, but it looks like Android Studio is having some problems with Java. Can you first check to see if there are any updates for android studio and then also see if you have Android Studio 2.0 or an older version?

If none of that works, try searching some of the errors on google or stack overflow to see if anyone else had similar problems.

Is this your first time running android studio, or have you built an app before?

No, this is my first time.!!.. Anyways jacob thanks for your support.. I updated java version... As u told.. And reinstalled.. The android studio... And now it runs perfectly... Thnks.. For your help..!!

Jacob Biros
Jacob Biros
2,241 Points

Glad you got it working!