Ant没有使用`ant debug install`重建Android应用程序

Sno*_*all 14 ant android

从创建的干净项目开始:

android create project -n something -t android-7 -p something -k com.example.something -a Something
Run Code Online (Sandbox Code Playgroud)

当我ant debug install在我的模拟器中运行并打开应用程序时,我看到(正如预期的那样)

初始构建的模拟器截图

这就是它变坏的地方.我现在在应用程序中改变了一些微不足道的东西.在这个例子中,我setContentView将从主活动中删除调用,所以它看起来像这样:

package com.example.something;
import android.app.Activity;
import android.os.Bundle;
public class Something extends Activity {
    @Override
    public void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        //setContentView(R.layout.main);   REMOVED
    }
}
Run Code Online (Sandbox Code Playgroud)

现在我重建应用程序ant debug install并在模拟器中运行它.我看到了这个:

重建后的模拟器截图

这是错的.我刚刚删除了之前编辑的文本.如果我ant clean以前做过ant debug install,我会得到预期的结果:

重建后的预期结果

我不想ant clean在每次跑步之前跑步ant debug install.如何让ant实际重建程序而不是ant clean每次都运行?


细节:

这是inital的输出ant debug install:

$ ant debug install
Buildfile: /home/x/android/something/build.xml

-set-mode-check:

-set-debug-files:

-set-debug-mode:

-debug-obfuscation-check:

-setup:
     [echo] Gathering info for something...
    [setup] Android SDK Tools Revision 16
    [setup] Project Target: Android 2.1
    [setup] API level: 7
    [setup] 
    [setup] ------------------
    [setup] Resolving library dependencies:
    [setup] No library dependencies.
    [setup] 
    [setup] ------------------
    [setup] 
    [setup] WARNING: No minSdkVersion value set. Application will install on all Android versions.

-build-setup:
     [echo] Creating output directories if needed...
    [mkdir] Created dir: /home/x/android/something/bin
    [mkdir] Created dir: /home/x/android/something/bin/res
    [mkdir] Created dir: /home/x/android/something/gen
    [mkdir] Created dir: /home/x/android/something/bin/classes

-pre-build:

-code-gen:
     [echo] ----------
     [echo] Handling aidl files...
     [aidl] No AIDL files to compile.
     [echo] ----------
     [echo] Handling RenderScript files...
[renderscript] No RenderScript files to compile.
     [echo] ----------
     [echo] Handling Resources...
     [aapt] Generating resource IDs...

-pre-compile:

-compile:
    [javac] Compiling 2 source files to /home/x/android/something/bin/classes

-post-compile:

-obfuscate:

-dex:
      [dex] Converting compiled files and external libraries into /home/x/android/something/bin/classes.dex...

-crunch:
   [crunch] Crunching PNG Files in source dir: /home/x/android/something/res
   [crunch] To destination dir: /home/x/android/something/bin/res
   [crunch] Crunched 0 PNG files to update cache

-package-resources:
     [aapt] Creating full resource package...

-package:
[apkbuilder] Current build type is different than previous build: forced apkbuilder run.
[apkbuilder] Creating something-debug-unaligned.apk and signing it with a debug key...

-do-debug:
 [zipalign] Running zip align on final apk...
     [echo] Debug Package: /home/x/android/something/bin/something-debug.apk

debug:
[propertyfile] Creating new property file: /home/x/android/something/bin/build.prop
[propertyfile] Updating property file: /home/x/android/something/bin/build.prop
[propertyfile] Updating property file: /home/x/android/something/bin/build.prop
[propertyfile] Updating property file: /home/x/android/something/bin/build.prop

install:
     [echo] Installing /home/x/android/something/bin/something-debug.apk onto default emulator or device...
     [exec] 66 KB/s (4410 bytes in 0.065s)
     [exec]     pkg: /data/local/tmp/something-debug.apk
     [exec] Success

BUILD SUCCESSFUL
Total time: 5 seconds
Run Code Online (Sandbox Code Playgroud)

这是ant debug install编辑后第二个的输出:

$ ant debug install
Buildfile: /home/x/android/something/build.xml

-set-mode-check:

-set-debug-files:

-set-debug-mode:

-debug-obfuscation-check:

-setup:
     [echo] Gathering info for something...
    [setup] Android SDK Tools Revision 16
    [setup] Project Target: Android 2.1
    [setup] API level: 7
    [setup] 
    [setup] ------------------
    [setup] Resolving library dependencies:
    [setup] No library dependencies.
    [setup] 
    [setup] ------------------
    [setup] 
    [setup] WARNING: No minSdkVersion value set. Application will install on all Android versions.

-build-setup:
     [echo] Creating output directories if needed...

-pre-build:

-code-gen:
     [echo] ----------
     [echo] Handling aidl files...
     [aidl] No AIDL files to compile.
     [echo] ----------
     [echo] Handling RenderScript files...
[renderscript] No RenderScript files to compile.
     [echo] ----------
     [echo] Handling Resources...
     [aapt] No changed resources. R.java and Manifest.java untouched.

-pre-compile:

-compile:
    [javac] Compiling 1 source file to /home/x/android/something/bin/classes

-post-compile:

-obfuscate:

-dex:
      [dex] No new compiled code. No need to convert bytecode to dalvik format.

-crunch:
   [crunch] Crunching PNG Files in source dir: /home/x/android/something/res
   [crunch] To destination dir: /home/x/android/something/bin/res
   [crunch] Crunched 0 PNG files to update cache

-package-resources:
     [aapt] No changed resources or assets. something.ap_ remains untouched

-package:
[apkbuilder] No changes. No need to create apk.

-do-debug:
 [zipalign] No changes. No need to run zip-align on the apk.
     [echo] Debug Package: /home/x/android/something/bin/something-debug.apk

debug:
[propertyfile] Updating property file: /home/x/android/something/bin/build.prop
[propertyfile] Updating property file: /home/x/android/something/bin/build.prop
[propertyfile] Updating property file: /home/x/android/something/bin/build.prop
[propertyfile] Updating property file: /home/x/android/something/bin/build.prop

install:
     [echo] Installing /home/x/android/something/bin/something-debug.apk onto default emulator or device...
     [exec] 88 KB/s (4410 bytes in 0.048s)
     [exec]     pkg: /data/local/tmp/something-debug.apk
     [exec] Success

BUILD SUCCESSFUL
Total time: 3 seconds
Run Code Online (Sandbox Code Playgroud)

请注意-dex,-package-debug步骤都似乎认为我没有任何改变.