Information:Gradle tasks [:Application:assembleDebug]
:Application:preBuild UP-TO-DATE
:Application:preDebugBuild UP-TO-DATE
:Application:checkDebugManifest
:Application:preReleaseBuild UP-TO-DATE
:Application:prepareComAndroidSupportAppcompatV72300Library UP-TO-DATE
:Application:prepareComAndroidSupportCardviewV72330Library UP-TO-DATE
:Application:prepareComAndroidSupportSupportV132330Library UP-TO-DATE
:Application:prepareComAndroidSupportSupportV42330Library UP-TO-DATE
:Application:prepareDebugDependencies
:Application:compileDebugAidl UP-TO-DATE
:Application:compileDebugRenderscript UP-TO-DATE
:Application:generateDebugBuildConfig UP-TO-DATE
:Application:generateDebugAssets UP-TO-DATE
:Application:mergeDebugAssets UP-TO-DATE
:Application:generateDebugResValues UP-TO-DATE
:Application:generateDebugResources UP-TO-DATE
:Application:mergeDebugResources UP-TO-DATE
:Application:processDebugManifest UP-TO-DATE
:Application:processDebugResources UP-TO-DATE
:Application:generateDebugSources UP-TO-DATE
:Application:compileDebugJavaWithJavac
:Application:compileDebugNdk UP-TO-DATE
:Application:compileDebugSources
:Application:prePackageMarkerForDebug
:Application:transformClassesWithDexForDebug
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.defineClass(ClassLoader.java:800)
Error: at java.security.SecureClassLoader.defineClass(SecureClassLoader.java:142)
Error: at java.net.URLClassLoader.defineClass(URLClassLoader.java:449)
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 sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:308)
Error: at java.lang.ClassLoader.loadClass(ClassLoader.java:358)
Error: at sun.launcher.LauncherHelper.checkAndLoadMain(LauncherHelper.java:482)
Error:Exception in thread "main"
Error:Execution failed for task ':Application: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
Information:BUILD FAILED
Information:Total time: 2.159 secs
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.defineClass(ClassLoader.java:800)
Error: at java.security.SecureClassLoader.defineClass(SecureClassLoader.java:142)
Error: at java.net.URLClassLoader.defineClass(URLClassLoader.java:449)
Error:java.lang.UnsupportedClassVersionError: com/android/dx/command/Main : Unsupported major.minor version 52.0
Error: at java.net.URLClassLoader.access$100(URLClassLoader.java:71)
Error: at java.lang.ClassLoader.defineClass1(Native Method)
Error: at java.lang.ClassLoader.defineClass(ClassLoader.java:800)
Error: at java.security.SecureClassLoader.defineClass(SecureClassLoader.java:142)
Error: at java.net.URLClassLoader.defineClass(URLClassLoader.java:449)
Error: at java.net.URLClassLoader$1.run(URLClassLoader.java:361)
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.net.URLClassLoader$1.run(URLClassLoader.java:355)
Error: at java.security.AccessController.doPrivileged(Native Method)
Error: at java.security.AccessController.doPrivileged(Native Method)
Error: at java.net.URLClassLoader.findClass(URLClassLoader.java:354)
Error: at java.net.URLClassLoader.findClass(URLClassLoader.java:354)
Error: at java.lang.ClassLoader.loadClass(ClassLoader.java:425)
Error: at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:308)
Error: at java.lang.ClassLoader.loadClass(ClassLoader.java:425)
Error: at java.lang.ClassLoader.loadClass(ClassLoader.java:358)
Error: at sun.launcher.LauncherHelper.checkAndLoadMain(LauncherHelper.java:482)
Error: at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:308)
Error:Exception in thread "main"
Error: at java.lang.ClassLoader.loadClass(ClassLoader.java:358)
Error: at sun.launcher.LauncherHelper.checkAndLoadMain(LauncherHelper.java:482)
Error:Exception in thread "main"
Information:46 errors
Information:0 warnings
Information:See complete output in console
我在android中导入了一个示例代码,名为“Camera2Basic” 但我将其重命名为CameraSampleApp,因此在构建完成后我尝试运行它并弹出此错误。我做错了什么,或者我的Android Studio已经过时了。
答案 0 :(得分:1)
解决该问题的智能方法是使用最新的SDK进行编译,并在编译时使用cross compilation options。要完全正确使用选项,需要目标版本的JRE(非JDK )的rt.jar
。
鉴于该applet的性质,它看起来可以编译为与Java 1.1一起使用。
答案 1 :(得分:0)
我建议将multiDexEnabled添加到build.gradle文件中
defaultConfig {
multiDexEnabled true
}
答案 2 :(得分:0)
卸载旧的jdk并安装最新的jdk(1.8)并将JAVA_HOME的环境变量路径更改为最新的jdk。在android studio中将java路径更改为最新的jdk。