Java Android Studio cordova推送插件

Java Android Studio cordova推送插件,java,android,cordova,Java,Android,Cordova,有人能帮我吗?我是安卓工作室的新手 在我的项目中安装插件推送后,我收到以下错误消息: 错误:任务“:dexDebug”的执行失败 com.android.ide.common.process.ProcessException:org.gradle.process.internal.ExecException:process'command'/Library/Java/JavaVirtualMachines/jdk1.7.0_09.jdk/Contents/Home/bin/Java''以非零退出

有人能帮我吗?我是安卓工作室的新手

在我的项目中安装插件推送后,我收到以下错误消息:

错误:任务“:dexDebug”的执行失败

com.android.ide.common.process.ProcessException:org.gradle.process.internal.ExecException:process'command'/Library/Java/JavaVirtualMachines/jdk1.7.0_09.jdk/Contents/Home/bin/Java''以非零退出值2结束

我使用Android studio 1.3.2和Cordova

我已经找了好几天了,但找不到解决办法

我希望你是指这个文件

    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.
*/

import java.util.regex.Pattern
import groovy.swing.SwingBuilder

String doEnsureValueExists(filePath, props, key) {
    if (props.get(key) == null) {
        throw new GradleException(filePath + ': Missing key required "' + key + '"')
    }
    return props.get(key)
}

String doGetProjectTarget() {
    def props = new Properties()
    file('project.properties').withReader { reader ->
        props.load(reader)
    }
    return doEnsureValueExists('project.properties', props, 'target')
}

String[] getAvailableBuildTools() {
    def buildToolsDir = new File(getAndroidSdkDir(), "build-tools")
    buildToolsDir.list()
        .findAll { it ==~ /[0-9.]+/ }
        .sort { a, b -> compareVersions(b, a) }
}

String doFindLatestInstalledBuildTools(String minBuildToolsVersion) {
    def availableBuildToolsVersions
    try {
        availableBuildToolsVersions = getAvailableBuildTools()
    } catch (e) {
        println "An exception occurred while trying to find the Android build tools."
        throw e
    }
    if (availableBuildToolsVersions.length > 0) {
        def highestBuildToolsVersion = availableBuildToolsVersions[0]
        if (compareVersions(highestBuildToolsVersion, minBuildToolsVersion) < 0) {
            throw new RuntimeException(
                "No usable Android build tools found. Highest installed version is " +
                highestBuildToolsVersion + "; minimum version required is " +
                minBuildToolsVersion + ".")
        }
        highestBuildToolsVersion
    } else {
        throw new RuntimeException(
            "No installed build tools found. Please install the Android build tools version " +
            minBuildToolsVersion + " or higher.")
    }
}

// Return the first non-zero result of subtracting version list elements
// pairwise. If they are all identical, return the difference in length of
// the two lists.
int compareVersionList(Collection aParts, Collection bParts) {
    def pairs = ([aParts, bParts]).transpose()
    pairs.findResult(aParts.size()-bParts.size()) {it[0] - it[1] != 0 ? it[0] - it[1] : null}
}

// Compare two version strings, such as "19.0.0" and "18.1.1.0". If all matched
// elements are identical, the longer version is the largest by this method.
// Examples:
//   "19.0.0" > "19"
//   "19.0.1" > "19.0.0"
//   "19.1.0" > "19.0.1"
//   "19" > "18.999.999"
int compareVersions(String a, String b) {
    def aParts = a.tokenize('.').collect {it.toInteger()}
    def bParts = b.tokenize('.').collect {it.toInteger()}
    compareVersionList(aParts, bParts)
}

