Is there a way to force Eclipse to automatically clean every run?

I am developing for Android and use Eclipse to create an apk that also has a .so file with C++ code in it. My problem is that when I only change the C++ code and recompile that outside of Eclipse, Eclipse doesn't really always see that it's changed and I have to clean the project and rebuild it before I can reliably start it. This behaviour has cost me lots of time because Eclipse is not using the new .so file.

Is there a way to force Eclipse to always rebuild the project before its being run ?


I'm not sure how familiar you are with ant, but if you are compiling your c++ files through command line, one thought is to create an ant build script that will:

  • recompile your c++ files
  • clean and build your apk
  • install your apk onto your device
  • Then you can be sure the generated apk is always built using the latest compiled code.


    In Project Options, go to "C/C++ Build.

    Select "Builder Settings" tab.

    Uncheck "Use default build command" and in the field Build command, just add the target "clean" as the first target.

    Eg assuming you have

    > make -j2 settings
    

    change it to

    > make clean -j2 settings
    

    As far as I know there is no way to force eclipse to always clean when you press the play button. You may consider a different IDE such as IntelliJ. You never have to 'clean' a project in that so I assume they re-build the project every time you press play...

    链接地址: http://www.djcxy.com/p/65842.html

    上一篇: RDF的模板系统?

    下一篇: 有没有办法强制Eclipse自动清理每个运行?