Visual Studio - Cordova Android“transformClassesWithDexForDebug”错误

问题描述:

简单地说,当我想使用位于Cordova文件夹中的“build.bat”文件构建我的Cordova项目的APK时,我听说构建过程失败,出现“transformClassesWithDexForDebug “成为问题。Visual Studio - Cordova Android“transformClassesWithDexForDebug”错误

我一直在使用googling这个问题已经很长时间了,所有修复的人都建议不起作用,其中大部分涉及到将某些内容放在build.gradle文件中,但哪一个是因为有两个。一个在主目录中,另一个在CordovaLib文件夹中...

我刚刚开始使用科尔多瓦,最近任何指导都会非常感谢。

我的build.gradle

/* 
     Licensed to the Apache Software Foundation (ASF) under one 
     or more contributor license agreements. See the NOTICE file 
     distributed with this work for additional information 
     regarding copyright ownership. The ASF licenses this file 
     to you under the Apache License, Version 2.0 (the 
     "License"); you may not use this file except in compliance 
     with the License. You may obtain a copy of the License at 

     http://www.apache.org/licenses/LICENSE-2.0 

     Unless required by applicable law or agreed to in writing, 
     software distributed under the License is distributed on an 
     "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 
     KIND, either express or implied. See the License for the 
     specific language governing permissions and limitations 
     under the License. 
*/ 

// GENERATED FILE! DO NOT EDIT! 

apply plugin: 'android' 

buildscript { 
    repositories { 
     mavenCentral() 
    } 

    // Switch the Android Gradle plugin version requirement depending on the 
    // installed version of Gradle. This dependency is documented at 
    // http://tools.android.com/tech-docs/new-build-system/version-compatibility 
    // and https://issues.apache.org/jira/browse/CB-8143 
    dependencies { 
     classpath 'com.android.tools.build:gradle:1.5.0' 
    } 
    } 

// Allow plugins to declare Maven dependencies via build-extras.gradle. 
repositories { 
    mavenCentral() 
} 

task wrapper(type: Wrapper) { 
    gradleVersion = '2.8' 
} 

// Configuration properties. Set these via environment variables, build-extras.gradle, or gradle.properties. 
// Refer to: http://www.gradle.org/docs/current/userguide/tutorial_this_and_that.html 
ext { 
    apply from: 'CordovaLib/cordova.gradle' 
    // The value for android.compileSdkVersion. 
    if (!project.hasProperty('cdvCompileSdkVersion')) { 
     cdvCompileSdkVersion = null; 
    } 
    // The value for android.buildToolsVersion. 
    if (!project.hasProperty('cdvBuildToolsVersion')) { 
     cdvBuildToolsVersion = null; 
    } 
    // Sets the versionCode to the given value. 
    if (!project.hasProperty('cdvVersionCode')) { 
     cdvVersionCode = null 
    } 
    // Sets the minSdkVersion to the given value. 
    if (!project.hasProperty('cdvMinSdkVersion')) { 
     cdvMinSdkVersion = null 
    } 
    // Whether to build architecture-specific APKs. 
    if (!project.hasProperty('cdvBuildMultipleApks')) { 
     cdvBuildMultipleApks = null 
    } 
    // .properties files to use for release signing. 
    if (!project.hasProperty('cdvReleaseSigningPropertiesFile')) { 
     cdvReleaseSigningPropertiesFile = null 
    } 
    // .properties files to use for debug signing. 
    if (!project.hasProperty('cdvDebugSigningPropertiesFile')) { 
     cdvDebugSigningPropertiesFile = null 
    } 
    // Set by build.js script. 
    if (!project.hasProperty('cdvBuildArch')) { 
     cdvBuildArch = null 
    } 

    // Plugin gradle extensions can append to this to have code run at the end. 
    cdvPluginPostBuildExtras = [] 
} 

// PLUGIN GRADLE EXTENSIONS START 
// PLUGIN GRADLE EXTENSIONS END 

def hasBuildExtras = file('build-extras.gradle').exists() 
if (hasBuildExtras) { 
    apply from: 'build-extras.gradle' 
} 