String getAndroidSdkDir() {
    def rootDir = project.rootDir
    def androidSdkDir = null
    String envVar = System.getenv("ANDROID_HOME")
    def localProperties = new File(rootDir, 'local.properties')
    String systemProperty = System.getProperty("android.home")
    if (envVar != null) {
        androidSdkDir = envVar
    } else if (localProperties.exists()) {
        Properties properties = new Properties()
        localProperties.withInputStream { instr ->
            properties.load(instr)
        }
        def sdkDirProp = properties.getProperty('sdk.dir')
        if (sdkDirProp != null) {
            androidSdkDir = sdkDirProp
        } else {
            sdkDirProp = properties.getProperty('android.dir')
            if (sdkDirProp != null) {
                androidSdkDir = (new File(rootDir, sdkDirProp)).getAbsolutePath()
            }
        }
    }
    if (androidSdkDir == null && systemProperty != null) {
        androidSdkDir = systemProperty
    }
    if (androidSdkDir == null) {
        throw new RuntimeException(
            "Unable to determine Android SDK directory.")
    }
    androidSdkDir
}

def doExtractIntFromManifest(name) {
    def manifestFile = file(android.sourceSets.main.manifest.srcFile)
    def pattern = Pattern.compile(name + "=\"(\\d+)\"")
    def matcher = pattern.matcher(manifestFile.getText())
    matcher.find()
    return Integer.parseInt(matcher.group(1))
}

def doPromptForPassword(msg) {
    if (System.console() == null) {
        def ret = null
        new SwingBuilder().edt {
            dialog(modal: true, title: 'Enter password', alwaysOnTop: true, resizable: false, locationRelativeTo: null, pack: true, show: true) {
                vbox {
                    label(text: msg)
                    def input = passwordField()
                    button(defaultButton: true, text: 'OK', actionPerformed: {
                        ret = input.password;
                        dispose();
                    })
                }
            }
        }
        if (!ret) {
            throw new GradleException('User canceled build')
        }
        return new String(ret)
    } else {
        return System.console().readPassword('\n' + msg);
    }
}

def doGetConfigXml() {
    def xml = file("res/xml/config.xml").getText()
    // Disable namespace awareness since Cordova doesn't use them properly
    return new XmlParser(false, false).parseText(xml)
}

def doGetConfigPreference(name, defaultValue) {
    name = name.toLowerCase()
    def root = doGetConfigXml()

    def ret = defaultValue
    root.preference.each { it ->
        def attrName = it.attribute("name")
        if (attrName && attrName.toLowerCase() == name) {
            ret = it.attribute("value")
        }
    }
    return ret
}

