Building APK through command line - android

For a new Android Studio Project I have somehow generated the files that are generated whenever we create a new project through Android Studio through a python script. This script also places the java and layout xml files in their respective locations. Now I want to build this project and generate the APK through command line only (without opening Android Studio).
I found the android command but that command is deprecated and no longer supported.
Image of the message when using android command
Now, can anyone please suggest any other way to build and create APK through command line?
I found this ant software but am unable to use it as I don't know how to create the build.xml file.
Please help me out.

Related

Phonegap create command generating empty project

Am following the phonegap guide for android here
I've being able to set up all the paths for java, ant, and the sdk.
After running the create <project_folder_path> <package_name> <project_name> command like is stated in the tutorial.
I get message saying its generating the project, after its done and i navigate to the project folder, the cordova.jar and cordova.js files are missing.
Do i have to do something extra ?

Ant create android project

I know that Ant is a build tool. We write script (steps while releasing android project) to build an android project and create a signed apk. Thats is one of the uses of Ant. But I want a method/script to create a new project in Android and I also want to build it so that an apk file can be created through that method/script. Is it possible through Ant?i.e. Ant script create a new project with a package name and activity name provided in the script, build it and create an apk file ready to be loaded in the emulator or device.Is there any solution(method/script) to the above mentioned problem?
yes you can do this through ant via a command line call to 'android create project' which will in turn generate all the ant scripts.

Android build from command line in Windows

I would like to build an Android project from command line instead of using Eclipse. I have installed ant on my Windows Vista, and I would like to run ant release but I can't find the file build.xml in the root directory of my Android project.
The project has been created using Eclipse. Is there a particular reason why the file build.xml doesn't exist ? How to find/generate it please ?
Thanks.
Take a look at this doc wrt how to update an Android project:
https://developer.android.com/studio/tools/help/android.html

Plugin Development for Android 2.3

I am new to Android and using Android 2.3 .
There is sample Browser plugin in the source code I am trying to build
it but unable to do so.
To compile plugin [ In README.txt ]
run "make SampleBrowserPlugin" (compiles libsampleplugin.so and
builds the apk)
the previous command produces an apk file so record its location.
Using the above steps I am unable to build it.
I have tried the following things :-
I thought to build the code in JNI folder first so as to get the
plugin ".so" so that after getting the ".so" would build the project
apk using the eclipse .
I tried building the code in the JNI folder using NDK build.The code
was not geting build it was giving "undefined reference to
JNIRegisterNativeMethod in JNIHelp.h "
Can anyone tell me how to build the Sample plugin and install it
on Emulator.
You need to "make SampleBrowserPlugin" from the root of your source installation (on a Linux machine). That is, the same directory that contains "bionic", "build", "dalvik", etc. as child directories.

Working with android and ant scripts for building applications

I want to know if we can create builds using ant's build.xml and when i'm trying to do this an error is displayed SDK location not mentioned and besides that I'm unable to find local.properties file to mention the SDK Location
My aim is that I want to use my exiting code and make a build for new Android SDK's with changes in the resources and and some constant values is this task Possible with making a build using Ant and if by some other way.
I have no idea about Ant and its functioning so it would very appreciable if minute details are also provided.
Well, first thing to do is get some knowledge on Ant, you'll need it to be effective. Just do a google for Ant tutorials.
For Android builds, create a sample project using the android command line (use android --help to see all options):
android create project -n SampleProject -t 7 -p ./sample -k com.sample -a MainActivity
This will generate a sample any build script that you can use as a starting point. To really understand how Android uses Ant, you'll want to take a look at the "android_rules.xml" file located at:
<android-install-dir>/platforms/<any-platform>/templates/android_rules.xml
This file has the definition for all the Ant targets used to build an android project. You can use those targets in your extension of the build.xml file that gets generated when you create the sample project

Categories

Resources