Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6884853
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 27, 20262026-05-27T05:33:41+00:00 2026-05-27T05:33:41+00:00

I am trying to do some stuff before a build of my Android project.

  • 0

I am trying to do some “stuff” before a build of my Android project.
The setup is roughly the following:

  • LibraryProject
  • AppA
  • AppB

I have run configurations for AppA + AppB
I know how to e.g. use the little checkmarks to e.g.

  • Deploy or not deploy
  • Run or not run

The one I am stuck with is Run Ant target.

What I want (the reason for this question) is telling my current running application (most of the time it is AppA when I press “run”, because I changed something in the code, to e.g. persist settings.

I have complete control over the app, and already wrote several scripts to e.g. talk via ADB to the device, or even talk to the current running app using UDP and a C# host application on my development machine. So if I am able to run a e.g. shutdown.exe (.NET written by me) I can tell my app to shutdown.

So to keep it “easy” I tried to get calc.exe to start when pressing “run” inside an Android project in Intellij. But I managed to get totally lost in the build.xml configuration IntelliJ uses for Android.

I tried:

  • adding an exec task to the build.xml
  • tell him to Run Ant targets
  • Adding some tests

They all have no effect. I can view the Ant Build in Intellij and start the task manually, still no effect (so I cant really know if they are started by the run configuration, because the may fail silently).

I added:

<target name="-pre-build">
    <exec executable="calc.exe"/>
    <echo message="HelloWorld"/>
</target>
<target name="-pre-compile">
       <exec executable="calc.exe"/>
        <echo message="HelloWorld"/>
</target>

Any tips what I am doing wrong? Oh, one more info. If I press the green button in the Ant Build toolbar on the highest level, android tells me something about “outdated build file”, but I think this is ok. Seems like he tries to run the whole Ant file then, which imports some android tasks before – but this is not what I want anyway.

So can anyone provide me an example (to start calc.exe). I will figure the rest out and update the post if neccessary for others to help.

Chris

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-27T05:33:42+00:00Added an answer on May 27, 2026 at 5:33 am

    IDEA doesn’t use any Ant build by default, what you see is probably the automatically generated build.xml for this project.

    You can create a new build.xml file with just the following inside:

    <project name="build" default="pre-build">
      <target name="pre-build">
        <exec executable="c:/windows/system32/calc.exe"/>
        <echo message="HelloWorld"/>
      </target>
    </project>
    

    In the Android Run/Debug configuration Before Launch section specify this Ant target to be run:

    run ant before launch

    I’ve verified it with a small sample project and calc.exe gets properly executed before I run the Android configuration in IntelliJ IDEA.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

When an exe file is run it prints out some stuff. I'm trying to
I'm trying to build an Ad system. Some time before i wanted to build
I'm trying to automate some stuff in MS Excel. When I try to set
I'm trying to load some stuff using AJAX when a user clicks a link,
I'm trying to do some async stuff in a webservice method. Let say I
i'm trying to port some Java stuff to C#. I'm just wondering if the
I'm trying to use the ofstream class to write some stuff to a file,
string percentage = e.Row.Cells[7].Text; I am trying to do some dynamic stuff with my
I am trying to do some simple formatting stuff with 'sed' in linux, and
I was trying to clean up some accessability stuff in my code, and inadvertently

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.