// Set property defaults after extension .gradle files. 
if (ext.cdvCompileSdkVersion == null) { 
    ext.cdvCompileSdkVersion = privateHelpers.getProjectTarget() 
} 
if (ext.cdvBuildToolsVersion == null) { 
    ext.cdvBuildToolsVersion = privateHelpers.findLatestInstalledBuildTools() 
} 
if (ext.cdvDebugSigningPropertiesFile == null && file('debug-signing.properties').exists()) { 
    ext.cdvDebugSigningPropertiesFile = 'debug-signing.properties' 
} 
if (ext.cdvReleaseSigningPropertiesFile == null && file('release-signing.properties').exists()) { 
    ext.cdvReleaseSigningPropertiesFile = 'release-signing.properties' 
} 

// Cast to appropriate types. 
ext.cdvBuildMultipleApks = cdvBuildMultipleApks == null ? false : cdvBuildMultipleApks.toBoolean(); 
ext.cdvMinSdkVersion = cdvMinSdkVersion == null ? null : Integer.parseInt('' + cdvMinSdkVersion) 
ext.cdvVersionCode = cdvVersionCode == null ? null : Integer.parseInt('' + cdvVersionCode) 

def computeBuildTargetName(debugBuild) { 
    def ret = 'assemble' 
    if (cdvBuildMultipleApks && cdvBuildArch) { 
     def arch = cdvBuildArch == 'arm' ? 'armv7' : cdvBuildArch 
     ret += '' + arch.toUpperCase().charAt(0) + arch.substring(1); 
    } 
    return ret + (debugBuild ? 'Debug' : 'Release') 
} 

// Make cdvBuild a task that depends on the debug/arch-sepecific task. 
task cdvBuildDebug 
cdvBuildDebug.dependsOn { 
    return computeBuildTargetName(true) 
} 

task cdvBuildRelease 
cdvBuildRelease.dependsOn { 
    return computeBuildTargetName(false) 
} 

task cdvPrintProps << { 
    println('cdvCompileSdkVersion=' + cdvCompileSdkVersion) 
    println('cdvBuildToolsVersion=' + cdvBuildToolsVersion) 
    println('cdvVersionCode=' + cdvVersionCode) 
    println('cdvMinSdkVersion=' + cdvMinSdkVersion) 
    println('cdvBuildMultipleApks=' + cdvBuildMultipleApks) 
    println('cdvReleaseSigningPropertiesFile=' + cdvReleaseSigningPropertiesFile) 
    println('cdvDebugSigningPropertiesFile=' + cdvDebugSigningPropertiesFile) 
    println('cdvBuildArch=' + cdvBuildArch) 
    println('computedVersionCode=' + android.defaultConfig.versionCode) 
    android.productFlavors.each { flavor -> 
     println('computed' + flavor.name.capitalize() + 'VersionCode=' + flavor.versionCode) 
    } 
} 

