2

在我的项目中,我使用ant来构建我的apk包。每次升级我的android sdk后,我都必须调整我的构建脚本。谁能告诉我如何找到更改文件?

这是我的问题:第一次构建:控制台引发错误:

BUILD FAILED
build.xml:140: Missing attribute renderscriptSupportOutOut

错误脚本位置是:

<dependency
                libraryFolderPathOut="project.library.folder.path"
                libraryPackagesOut="project.library.packages"
                libraryManifestFilePathOut="project.library.manifest.file.path"
                libraryResFolderPathOut="project.library.res.folder.path"
                libraryBinAidlFolderPathOut="project.library.bin.aidl.folder.path"
                libraryNativeFolderPathOut="project.library.native.folder.path"
                libraryRFilePathOut="project.library.rfile.path"
                jarLibraryPathOut="project.all.jars.path"
                buildToolsFolder="${sdk.dir}/build-tools"
                targetApi="15"
                verbose="${verbose}" />

第二次构建,添加“renderscriptSupportOutOut”属性后,控制台引发错误:

BUILD FAILED
build.xml:140: dependency doesn't support the "renderscriptSupportOutOut" attribute

这是我的 buid.xml 部分:

<project name=“MyApp” default="release" basedir="." >

    <condition property="exe" value=".exe" else="">
        <os family="windows" />
    </condition>
    <condition property="bat" value=".bat" else="">
        <os family="windows" />
    </condition>

    <property name="verbose" value="false" />

    <property file="setting.properties" />
    <property file="project.properties" />

    <property name="sdk.dir" value="/WorkStation/Android/android-sdk-mac_86" />
    <property name="key.keystore" value="" />
    <property name="key.keystore.password" value="" />
    <property name="key.alias" value="" />
    <property name="key.alias.password" value="" />

    <property name="sdk.tool.dir" location="${sdk.dir}/tools" />
    <property name="sdk.platform.tool.dir" location="${sdk.dir}/platform-tools" />
    <property name="sdk.platform.build.tool.dir" location="${sdk.dir}/build-tools/17.0.0" />
    <property name="aidl" value="${sdk.platform.build.tool.dir}/aidl${exe}" />
    <property name="aapt" location="${sdk.platform.build.tool.dir}/aapt${exe}" />
    <property name="dx" location="${sdk.platform.build.tool.dir}/dx${bat}" />
    <property name="adb" location="${sdk.platform.tool.dir}/adb${exe}" />




    <property name="sdk.tool.android.jar" value="${sdk.dir}/platforms/android-15/android.jar" />
    <property name="sdk.tool.framework.aidl" value="${sdk.dir}/platforms/android-15/framework.aidl" />

    <property name="zipalign" location="${sdk.tool.dir}/zipalign${exe}"/>   
    <property name="jarsigner" location="${jdk.home}/bin/jarsigner${exe}" />

    <property name="proguard.jar" location="${sdk.tool.dir}/proguard/lib/proguard.jar"/>
    <property name="proguard.cfg" location="proguard.cfg"/> 


    <property name="project.name" value=“MyApp” />
    <property name="project.home" location="${base.dir}" />

    <property name="project.apk.name" value="${project.name}_beta" />

    <property name="pkgutil.dir" location=“${MyApp.home}/ant/pkgutil.jar" />

    <property name="src" value="src" />
    <property name="presrc" value="presrc" />
    <property name="res" value="res" />
    <property name="libs" value="libs" />
    <property name="native.lib" value="libs" />
    <property name="assets" value="assets" />
    <property name="gen" value="gen" />
    <property name="bin" value="antbin" />
    <property name="deploy" value="deploy" />

    <property name="src.dir" location="${basedir}/${src}" />
    <property name="presrc.dir" location="${basedir}/${presrc}" />
    <property name="res.dir" location="${res}" />
    <property name="libs.dir" location="${libs}" />
    <property name="native.lib.dir" location="${libs}" />
    <property name="assets.dir" location="${assets}" />
    <property name="gen.dir" location="${gen}" />
    <property name="out.dir" location="${bin}" />
    <property name="out.classes.dir" location="${out.dir}/classes" />
    <property name="out.aidl.dir" location="${out.dir}/aidl" />
    <property name="dex.file.dir" location="${out.dir}/classes.dex" />
    <property name="manifest.dir" location="${basedir}/AndroidManifest.xml" />
    <property name="proguard.dir" location="${out.dir}/proguard" />

    <property name="unsigned-apk" location="${out.dir}/${project.apk.name}_unsigned.apk" />
    <property name="released-apk" location="${out.dir}/${project.name}_release.apk" />
    <property name="zipalign-pkg-path" location="${basedir}/${bin}/${project.apk.name}_release_zipalign.apk" />


    <property name="temp.dir" location="${basedir}/temp" />
    <property name="temp.res.dir" value="${temp.dir}/res" />
    <property name="temp.libs.dir" value="${temp.dir}/libs" />
    <property name="deploy.dir" location="${deploy}" />
    <property name="temp.manifest.dir" location="${temp.dir}/AndroidManifest.xml" />    
    <property name="temp.assets.dir" location="${temp.dir}/assets"/>


    <property name="mapping.dir" location="${basedir}/mapping" />


    <path id="android.antlibs">
        <pathelement path="${sdk.dir}/tools/lib/ant-tasks.jar" />
        <pathelement path="${sdk.dir}/tools/lib/sdklib.jar" />
        <pathelement path="${sdk.dir}/tools/lib/androidprefs.jar" />
        <pathelement path="${sdk.dir}/tools/lib/apkbuilder.jar" /> 
    </path>



     <taskdef resource="anttasks.properties" classpathref="android.antlibs" />

    <gettarget
                androidJarFileOut="project.target.android.jar"
                androidAidlFileOut="project.target.framework.aidl"
                bootClassPathOut="project.target.class.path"
                targetApiOut="project.target.apilevel"
                minSdkVersionOut="project.minSdkVersion" 
                />

    <xpath input="${manifest.dir}" expression="/manifest/application/@android:hasCode"
           output="manifest.hasCode" default="true"/>

    <xpath input="${manifest.dir}" expression="/manifest/@package"
           output="oldPackageName" default="true"/>

    <xpath input="${manifest.dir}" expression="/manifest/application/provider/@android:authorities"
           output="oldAuthoritiesForProvider" default="true"/>

    <dependency
                libraryFolderPathOut="project.library.folder.path"
                libraryPackagesOut="project.library.packages"
                libraryManifestFilePathOut="project.library.manifest.file.path"
                libraryResFolderPathOut="project.library.res.folder.path"
                libraryBinAidlFolderPathOut="project.library.bin.aidl.folder.path"
                libraryNativeFolderPathOut="project.library.native.folder.path"
                libraryRFilePathOut="project.library.rfile.path"
                jarLibraryPathOut="project.all.jars.path"
                buildToolsFolder="${sdk.dir}/build-tools"
            renderscriptSupportOutOut="${sdk.dir}/build-tools/renderscript"
                targetApi="15"
                verbose="${verbose}" />

……
4

1 回答 1

2

检查依赖是如何写在 android-sdk\tools\ant\build.xml

    <dependency
            libraryFolderPathOut="project.library.folder.path"
            libraryPackagesOut="project.library.packages"
            libraryManifestFilePathOut="project.library.manifest.file.path"
            libraryResFolderPathOut="project.library.res.folder.path"
            libraryBinAidlFolderPathOut="project.library.bin.aidl.folder.path"
            libraryRFilePathOut="project.library.bin.r.file.path"
            libraryNativeFolderPathOut="project.library.native.folder.path"
            jarLibraryPathOut="project.all.jars.path"
            targetApi="${project.target.apilevel}"
            renderscriptSupportMode="${renderscript.support.mode}"
            buildToolsFolder="${android.build.tools.dir}"
            renderscriptSupportLibsOut="project.rs.support.libs.path"
            verbose="${verbose}" />
于 2013-11-18T20:44:32.427 回答