在Android Studio中编译错误

时间:2016-04-29 18:23:24

标签: android android-studio gradle

我有以下build.gradle文件但是当我尝试运行代码时出现以下错误(错误发生是因为我在mysql库中添加,在build.gradle文件中的依赖项下看到):

Error:Execution failed for task ':app:preDexDebug'.
com.android.ide.common.process.ProcessException: org.gradle.process.internal.ExecException: Process 'command '/Library/Java/JavaVirtualMachines/jdk1.8.0_65.jdk/Contents/Home/bin/java'' finished with non-zero exit value 1

这是我得到的完整输出:

    Information:Gradle tasks [:app:assembleDebug]
    :app:preBuild UP-TO-DATE
    :app:preDebugBuild UP-TO-DATE
    :app:checkDebugManifest
    :app:preReleaseBuild UP-TO-DATE
    :app:prepareComAndroidSupportAppcompatV72310Library UP-TO-DATE
    :app:prepareComAndroidSupportDesign2310Library UP-TO-DATE
    :app:prepareComAndroidSupportRecyclerviewV72310Library UP-TO-DATE
    :app:prepareComAndroidSupportSupportV42310Library UP-TO-DATE
    :app:prepareComGithubBmarrdevAndroidDecoViewChartingV096Library UP-TO-DATE
    :app:prepareComGoogleAndroidGmsPlayServicesBase840Library UP-TO-DATE
    :app:prepareComGoogleAndroidGmsPlayServicesBasement840Library UP-TO-DATE
    :app:prepareComGoogleAndroidGmsPlayServicesFitness840Library UP-TO-DATE
    :app:prepareComGoogleAndroidGmsPlayServicesLocation840Library UP-TO-DATE
    :app:prepareComGoogleAndroidGmsPlayServicesMaps840Library UP-TO-DATE
    :app:prepareDebugDependencies
    :app:compileDebugAidl UP-TO-DATE
    :app:compileDebugRenderscript UP-TO-DATE
    :app:generateDebugBuildConfig UP-TO-DATE
    :app:generateDebugAssets UP-TO-DATE
    :app:mergeDebugAssets UP-TO-DATE
    :app:generateDebugResValues UP-TO-DATE
    :app:generateDebugResources UP-TO-DATE
    :app:mergeDebugResources UP-TO-DATE
    :app:processDebugManifest UP-TO-DATE
    :app:processDebugResources UP-TO-DATE
    :app:generateDebugSources UP-TO-DATE
    :app:processDebugJavaRes UP-TO-DATE
    :app:compileDebugJavaWithJavac
    Note: /Users/sheyda/Desktop/sp16/Java/mini2/Pedo/CountMySteps/app/src/main/java/com/google/android/gms/fit/samples/basichistoryapi/MainActivity.java uses or overrides a deprecated API.
    Note: Recompile with -Xlint:deprecation for details.
    :app:compileDebugNdk UP-TO-DATE
    :app:compileDebugSources
    :app:preDexDebug
    UNEXPECTED TOP-LEVEL EXCEPTION:
    java.lang.RuntimeException: Exception parsing classes
        at com.android.dx.command.dexer.Main.processClass(Main.java:752)
        at com.android.dx.command.dexer.Main.processFileBytes(Main.java:718)
        at com.android.dx.command.dexer.Main.access$1200(Main.java:85)
        at com.android.dx.command.dexer.Main$FileBytesConsumer.processFileBytes(Main.java:1645)
        at com.android.dx.cf.direct.ClassPathOpener.processArchive(ClassPathOpener.java:284)
        at com.android.dx.cf.direct.ClassPathOpener.processOne(ClassPathOpener.java:166)
        at com.android.dx.cf.direct.ClassPathOpener.process(ClassPathOpener.java:144)
        at com.android.dx.command.dexer.Main.processOne(Main.java:672)
        at com.android.dx.command.dexer.Main.processAllFiles(Main.java:574)
        at com.android.dx.command.dexer.Main.runMonoDex(Main.java:311)
        at com.android.dx.command.dexer.Main.run(Main.java:277)
        at com.android.dx.command.dexer.Main.main(Main.java:245)
        at com.android.dx.command.Main.main(Main.java:106)
    Caused by: com.android.dx.cf.iface.ParseException: bad class file magic (cafebabe) or version (0034.0000)
        at com.android.dx.cf.direct.DirectClassFile.parse0(DirectClassFile.java:472)
        at com.android.dx.cf.direct.DirectClassFile.parse(DirectClassFile.java:406)
        at com.android.dx.cf.direct.DirectClassFile.parseToInterfacesIfNecessary(DirectClassFile.java:388)
        at com.android.dx.cf.direct.DirectClassFile.getMagic(DirectClassFile.java:251)
        at com.android.dx.command.dexer.Main.parseClass(Main.java:764)
        at com.android.dx.command.dexer.Main.access$1500(Main.java:85)
        at com.android.dx.command.dexer.Main$ClassParserTask.call(Main.java:1684)
        at com.android.dx.command.dexer.Main.processClass(Main.java:749)
        ... 12 more
    1 error; aborting
    Error:Execution failed for task ':app:preDexDebug'.
    > com.android.ide.common.process.ProcessException: org.gradle.process.internal.ExecException: Process 'command '/Library/Java/JavaVirtualMachines/jdk1.8.0_65.jdk/Contents/Home/bin/java'' finished with non-zero exit value 1
    Information:BUILD FAILED
    Information:Total time: 6.577 secs
    Information:1 error
    Information:0 warnings
    Information:See complete output in console

我看过Error: finished with non-zero exit value2Error when trying to integrate parse into Android app error: Error:Execution failed for task ':app:transformClassesWithDexForDebug',但他们的解决方案并没有帮助。

这是我的傻瓜:

apply plugin: 'com.android.application'

android {
    compileSdkVersion 23
    buildToolsVersion "23.0.1"

    defaultConfig {
        applicationId "com.google.android.gms.fit.samples.basichistoryapi"
        minSdkVersion 15
        targetSdkVersion 23
        versionCode 2
        versionName "1.1"
    }
    buildTypes {
        release {
            minifyEnabled false
            proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
        }
    }
}

repositories {
    maven { url "https://jitpack.io" }
}

dependencies {
    // Note, specific version numbers are managed in gradle.properties. This is preferred since it
    // easily keeps sub-projects on the same versions.
    compile files('libs/mysql-connector-java-5.1.38-bin.jar')
    compile "com.google.android.gms:play-services-fitness:${google_play_services_library}"
    compile "com.android.support:appcompat-v7:${google_support_library}"
    compile "com.android.support:design:${google_support_library}"
    compile fileTree(dir: 'libs', include: ['*.jar'])
    compile 'com.github.bmarrdev:android-DecoView-charting:v0.9.6'
    compile 'com.github.PhilJay:MPAndroidChart:v2.2.4'

}

0 个答案:

没有答案