// Properties exported here are visible to all plugins.
ext {
    // These helpers are shared, but are not guaranteed to be stable / unchanged.
    privateHelpers = {}
    privateHelpers.getProjectTarget = { doGetProjectTarget() }
    privateHelpers.findLatestInstalledBuildTools = { doFindLatestInstalledBuildTools('19.1.0') }
    privateHelpers.extractIntFromManifest = { name -> doExtractIntFromManifest(name) }
    privateHelpers.promptForPassword = { msg -> doPromptForPassword(msg) }
    privateHelpers.ensureValueExists = { filePath, props, key -> doEnsureValueExists(filePath, props, key) }

    // These helpers can be used by plugins / projects and will not change.
    cdvHelpers = {}
    // Returns a XmlParser for the config.xml. Added in 4.1.0.
    cdvHelpers.getConfigXml = { doGetConfigXml() }
    // Returns the value for the desired <preference>. Added in 4.1.0.
    cdvHelpers.getConfigPreference = { name, defaultValue -> doGetConfigPreference(name, defaultValue) }
}
<代码>授权给Apache软件基金会(ASF) 一个或多个参与者许可协议。见通知文件 与此工作一起分发以获取更多信息 关于版权所有权。ASF许可此文件 根据Apache许可证,版本2.0( “许可证”);除非符合规定,否则您不得使用此文件 带着执照。您可以通过以下方式获得许可证副本: http://www.apache.org/licenses/LICENSE-2.0 除非适用法律要求或书面同意, 根据许可证分发的软件在 “按原样”的基础上,没有任何 种类,无论是明示的还是暗示的。请参阅许可证以获取详细信息 管理权限和限制的特定语言 根据许可证。 */ 导入java.util.regex.Pattern 导入groovy.swing.SwingBuilder 字符串不存在(文件路径、道具、键){ if(props.get(key)==null){ 抛出新的GradleException(filePath+':缺少所需的键“'+key+'”) } 返回道具。获取(关键) } 字符串doGetProjectTarget(){ def props=新属性() 文件('project.properties')。带读卡器{reader-> 道具加载(读卡器) } return不存在('project.properties',props',target') } 字符串[]getAvailableBuildTools(){ def buildToolsDir=新文件(getandroidsdkddir(),“构建工具”) buildToolsDir.list() .findAll{it==~/[0-9.]+/} .sort{a,b->比较(b,a)} } 字符串doFindLatestInstalledBuildTools(字符串minBuildToolsVersion){ def可用BuildTools版本 试一试{ availableBuildToolsVersions=getAvailableBuildTools() }捕获(e){ println“尝试查找Android构建工具时发生异常。” 掷e } 如果(可用的BuildToolsVersions.length>0){ def HighestBuildToolsVersions=availableBuildToolsVersions[0] if(比较(最高BuildToolsVersion,最小BuildToolsVersion)<0){ 抛出新的运行时异常( “未找到可用的Android生成工具。最高安装版本为”+ highestBuildToolsVersion+“所需的最低版本为”+ minBuildToolsVersion+“) } 最高构建工具版本 }否则{ 抛出新的运行时异常( “未找到已安装的生成工具。请安装Android生成工具版本”+ minBuildToolsVersion+“或更高版本。”) } } //返回减去版本列表元素的第一个非零结果 //成对的。如果它们都相同,则返回长度的差异 //这两个列表。 int比较列表(集合A部分、集合B部分){ def pairs=([aParts,bParts]).transpose() pairs.findResult(aParts.size()-bParts.size()){it[0]-it[1]!=0?it[0]-it[1]:null} } //比较两个版本字符串,例如“19.0.0”和“18.1.1.0”。如果全部匹配 //元素是相同的,通过这种方法,较长的版本是最大的。 //示例: // "19.0.0" > "19" // "19.0.1" > "19.0.0" // "19.1.0" > "19.0.1" // "19" > "18.999.999" 整数比较(字符串a、字符串b){ def aParts=a.tokenize('.').collect{it.toInteger()} def bParts=b.tokenize('.')。收集{it.toInteger()} 比较列表(A部分、B部分) } 字符串getAndroidSdkDir(){ def rootDir=project.rootDir def androidSdkDir=null 字符串envVar=System.getenv(“ANDROID_HOME”) def localProperties=新文件(rootDir,'local.properties') 字符串systemProperty=System.getProperty(“android.home”) 如果(envVar!=null){ androidSdkDir=envVar }else if(localProperties.exists()){ 属性=新属性() localProperties.withInputStream{instr-> 属性。加载(instr) } def sdkDirProp=properties.getProperty('sdk.dir')) if(sdkDirProp!=null){ androidSdkDir=sdkDirProp }否则{ sdkDirProp=properties.getProperty('android.dir') if(sdkDirProp!=null){ androidSdkDir=(新文件(rootDir,sdkDirProp)).getAbsolutePath() } } } if(androidSdkDir==null&&systemProperty!=null){ androidSdkDir=systemProperty } if(androidSdkDir==null){ 抛出新的运行时异常( “无法确定Android SDK目录。”) } androidSdkDir } def doExtractIntFromManifest(名称){ def manifestFile=file(android.sourceset.main.manifest.srcFile) def pattern=pattern.compile(名称+“=\”(\\d+\”) def matcher=pattern.matcher(manifestFile.getText()) matcher.find() 返回Integer.parseInt(matcher.group(1)) } def doPromptForPassword(msg){ if(System.console()==null){ def ret=null 新SwingBuilder().edt{ 对话框(模式:true,标题:“输入密码”,alwaysOnTop:true,可调整大小:false,locationRelativeTo:null,pack:true,show:true){ vbox{ 标签(文本:msg) def input=passwordField() 按钮(默认按钮:true,文本:“确定”,执行的操作:{ ret=input.password; 处置(); })