我在编程时遇到了问题,但我遇到了一个问题,但我找不到答案。gradle 2.5 com.android.dx.cf.iface.ParseException:错误的类文件魔术(cafebabe)或版本(0034.0000)
我想在Android Stuido 1.3.2中编译Superpowered SDK(superpowered.com)的一个修改示例。 最初的例子是用gradle 2.2.1编译的,对于我来说,使用当前的NDK版本可以很好地工作。不过,我希望调试器为本机代码工作,并根据http://tools.android.com/tech-docs/new-build-system/gradle-experimental我需要gradle 2.5。
奇怪的是我得到的错误“com.android.dx.cf.iface.ParseException:糟糕的类文件魔术(cafebabe)或版本(0034.0000)”与gradle这个2.5编译时,而它正常工作与旧版。根据其他类似的问题,由于JAVA中存在一些链接错误,如果有多个Java版本可用(v 1.8而不是v1.7),那么我只会使用Java 8,并且这对于较旧的Gradle版。
任何人都可以帮助我解决这个问题吗?
我gradle这个2.2.1的build.gradle代码:
apply plugin: 'com.android.application'
android {
compileSdkVersion 22
buildToolsVersion "22.0.1"
defaultConfig {
applicationId "com.superpowered.frequencydomain"
minSdkVersion 11
targetSdkVersion 22
versionCode 1
versionName "1.0"
sourceSets.main {
jniLibs.srcDir 'src/main/libs'
jni.srcDirs = []
}
}
task ndkBuild(type: Exec) {
commandLine '/android/ndk/ndk-build', '-B', '-C', file('src/main/jni').absolutePath
// Windows users:
// commandLine 'C:\\Android\\ndk\\ndk-build.cmd', '-B', '-C', file('src/main/jni').absolutePath
}
tasks.withType(JavaCompile) {
compileTask -> compileTask.dependsOn ndkBuild
}
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:22.2.0'
}
我的摇篮2.5。代码:
apply plugin: 'com.android.model.application'
model {
android {
compileSdkVersion = 23
buildToolsVersion = "23.0.1"
defaultConfig.with {
applicationId = "com.superpowered.frequencydomain"
minSdkVersion.apiLevel = 10
targetSdkVersion.apiLevel = 23
}
}
android.buildTypes {
release {
minifyEnabled = false
proguardFiles += file('proguard-rules.pro')
proguardFiles += file('proguard-android.txt')
}
}
}
task ndkBuild(type: Exec) {
commandLine 'C:\\Users\\Dave\\AppData\\Local\\Android\\Sdk\\ndk-bundle\\ndk-build.cmd', '-B', '-C', file('src/main/jni').absolutePath
}
tasks.withType(JavaCompile) {
compileTask -> compileTask.dependsOn ndkBuild
}
dependencies {
compile fileTree(include: ['*.jar'], dir: 'libs')
compile 'com.android.support:appcompat-v7:23.1.0'
}
其他的build.gradle文件说,对2.2.1:
buildscript {
repositories {
jcenter()
}
dependencies {
classpath 'com.android.tools.build:gradle:1.3.0'
// NOTE: Do not place your application dependencies here; they belong
// in the individual module build.gradle files
}
}
allprojects {
repositories {
jcenter()
}
}
为2.5。它的内容如下:
classpath 'com.android.tools.build:gradle-experimental:0.2.0'
在第6行。除此之外它是相同的。
在此先感谢您的帮助!