当前位置: 首页 > 知识库问答 >
问题:

(我的第一个应用程序)Android gradle Build有61个错误。。我无法编写任何代码,只是运行了一个空的活动

张积厚
2023-03-14

建筑格拉德尔:

 apply plugin: 'com.android.application'
  android {
compileSdkVersion 23
buildToolsVersion "24.0.1"

defaultConfig {
    applicationId "com.example.user.myfirstapp"
    minSdkVersion 15
    targetSdkVersion 23
    versionCode 1
    versionName "1.0"
}
buildTypes {
    release {
        minifyEnabled false
        proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
    }
}
}

 dependencies {
compile fileTree(dir: 'libs', include: ['*.jar'])
compile 'com.android.support:appcompat-v7:23.4.0'
}

这是Android Studio中的错误:

    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: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.lang.ClassLoader.defineClass1(Native Method)
    Error:    at java.security.SecureClassLoader.defineClass(SecureClassLoader.java:142)
    Error:    at java.lang.ClassLoader.defineClass1(Native Method)
    Error:    at java.net.URLClassLoader.defineClass(URLClassLoader.java:449)
    Error:    at java.lang.ClassLoader.defineClass(ClassLoader.java:800)
    Error:    at java.net.URLClassLoader.access$100(URLClassLoader.java:71)
    Error:    at java.lang.ClassLoader.defineClass(ClassLoader.java:800)
    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 va.security.SecureClassLoader.defineClass(SecureClassLoader.java:142)
    Error:    at java.net.URLClassLoader.findClass(URLClassLoader.java:354)
    Error:    at va.security.SecureClassLoader.defineClass(SecureClassLoader.java:142)
    Error:    at java.lang.ClassLoader.loadClass(ClassLoader.java:425)
    Error:    at java.net.URLClassLoader.defineClass(URLClassLoader.java:449)
    Error:    at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:308)
    Error:    at java.net.URLClassLoader.defineClass(URLClassLoader.java:449)
    Error:    at java.lang.ClassLoader.loadClass(ClassLoader.java:358)
    Error:    at java.net.URLClassLoader.access$100(URLClassLoader.java:71)
    Error:    at sun.launcher.LauncherHelper.checkAndLoadMain(LauncherHelper.java:482)
    Error:    at java.net.URLClassLoader.access$100(URLClassLoader.java:71)
    Error:Exception in thread "main" 
    Error:    at java.net.URLClassLoader$1.run(URLClassLoader.java:361)
    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.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:    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:Exception in thread "main" 
    :app:transformClassesWithDexForDebug FAILED
    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 ':app:transformClassesWithDexForDebug'.
    > com.android.build.api.transform.TransformException: java.lang.RuntimeException:

通用域名格式。Android石斑鱼类。常见的过程ProcessException:java。util。同时发生的ExecutionException:com.Android石斑鱼类。常见的过程ProcessException:org。格拉德尔。过程内部的ExecException:进程“命令”C:\Program Files\Java\jdk1。7.0_79\bin\java。exe“”已完成,退出值为非零1信息:生成失败信息:总时间:12.13秒错误:java。lang.UnsupportedClassVersionError:com/android/dx/command/Main:Unsupported-major。次要版本52.0错误:在java。lang.ClassLoader。defineClass1(本机方法)错误:在java。lang.ClassLoader。defineClass(ClassLoader.java:800)错误:在java。安全SecureClassLoader。defineClass(SecureClassLoader.java:142)错误:位于java。网URLClassLoader。defineClass(URLClassLoader.java:449)错误:在java。网URLClassLoader。访问$100(URLClassLoader.java:71)错误:位于java。网URLClassLoader$1。运行(URLClassLoader.java:361)错误:在java。网URLClassLoader$1。运行(URLClassLoader.java:355)错误:在java。安全访问控制器。doPrivileged(本机方法)错误:在java。网URLClassLoader。findClass(URLClassLoader.java:354)错误:位于java。lang.ClassLoader。loadClass(ClassLoader.java:425)错误:在sun。杂项。启动器$AppClassLoader。loadClass(Launcher.java:308)错误:位于java。lang.ClassLoader。loadClass(ClassLoader.java:358)错误:在sun。发射装置。发射器助手。checkAndLoadMain(LaunchHelper.java:482)错误:线程“main”中的异常信息:61错误信息:0警告信息:请参阅控制台中的完整输出

共有1个答案

施永宁
2023-03-14

把这个换成你的渐变

 compileSdkVersion 23
buildToolsVersion "23.0.1"
 类似资料: