刚开始使用Android Studio,无法在我的lgv10上运行应用程序。我附上了错误

时间:2016-07-20 05:55:50

标签: android android-studio

我刚开始学习编写代码,并且已经陷入了应该是最简单的部分。我已经安装了所有正确的驱动程序并将手机连接到了我的电脑。 Android studio能够识别我的手机,但在运行应用程序后,我收到以下错误。我也收到了这个基本错误

12:52:55 AM执行任务:[:app:clean,:app:generateDebugSources,:app:generateDebugAndroidTestSources,:app:prepareDebugUnitTestDependencies,:app:mockableAndroidJar,:app:assembleDebug]

12:52:59 AM Gradle build在4s 111ms完成了46次错误

Executing tasks: [:app:clean, :app:generateDebugSources, :app:generateDebugAndroidTestSources, :app:prepareDebugUnitTestDependencies, :app:mockableAndroidJar, :app:assembleDebug]

Configuration on demand is an incubating feature.
Incremental java compilation is an incubating feature.
:app:clean
:app:preBuild UP-TO-DATE
:app:preDebugBuild UP-TO-DATE
:app:checkDebugManifest
:app:preReleaseBuild UP-TO-DATE
:app:prepareComAndroidSupportAnimatedVectorDrawable2340Library
:app:prepareComAndroidSupportAppcompatV72340Library
:app:prepareComAndroidSupportSupportV42340Library
:app:prepareComAndroidSupportSupportVectorDrawable2340Library
:app:prepareDebugDependencies
:app:compileDebugAidl
:app:compileDebugRenderscript
:app:generateDebugBuildConfig
:app:mergeDebugShaders
:app:compileDebugShaders
:app:generateDebugAssets
: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:mergeDebugAndroidTestShaders
:app:compileDebugAndroidTestShaders
:app:generateDebugAndroidTestAssets
: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:incrementalDebugJavaCompilationSafeguard
:app:compileDebugJavaWithJavac
:app:compileDebugJavaWithJavac - is not incremental (e.g. outputs have changed, no previous execution, etc.).
: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
To run dex in process, the Gradle daemon needs a larger heap.
It currently has approximately 910 MB.
For faster builds, increase the maximum heap size for the Gradle daemon to more than 2048 MB.
To do this set org.gradle.jvmargs=-Xmx2048M in the project gradle.properties.
For more information see https://docs.gradle.org/current/userguide/build_environment.html

AGPBI: {"kind":"error","text":"java.lang.UnsupportedClassVersionError: com/android/dx/command/Main : Unsupported major.minor version 52.0","sources":[{}]}
AGPBI: {"kind":"error","text":"\tat java.lang.ClassLoader.defineClass1(Native Method)","sources":[{}]}
AGPBI: {"kind":"error","text":"\tat java.lang.ClassLoader.defineClass(ClassLoader.java:800)","sources":[{}]}
AGPBI: {"kind":"error","text":"\tat java.security.SecureClassLoader.defineClass(SecureClassLoader.java:142)","sources":[{}]}
AGPBI: {"kind":"error","text":"\tat java.net.URLClassLoader.defineClass(URLClassLoader.java:449)","sources":[{}]}
AGPBI: {"kind":"error","text":"\tat java.net.URLClassLoader.access$100(URLClassLoader.java:71)","sources":[{}]}
AGPBI: {"kind":"error","text":"\tat java.net.URLClassLoader$1.run(URLClassLoader.java:361)","sources":[{}]}
AGPBI: {"kind":"error","text":"\tat java.net.URLClassLoader$1.run(URLClassLoader.java:355)","sources":[{}]}
AGPBI: {"kind":"error","text":"\tat java.security.AccessController.doPrivileged(Native Method)","sources":[{}]}
AGPBI: {"kind":"error","text":"\tat java.net.URLClassLoader.findClass(URLClassLoader.java:354)","sources":[{}]}
AGPBI: {"kind":"error","text":"\tat java.lang.ClassLoader.loadClass(ClassLoader.java:425)","sources":[{}]}
AGPBI: {"kind":"error","text":"\tat sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:308)","sources":[{}]}
AGPBI: {"kind":"error","text":"\tat java.lang.ClassLoader.loadClass(ClassLoader.java:358)","sources":[{}]}
AGPBI: {"kind":"error","text":"\tat sun.launcher.LauncherHelper.checkAndLoadMain(LauncherHelper.java:482)","sources":[{}]}
AGPBI: {"kind":"error","text":"Exception in thread \"main\" ","sources":[{}]}

:app:transformClassesWithDexForDebug 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: 3.693 secs

AGPBI: {"kind":"error","text":"java.lang.UnsupportedClassVersionError: com/android/dx/command/Main : Unsupported major.minor version 52.0","sources":[{}]}
AGPBI: {"kind":"error","text":"\tat java.lang.ClassLoader.defineClass1(Native Method)","sources":[{}]}
AGPBI: {"kind":"error","text":"\tat java.lang.ClassLoader.defineClass(ClassLoader.java:800)","sources":[{}]}
AGPBI: {"kind":"error","text":"\tat java.security.SecureClassLoader.defineClass(SecureClassLoader.java:142)","sources":[{}]}
AGPBI: {"kind":"error","text":"\tat java.net.URLClassLoader.defineClass(URLClassLoader.java:449)","sources":[{}]}
AGPBI: {"kind":"error","text":"\tat java.net.URLClassLoader.access$100(URLClassLoader.java:71)","sources":[{}]}
AGPBI: {"kind":"error","text":"\tat java.net.URLClassLoader$1.run(URLClassLoader.java:361)","sources":[{}]}
AGPBI: {"kind":"error","text":"\tat java.net.URLClassLoader$1.run(URLClassLoader.java:355)","sources":[{}]}
AGPBI: {"kind":"error","text":"\tat java.security.AccessController.doPrivileged(Native Method)","sources":[{}]}
AGPBI: {"kind":"error","text":"\tat java.net.URLClassLoader.findClass(URLClassLoader.java:354)","sources":[{}]}
AGPBI: {"kind":"error","text":"\tat java.lang.ClassLoader.loadClass(ClassLoader.java:425)","sources":[{}]}
AGPBI: {"kind":"error","text":"\tat sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:308)","sources":[{}]}
AGPBI: {"kind":"error","text":"\tat java.lang.ClassLoader.loadClass(ClassLoader.java:358)","sources":[{}]}
AGPBI: {"kind":"error","text":"\tat sun.launcher.LauncherHelper.checkAndLoadMain(LauncherHelper.java:482)","sources":[{}]}
AGPBI: {"kind":"error","text":"Exception in thread \"main\" ","sources":[{}]}
AGPBI: {"kind":"error","text":"java.lang.UnsupportedClassVersionError: com/android/dx/command/Main : Unsupported major.minor version 52.0","sources":[{}]}
AGPBI: {"kind":"error","text":"\tat java.lang.ClassLoader.defineClass1(Native Method)","sources":[{}]}
AGPBI: {"kind":"error","text":"\tat java.lang.ClassLoader.defineClass(ClassLoader.java:800)","sources":[{}]}
AGPBI: {"kind":"error","text":"\tat java.security.SecureClassLoader.defineClass(SecureClassLoader.java:142)","sources":[{}]}
AGPBI: {"kind":"error","text":"\tat java.net.URLClassLoader.defineClass(URLClassLoader.java:449)","sources":[{}]}
AGPBI: {"kind":"error","text":"\tat java.net.URLClassLoader.access$100(URLClassLoader.java:71)","sources":[{}]}
AGPBI: {"kind":"error","text":"\tat java.net.URLClassLoader$1.run(URLClassLoader.java:361)","sources":[{}]}
AGPBI: {"kind":"error","text":"\tat java.net.URLClassLoader$1.run(URLClassLoader.java:355)","sources":[{}]}
AGPBI: {"kind":"error","text":"\tat java.security.AccessController.doPrivileged(Native Method)","sources":[{}]}
AGPBI: {"kind":"error","text":"\tat java.net.URLClassLoader.findClass(URLClassLoader.java:354)","sources":[{}]}
AGPBI: {"kind":"error","text":"\tat java.lang.ClassLoader.loadClass(ClassLoader.java:425)","sources":[{}]}
AGPBI: {"kind":"error","text":"\tat sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:308)","sources":[{}]}
AGPBI: {"kind":"error","text":"\tat java.lang.ClassLoader.loadClass(ClassLoader.java:358)","sources":[{}]}
AGPBI: {"kind":"error","text":"\tat sun.launcher.LauncherHelper.checkAndLoadMain(LauncherHelper.java:482)","sources":[{}]}
AGPBI: {"kind":"error","text":"Exception in thread \"main\" ","sources":[{}]}
AGPBI: {"kind":"error","text":"java.lang.UnsupportedClassVersionError: com/android/dx/command/Main : Unsupported major.minor version 52.0","sources":[{}]}
AGPBI: {"kind":"error","text":"\tat java.lang.ClassLoader.defineClass1(Native Method)","sources":[{}]}
AGPBI: {"kind":"error","text":"\tat java.lang.ClassLoader.defineClass(ClassLoader.java:800)","sources":[{}]}
AGPBI: {"kind":"error","text":"\tat java.security.SecureClassLoader.defineClass(SecureClassLoader.java:142)","sources":[{}]}
AGPBI: {"kind":"error","text":"\tat java.net.URLClassLoader.defineClass(URLClassLoader.java:449)","sources":[{}]}
AGPBI: {"kind":"error","text":"\tat java.net.URLClassLoader.access$100(URLClassLoader.java:71)","sources":[{}]}
AGPBI: {"kind":"error","text":"\tat java.net.URLClassLoader$1.run(URLClassLoader.java:361)","sources":[{}]}
AGPBI: {"kind":"error","text":"\tat java.net.URLClassLoader$1.run(URLClassLoader.java:355)","sources":[{}]}
AGPBI: {"kind":"error","text":"\tat java.security.AccessController.doPrivileged(Native Method)","sources":[{}]}
AGPBI: {"kind":"error","text":"\tat java.net.URLClassLoader.findClass(URLClassLoader.java:354)","sources":[{}]}
AGPBI: {"kind":"error","text":"\tat java.lang.ClassLoader.loadClass(ClassLoader.java:425)","sources":[{}]}
AGPBI: {"kind":"error","text":"\tat sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:308)","sources":[{}]}
AGPBI: {"kind":"error","text":"\tat java.lang.ClassLoader.loadClass(ClassLoader.java:358)","sources":[{}]}
AGPBI: {"kind":"error","text":"\tat sun.launcher.LauncherHelper.checkAndLoadMain(LauncherHelper.java:482)","sources":[{}]}
AGPBI: {"kind":"error","text":"Exception in thread \"main\" ","sources":[{}]}

以下是更多信息:

apply plugin: 'com.android.application'

android {
    compileSdkVersion 23
    buildToolsVersion "24.0.1"

    defaultConfig {
        applicationId "com.example.android.happybirthday"
        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'])
    testCompile 'junit:junit:4.12'
    compile 'com.android.support:appcompat-v7:23.4.0'
}

2 个答案:

答案 0 :(得分:0)

试试这个

dexOptions {
    javaMaxHeapSize "4g"
    preDexLibraries = false
}

原因可以在

中看到

https://sites.google.com/a/android.com/tools/tech-docs/new-build-system/tips

答案 1 :(得分:0)

尝试通过关闭一些后台应用程序来释放你的记忆,然后做一个“清洁项目”'来自' Build'标签。