如何使用ant重命名或重构android包名?

时间:2015-07-02 10:09:23

标签: android ant

这是我的custon_rule.xml文件
我在所有可绘制文件夹中使用命令行更改图像 我有变化 使用ant或命令提示符的AndroidManifest.xml包名重构 我是android的新程序员请有人建议我如何重命名包名?

<?xml version="1.0" encoding="UTF-8"?>
<project name="SplashActivity" >

    <!-- The local.properties file is created and updated by the 'android' tool.
         It contains the path to the SDK. It should *NOT* be checked into
         Version Control Systems. -->
    <property file="local.properties" />
    <property name="dir" value="D:\AndroidProjects\RestoApp" />

    <property name="sdk.dir" location="D:\InstalledSoftwares\adt-bundle-windows-x86-20130219\sdk" />
     <!-- whether the build is a debug build. always set. -->
       <property name="build.is.packaging.debug" value="true" />
    <property name="version.code" value="" />
    <property name="version.name" value="" />
     <property name="aapt.ignore.assets" value="" />
    <property name="build.last.target" value="" />
    <property name="build.target" value="debug" />
    <property name="source.dir" value="${dir}\src" />

     <!-- Input directories -->
    <property name="source.dir" value="${dir}\src" />
    <property name="source.absolute.dir" location="${source.dir}" />
    <property name="gen.absolute.dir" location="${dir}\gen" />
    <property name="resource.absolute.dir" location="${dir}\res" />
    <property name="asset.dir" value="${dir}\assets" />
    <property name="asset.absolute.dir" location="${asset.dir}" />
    <property name="jar.libs.dir" value="${dir}\libs" />
    <property name="jar.libs.absolute.dir" location="${jar.libs.dir}" />
    <property name="native.libs.absolute.dir" location="${dir}\libs" />

    <property name="manifest.file" value="${dir}\AndroidManifest.xml" />
    <property name="manifest.abs.file" location="${manifest.file}" />

    <!-- Output directories -->
    <property name="out.dir" value="${dir}\bin" />
    <property name="out.absolute.dir" location="${out.dir}" />
    <property name="out.classes.absolute.dir" location="${out.dir}/classes" />
    <property name="out.res.absolute.dir" location="${out.dir}/res" />
    <property name="out.rs.obj.absolute.dir" location="${out.dir}/rsObj" />
    <property name="out.rs.libs.absolute.dir" location="${out.dir}/rsLibs" />
    <property name="out.aidl.absolute.dir" location="${out.dir}/aidl" />
    <property name="out.dexed.absolute.dir" location="${out.dir}/dexedLibs" />
    <property name="out.manifest.abs.file" location="${out.dir}/AndroidManifest.xml" />

    <!-- tools location -->
    <property name="android.tools.dir" location="${sdk.dir}/tools" />
    <property name="android.platform.tools.dir" location="${sdk.dir}/platform-tools" />
    <condition property="exe" value=".exe" else=""><os family="windows" /></condition>
    <condition property="bat" value=".bat" else=""><os family="windows" /></condition>
    <property name="adb" location="${android.platform.tools.dir}/adb${exe}" />
    <property name="lint" location="${android.tools.dir}/lint${bat}" />
    <echo message="aapt variable::${android.tools.dir}"/>
    <!-- Basic Ant + SDK check -->

    <target name="-check-env">
        <checkenv />
    </target>

    <property name="android.build.tools.dir.build.tool" location="${android.tools.dir}/build-tools\22.0.1"/>
    <property name="aidl" location="${android.build.tools.dir.build.tool}/aidl${exe}" />
    <property name="aapt" location="${android.build.tools.dir.build.tool}/aapt${exe}" />
    <property name="dx" location="${android.build.tools.dir.build.tool}/dx${bat}" />
    <property name="zipalign" location="${android.build.tools.dir.build.tool}/zipalign${exe}" />

<echo message="aapt variable::${aapt}"/>


    <target name="-crunch">
        <exec executable=":${aapt}" taskName="crunch">
            <arg value="crunch" />
            <arg value="-v" />
            <arg value="-S" />
            <arg path="${resource.absolute.dir}" />
            <arg value="-C" />
            <arg path="${out.res.absolute.dir}" />
        </exec>
    </target>