android { 
    compileSdkVersion 23 
    buildToolsVersion "23.3.0" 

    sourceSets { 
     main { 
      manifest.srcFile 'AndroidManifest.xml' 
      java.srcDirs = ['src'] 
      resources.srcDirs = ['src'] 
      aidl.srcDirs = ['src'] 
      renderscript.srcDirs = ['src'] 
      res.srcDirs = ['res'] 
      assets.srcDirs = ['assets'] 
      jniLibs.srcDirs = ['libs'] 
     } 
    } 

    defaultConfig { 
     versionCode cdvVersionCode ?: Integer.parseInt("" + privateHelpers.extractIntFromManifest("versionCode") + "0") 
     applicationId privateHelpers.extractStringFromManifest("package") 

     if (cdvMinSdkVersion != null) { 
      minSdkVersion cdvMinSdkVersion 
     } 
    } 

    lintOptions { 
     abortOnError false; 
    } 

    compileSdkVersion cdvCompileSdkVersion 
    buildToolsVersion cdvBuildToolsVersion 

    if (Boolean.valueOf(cdvBuildMultipleApks)) { 
     productFlavors { 
      armv7 { 
       versionCode defaultConfig.versionCode + 2 
       ndk { 
        abiFilters "armeabi-v7a", "" 
       } 
      } 
      x86 { 
       versionCode defaultConfig.versionCode + 4 
       ndk { 
        abiFilters "x86", "" 
       } 
      } 
      all { 
       ndk { 
        abiFilters "all", "" 
       } 
      } 
     } 
    } else if (!cdvVersionCode) { 
     def minSdkVersion = cdvMinSdkVersion ?: privateHelpers.extractIntFromManifest("minSdkVersion") 
     // Vary versionCode by the two most common API levels: 
     // 14 is ICS, which is the lowest API level for many apps. 
     // 20 is Lollipop, which is the lowest API level for the updatable system webview. 
     if (minSdkVersion >= 20) { 
     defaultConfig.versionCode += 9 
     } else if (minSdkVersion >= 14) { 
     defaultConfig.versionCode += 8 
     } 
    } 

    compileOptions { 
     sourceCompatibility JavaVersion.VERSION_1_6 
     targetCompatibility JavaVersion.VERSION_1_6 
    } 

    if (cdvReleaseSigningPropertiesFile) { 
     signingConfigs { 
      release { 
       // These must be set or Gradle will complain (even if they are overridden). 
       keyAlias = "" 
       keyPassword = "__unset" // And these must be set to non-empty in order to have the signing step added to the task graph. 
       storeFile = null 
       storePassword = "__unset" 
      } 
     } 
     buildTypes { 
      release { 
       signingConfig signingConfigs.release 
      } 
     } 
     addSigningProps(cdvReleaseSigningPropertiesFile, signingConfigs.release) 
    } 
    if (cdvDebugSigningPropertiesFile) { 
     addSigningProps(cdvDebugSigningPropertiesFile, signingConfigs.debug) 
    } 
} 

dependencies { 
    compile 'com.android.support:multidex:1.0.0' 
    compile fileTree(dir: 'libs', include: '*.jar') 
    // SUB-PROJECT DEPENDENCIES START 
    debugCompile project(path: "CordovaLib", configuration: "debug") 
    releaseCompile project(path: "CordovaLib", configuration: "release") 
    // SUB-PROJECT DEPENDENCIES END 
} 

def promptForReleaseKeyPassword() { 
    if (!cdvReleaseSigningPropertiesFile) { 
     return; 
    } 
    if ('__unset'.equals(android.signingConfigs.release.storePassword)) { 
     android.signingConfigs.release.storePassword = privateHelpers.promptForPassword('Enter key store password: ') 
    } 
    if ('__unset'.equals(android.signingConfigs.release.keyPassword)) { 
     android.signingConfigs.release.keyPassword = privateHelpers.promptForPassword('Enter key password: '); 
    } 
} 

gradle.taskGraph.whenReady { taskGraph -> 
    taskGraph.getAllTasks().each() { task -> 
     if (task.name == 'validateReleaseSigning') { 
      promptForReleaseKeyPassword() 
     } 
    } 
} 

def addSigningProps(propsFilePath, signingConfig) { 
    def propsFile = file(propsFilePath) 
    def props = new Properties() 
    propsFile.withReader { reader -> 
     props.load(reader) 
    } 

    def storeFile = new File(props.get('key.store') ?: privateHelpers.ensureValueExists(propsFilePath, props, 'storeFile')) 
    if (!storeFile.isAbsolute()) { 
     storeFile = RelativePath.parse(true, storeFile.toString()).getFile(propsFile.getParentFile()) 
    } 
    if (!storeFile.exists()) { 
     throw new FileNotFoundException('Keystore file does not exist: ' + storeFile.getAbsolutePath()) 
    } 
    signingConfig.keyAlias = props.get('key.alias') ?: privateHelpers.ensureValueExists(propsFilePath, props, 'keyAlias') 
    signingConfig.keyPassword = props.get('keyPassword', props.get('key.alias.password', signingConfig.keyPassword)) 
    signingConfig.storeFile = storeFile 
    signingConfig.storePassword = props.get('storePassword', props.get('key.store.password', signingConfig.storePassword)) 
    def storeType = props.get('storeType', props.get('key.store.type', '')) 
    if (!storeType) { 
     def filename = storeFile.getName().toLowerCase(); 
     if (filename.endsWith('.p12') || filename.endsWith('.pfx')) { 
      storeType = 'pkcs12' 
     } else { 
      storeType = signingConfig.storeType // "jks" 
     } 
    } 
    signingConfig.storeType = storeType 
} 

for (def func : cdvPluginPostBuildExtras) { 
    func() 
} 

// This can be defined within build-extras.gradle as: 
//  ext.postBuildExtras = { ... code here ... } 
if (hasProperty('postBuildExtras')) { 
    postBuildExtras() 
} 

这里是错误的完整输出:

启动输出

ANDROID_HOME=C:\Program Files (x86)\Android\android-sdk 
JAVA_HOME=C:\Program Files\Java\jdk1.7.0_71 
:preBuild UP-TO-DATE 
:preDebugBuild UP-TO-DATE 
:checkDebugManifest 
:CordovaLib:preBuild UP-TO-DATE 
:CordovaLib:preDebugBuild UP-TO-DATE 
:CordovaLib:compileDebugNdk UP-TO-DATE 
:CordovaLib:compileLint 
:CordovaLib:copyDebugLint UP-TO-DATE 
:CordovaLib:mergeDebugProguardFiles UP-TO-DATE 
:CordovaLib:packageDebugRenderscript UP-TO-DATE 
:CordovaLib:checkDebugManifest 
:CordovaLib:prepareDebugDependencies 
:CordovaLib:compileDebugRenderscript UP-TO-DATE 
:CordovaLib:generateDebugResValues UP-TO-DATE 
:CordovaLib:generateDebugResources UP-TO-DATE 
:CordovaLib:packageDebugResources UP-TO-DATE 
:CordovaLib:compileDebugAidl UP-TO-DATE 
:CordovaLib:generateDebugBuildConfig UP-TO-DATE 
:CordovaLib:generateDebugAssets UP-TO-DATE 
:CordovaLib:mergeDebugAssets UP-TO-DATE 
:CordovaLib:processDebugManifest UP-TO-DATE 
:CordovaLib:processDebugResources UP-TO-DATE 
:CordovaLib:generateDebugSources UP-TO-DATE 
:CordovaLib:compileDebugJavaWithJavac UP-TO-DATE 
:CordovaLib:processDebugJavaRes UP-TO-DATE 
:CordovaLib:transformResourcesWithMergeJavaResForDebug UP-TO-DATE 
:CordovaLib:transformClassesAndResourcesWithSyncLibJarsForDebug UP-TO-DATE 
:CordovaLib:mergeDebugJniLibFolders UP-TO-DATE 
:CordovaLib:transformNative_libsWithMergeJniLibsForDebug UP-TO-DATE 
:CordovaLib:transformNative_libsWithSyncJniLibsForDebug UP-TO-DATE 
:CordovaLib:bundleDebug UP-TO-DATE 
:prepareAndroidCordovaLibUnspecifiedDebugLibrary UP-TO-DATE 
:prepareDebugDependencies 
:compileDebugAidl UP-TO-DATE 
:compileDebugRenderscript UP-TO-DATE 
:generateDebugBuildConfig UP-TO-DATE 
:generateDebugAssets UP-TO-DATE 
:mergeDebugAssets UP-TO-DATE 
:generateDebugResValues UP-TO-DATE 
:generateDebugResources UP-TO-DATE 
:mergeDebugResources UP-TO-DATE 
:processDebugManifest 
:processDebugResources 
:generateDebugSources 
:compileDebugJavaWithJavac UP-TO-DATE 
:compileDebugNdk UP-TO-DATE 
:compileDebugSources UP-TO-DATE 
:transformClassesWithDexForDebugjava.lang.UnsupportedClassVersionError: 

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

    FAILURE: Build failed with an exception 

. 

* What went wrong: 
Execution failed for task ':transformClassesWithDexForDebug'. 
> com.android.ide.common.process.ProcessException: org.gradle.process.internal.ExecException: Process 'command 'C:\Program Files\Java\jdk1.7.0_71\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: 4.353 secs 
undefined 

额外的输出

