windows – Should I use Ant or Gradle to build an Android project using the command line?-ThrowExceptions

Exception or error:

I want to create a new android project with command line (in windows) and compile it.

Should I use Ant or Gradle ?

I have made copy from another project but I want to build it with a command.

public class serveur {
    public static void main(String[] args) throws IOException, InterruptedException {
        System.out.println(" debut class serveur");
        //copier android original
        Copy_projet.copyFullRecursive(new File("C:/Users/admin/Desktop/exécution/Partie2DeProjet/Android originale"), new File("C:/Users/admin/Desktop/exécution/Partie2DeProjet/nouvelleApplication"));
        System.out.println(" projet crée");
        //recevoire les informations de la part du client android
        System.out.println(" information reçu");
        //copie le xml layout et
        System.out.println(" xml et main copie ");
        //modifie le manifest
        System.out.println(" le manifest a était modifie ");
        //envoyer apk vers application android

        System.out.println("fin class serveur ");
How to solve:

The code you posted is not an android project. It’s an incomplete java program. Android projects don’t need a main method like regular java programs – it specifies a launchpoint in the AndroidManifest file. Assuming you have more code with this (where are the imports?), and you have the java jdk, you could run it (assuming your file is named using

java serveur

Look here for more on running java programs.

If you indeed have an Android program, that is unrelated to the code you posted, the building is a little more complicated, and I recommend using an IDE (Eclipse, Android Studio). It’s possible to build from cmd line but it’s more complicated for an android project. You will need to use a build tool like ant or gradle.

Look here for managing Android projects in command line

Look here for running your android project from command line

Once again, if you want to create android projects, you should really use a development environment like Android studio.

Leave a Reply

Your email address will not be published. Required fields are marked *