<target name="-package-resources" depends="-crunch">
        <do-only-if-not-library elseText="Library project: do not package resources..." >
            <echo level="info">packagin resources for package: ${project.app.package}</echo>
            <aapt executable=":${aapt}"
                    command="package"
                    versioncode="${version.code}"
                    versionname="${version.name}"
                    debug="${build.is.packaging.debug}"
                    manifest="${out.manifest.abs.file}"
                    assets="${asset.absolute.dir}"
                    androidjar="${project.target.android.jar}"
                    apkfolder="${out.absolute.dir}"
                    nocrunch="${build.packaging.nocrunch}"
                    resourcefilename="${resource.package.file.name}"
                    resourcefilter="${aapt.resource.filter}"
                    libraryResFolderPathRefid="project.library.res.folder.path"
                    libraryPackagesRefid="project.library.packages"
                    libraryRFileRefid="project.library.bin.r.file.path"
                    previousBuildType="${build.last.target}"
                    buildType="${build.target}"
                    ignoreAssets="${aapt.ignore.assets}"
                    manifestpackage="com.example">
                <res path="${out.res.absolute.dir}" />
                <res path="${resource.absolute.dir}" />
            </aapt>
        </do-only-if-not-library>
    </target>

    <target name="all" depends="-crunch, -package-resources"/>

</project>`

我的项目网址为D:\AndroidProjects\RestoApp

**我在命令提示符**

上显示错误
E:\ant test>ant all
Buildfile: E:\ant test\build.xml
     [echo] aapt variable::D:\InstalledSoftwares\adt-bundle-windows-x86-20130219
\sdk\tools
     [echo] aapt variable::D:\InstalledSoftwares\adt-bundle-windows-x86-20130219
\sdk\tools\build-tools\22.0.1\aapt.exe

-crunch:

BUILD FAILED
E:\ant test\build.xml:69: Execute failed: java.io.IOException: Cannot run progra
m ":D:\InstalledSoftwares\adt-bundle-windows-x86-20130219\sdk\tools\build-tools\
22.0.1\aapt.exe": CreateProcess error=2, The system cannot find the file specifi
ed
        at java.lang.ProcessBuilder.start(ProcessBuilder.java:1029)
        at java.lang.Runtime.exec(Runtime.java:615)
        at org.apache.tools.ant.taskdefs.launcher.Java13CommandLauncher.exec(Jav
a13CommandLauncher.java:58)
        at org.apache.tools.ant.taskdefs.Execute.launch(Execute.java:428)
        at org.apache.tools.ant.taskdefs.Execute.execute(Execute.java:442)
        at org.apache.tools.ant.taskdefs.ExecTask.runExecute(ExecTask.java:629)
        at org.apache.tools.ant.taskdefs.ExecTask.runExec(ExecTask.java:670)
        at org.apache.tools.ant.taskdefs.ExecTask.execute(ExecTask.java:496)
        at org.apache.tools.ant.UnknownElement.execute(UnknownElement.java:293)
        at sun.reflect.GeneratedMethodAccessor4.invoke(Unknown Source)
        at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAcces
sorImpl.java:43)
        at java.lang.reflect.Method.invoke(Method.java:601)
        at org.apache.tools.ant.dispatch.DispatchUtils.execute(DispatchUtils.jav
a:106)
        at org.apache.tools.ant.Task.perform(Task.java:348)
        at org.apache.tools.ant.Target.execute(Target.java:435)
        at org.apache.tools.ant.Target.performTasks(Target.java:456)
        at org.apache.tools.ant.Project.executeSortedTargets(Project.java:1405)
        at org.apache.tools.ant.Project.executeTarget(Project.java:1376)
        at org.apache.tools.ant.helper.DefaultExecutor.executeTargets(DefaultExe
cutor.java:41)
        at org.apache.tools.ant.Project.executeTargets(Project.java:1260)
        at org.apache.tools.ant.Main.runBuild(Main.java:853)
        at org.apache.tools.ant.Main.startAnt(Main.java:235)
        at org.apache.tools.ant.launch.Launcher.run(Launcher.java:285)
        at org.apache.tools.ant.launch.Launcher.main(Launcher.java:112)
Caused by: java.io.IOException: CreateProcess error=2, The system cannot find th
e file specified
        at java.lang.ProcessImpl.create(Native Method)
        at java.lang.ProcessImpl.<init>(ProcessImpl.java:189)
        at java.lang.ProcessImpl.start(ProcessImpl.java:133)
        at java.lang.ProcessBuilder.start(ProcessBuilder.java:1021)
        ... 23 more

Total time: 0 seconds

E:\ant test>

0 个答案:

没有答案