的10
ANDROID_HOME=C:\Program Files (x86)\Android\android-sdk 
JAVA_HOME=C:\Program Files\Java\jdk1.7.0_71 
:preBuild UP-TO-DATE 
:preDebugBuild UP-TO-DATE 
:checkDebugManifest 
:CordovaLib:preBuild UP-TO-DATE 
:CordovaLib:preDebugBuild UP-TO-DATE 
:CordovaLib:compileDebugNdk UP-TO-DATE 
:CordovaLib:compileLint 
:CordovaLib:copyDebugLint UP-TO-DATE 
:CordovaLib:mergeDebugProguardFiles UP-TO-DATE 
:CordovaLib:packageDebugRenderscript UP-TO-DATE 
:CordovaLib:checkDebugManifest 
:CordovaLib:prepareDebugDependencies 
:CordovaLib:compileDebugRenderscript UP-TO-DATE 
:CordovaLib:generateDebugResValues UP-TO-DATE 
:CordovaLib:generateDebugResources UP-TO-DATE 
:CordovaLib:packageDebugResources UP-TO-DATE 
:CordovaLib:compileDebugAidl UP-TO-DATE 
:CordovaLib:generateDebugBuildConfig UP-TO-DATE 
:CordovaLib:generateDebugAssets UP-TO-DATE 
:CordovaLib:mergeDebugAssets UP-TO-DATE 
:CordovaLib:processDebugManifest UP-TO-DATE 
:CordovaLib:processDebugResources UP-TO-DATE 
:CordovaLib:generateDebugSources UP-TO-DATE 
:CordovaLib:compileDebugJavaWithJavacNote: Some input files use or override a deprecated API. 
Note: Recompile with -Xlint:deprecation for details. 

:CordovaLib:processDebugJavaRes UP-TO-DATE 
:CordovaLib:transformResourcesWithMergeJavaResForDebug UP-TO-DATE 
:CordovaLib:transformClassesAndResourcesWithSyncLibJarsForDebug UP-TO-DATE 
:CordovaLib:mergeDebugJniLibFolders UP-TO-DATE 
:CordovaLib:transformNative_libsWithMergeJniLibsForDebug UP-TO-DATE 
:CordovaLib:transformNative_libsWithSyncJniLibsForDebug UP-TO-DATE 
:CordovaLib:bundleDebug UP-TO-DATE 
:prepareAndroidCordovaLibUnspecifiedDebugLibrary UP-TO-DATE 
:prepareDebugDependencies 
:compileDebugAidl UP-TO-DATE 
:compileDebugRenderscript UP-TO-DATE 
:generateDebugBuildConfig UP-TO-DATE 
:generateDebugAssets UP-TO-DATE 
:mergeDebugAssets UP-TO-DATE 
:generateDebugResValues UP-TO-DATE 
:generateDebugResources UP-TO-DATE 
:mergeDebugResources UP-TO-DATE 
:processDebugManifest UP-TO-DATE 
:processDebugResources UP-TO-DATE 
:generateDebugSources UP-TO-DATE 
:compileDebugJavaWithJavac 
:compileDebugNdk UP-TO-DATE 
:compileDebugSources 
:transformClassesWithDexForDebugjava.lang.UnsupportedClassVersionError: com/android/dx/command/Main : Unsupported major.minor version 52.0 
     at java.lang.ClassLoader.defineClass1(Native Method) 
     at java.lang.ClassLoader.defineClass(ClassLoader.java:800) 
     at java.security.SecureClassLoader.defineClass(SecureClassLoader.java:142) 
     at java.net.URLClassLoader.defineClass(URLClassLoader.java:449) 
     at java.net.URLClassLoader.access$100(URLClassLoader.java:71) 
     at java.net.URLClassLoader$1.run(URLClassLoader.java:361) 
     at java.net.URLClassLoader$1.run(URLClassLoader.java:355) 
     at java.security.AccessController.doPrivileged(Native Method) 
     at java.net.URLClassLoader.findClass(URLClassLoader.java:354) 
     at java.lang.ClassLoader.loadClass(ClassLoader.java:425) 
     at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:308) 
     at java.lang.ClassLoader.loadClass(ClassLoader.java:358) 
     at sun.launcher.LauncherHelper.checkAndLoadMain(LauncherHelper.java:482) 
Exception in thread "main" 
FAILED 

FAILURE: Build failed with an exception. 

