错误:com.android.dx.cf.iface.ParseException:错误的类文件魔术(cafebabe)或版本(0034.0000)Android工作室

时间:2016-05-11 09:46:59

标签: java android mpxj

我已经知道这个问题已经经常被问及答案,但我发现没有一个答案能解决我的问题。

错误:

  Information:Gradle tasks [:app:assembleDebug]
  :app:preBuild UP-TO-DATE
  :app:preDebugBuild UP-TO-DATE
   :app:checkDebugManifest
  :app:preReleaseBuild UP-TO-DATE
  :app:prepareComAndroidSupportAnimatedVectorDrawable2321Library UP-TO-DATE
  :app:prepareComAndroidSupportAppcompatV72321Library UP-TO-DATE
  :app:prepareComAndroidSupportSupportV42321Library UP-TO-DATE
  :app:prepareComAndroidSupportSupportVectorDrawable2321Library 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:compileDebugJavaWithJavac
  :app:compileDebugNdk UP-TO-DATE
  :app:compileDebugSources
  :app:transformClassesWithDexForDebug
  UNEXPECTED TOP-LEVEL EXCEPTION:
  Error: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(DirectClas sFile.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错误;中止 错误:任务':app:transformClassesWithDexForDebug'执行失败。

  

com.android.ide.common.process.ProcessException:org.gradle.process.internal.ExecException:进程'命令' C:\ Program Files \ Java \ jdk1.7.0_79 \ bin \的java.exe''完成非零退出值1

我的傻瓜

 apply plugin: 'com.android.application'

 android {
     compileSdkVersion 23
     buildToolsVersion "23.0.2"

defaultConfig {
    applicationId "ppp.i2e.org.mppconversion"
    minSdkVersion 15
    targetSdkVersion 23
    versionCode 1
    versionName "1.0"
}
buildTypes {
    release {
        minifyEnabled false
        proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
    }
}

compileOptions {
    sourceCompatibility = 1.7
    targetCompatibility = 1.7//JavaVersion.VERSION_1_7
}
}

dependencies {
    compile fileTree(dir: 'libs', include: ['*.jar'])
    testCompile 'junit:junit:4.12'
    compile 'com.android.support:appcompat-v7:23.2.1'
    //compile 'net.sf.mpxj:mpxj:5.2.2'
    //compile files('libs/mpxj.jar')
    compile files('libs/MPPConverterJAR.jar')
}

1 个答案:

答案 0 :(得分:0)

尝试使用这种方式添加java兼容性,即File->项目结构 - >点击您的模块名称 - >打开属性选项卡 - >更改源和目​​标兼容性。希望这会奏效。并从gradle文件中删除编译选项。 如果您使用的是gradle plugin 2.0 +

,请添加矢量兼容性
android {  
    defaultConfig {  
        vectorDrawables.useSupportLibrary = true  
    }  
}