* What went wrong: 
Execution failed for task ':transformClassesWithDexForDebug'. 
> com.android.ide.common.process.ProcessException: org.gradle.process.internal.ExecException: Process 'command 'C:\Program Files\Java\jdk1.7.0_71\bin\java.exe'' finished with non-zero exit value 1 

java.lang.UnsupportedClassVersionError: com/android/dx/command/Main : Unsupported major.minor version 52.0 
     at java.lang.ClassLoader.defineClass1(Native Method) 
     at java.lang.ClassLoader.defineClass(ClassLoader.java:800) 
     at java.security.SecureClassLoader.defineClass(SecureClassLoader.java:142) 
     at java.net.URLClassLoader.defineClass(URLClassLoader.java:449) 
     at java.net.URLClassLoader.access$100(URLClassLoader.java:71) 
     at java.net.URLClassLoader$1.run(URLClassLoader.java:361) 
     at java.net.URLClassLoader$1.run(URLClassLoader.java:355) 
     at java.security.AccessController.doPrivileged(Native Method) 
     at java.net.URLClassLoader.findClass(URLClassLoader.java:354) 
     at java.lang.ClassLoader.loadClass(ClassLoader.java:425) 
     at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:308) 
     at java.lang.ClassLoader.loadClass(ClassLoader.java:358) 
     at sun.launcher.LauncherHelper.checkAndLoadMain(LauncherHelper.java:482) 
Exception in thread "main" 
* 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: 8.941 secs 
undefined 
+0

我想补充一点,即使在创建一个完全空白的cordova项目时,添加平台然后构建它,我仍然会得到完全相同的错误。我做错了什么? – Waldy

+0

看看我的答案[这里](http://*.com/questions/38182399/cant-compile-my-android-project/38197878#38197878)。希望能帮助到你。 – Lentyai

添加此

gradle.projectsEvaluated { 
    tasks.withType(JavaCompile) { 
     options.compilerArgs << "-Xlint:unchecked" 
    } 

到项目的build.gradle(上thedirectory结构的一个outtermost)的allprojects { ... }部分,会给你更详细的错误。更新你的答案,如果你需要进一步的帮助,我会协助

+0

我似乎无法在Android文件夹build.gradle文件中找到您正在讨论的“所有项目”部分。我一直试图解决这个问题,现在几个小时...仍然没有希望。 – Waldy

+0

不用担心...请参阅buildscript {...}部分?楼下,粘贴:allprojects { gradle.projectsEvaluated { tasks.withType(JavaCompile){ options.compilerArgs Chisko

+0

好吧,我将你的代码段添加到了你想要的地方,现在两个错误之间的唯一区别是它输出更多的信息。 (我把它说的主要问题:))。有任何想法吗? – Waldy

这不是一个答案,如何解决错误,但如果他们真的需要使用科尔多瓦建立一个APK引导。

我发现解决此问题的唯一方法是在另一个Windows系统(我的笔记本电脑)上安装Crodova,并且当我需要构建APK时,我会将项目文件(仅位于WWW中的)拖到我的笔记本电脑要建成......如果任何人都能解决这个问题,那将是一件好事,但暂时我找到了解决办法。

+0

在我看来,错误是由java编译器的混合配置造成的,其中一个指向1.7版本,另一个指向1.8版本。您现在使用的笔记本电脑似乎没有配置错误 – Chisko

+0

如果您发现某些对我的答案有用的信息,我会很感激,您会赞扬它。谢谢 :) – Chisko

我找到了解决办法 我在节点CMD写道: Java的版本(看看有什么是我的Java版本) 他告诉我,我的Java版本是1.8,但是很奇怪,因为当我试图建立我的应用程序,他告诉我,JAVA_HOME是1.7。 所以我检查了,我在程序文件中的Java 1.7和程序文件中的Java 1.8(x86) 我刚刚在Windows环境变量中对其进行了更改,重新加载了节点cmd,现在它可以工作。

我在Ubuntu 14.04上遇到了同样的问题,并且使用jdk 1.7。我通过安装jdk 1.8并相应地设置了JAVA_HOME路径来解决它(即,JAVA_HOME=/usr/lib/jvm/java-8-openjdk-amd64)。