Build application from command line - android

I'm trying to build an apk file from command line. I created a sample project usng the following command:
android create project --target 1 --name MyApp --path ./MyProject --activity MyActivity --package com.example.myapp
Which created the following structure:
/bin
/res
/src
/libs
AndroidManifest.xml
ant.properties
build.xml
local.properties
proguard-project.txt
project.properties
Now when I try to build the project, I get:
$ gradle build
gradle will not execute and completion _gradle exists.
I couldn't find any info on this error, so I ran:
$ _gradle build
_arguments:comparguments:312: can only be called from completion function
user has logged on pts/7 from :0.0.
Any hints on what am I doing wrong? Thanks!

android create project creates project in structure expected by Eclipse, not gradle based (Android Studio) projects.

I was able to build the apk using the following lines:
ant debug
adb install bin/HelloWorld-debug.apk

Related

How to create an Android Studio module in command line?

I'm trying to create a Bash script to automate the creation of some projects and modules to be used by Android Studio later. However, I can only find how to create projects using the command line, not modules:
android create project --gradle --gradle-version 1.5.0 --target "${BASE_API}" --name "${PROJECT_NAME}" --path "${PROJECT_NAME}" --activity DummyActivity --package it.doesnt.matter
How can I create a module inside the project created above using a Bash command?
A module is mostly just a directory of files. So:
Create a directory (mkdir yourModule)
Put whatever files you want in this directory, such as build.gradle
Script a solution to edit the settings.gradle file and add your module to the list of modules

Creating Project Cocos2d-x-3.1.1

I have downloaded Cocos2d-x-3.1.1 but it does not include #create-android-project.bat and #create-android-project.sh then i download these 2 files from the internet and i tried to create project i receive the error. anyone have any idea please kindly help.
.............
Resolved location library project to C:\ADT\cocos2d-x\cocos2dx\platform\android\java
Error: Project folder 'C:\ADT\cocos2d-x\cocos2dx\platform\android\java' is not valid directory
Error: No Android manifest at: C:\ADT\cocos2d-x\cocos2dx\platform\android\java
Error!!!
Don't run in cygwin. You should run corresponding bat.
Press any key to continue.
$ cocos new ProjName -p com.compnyName.ProjName -l cpp
You should use cocos2d-console for creating project.
$ cocos2d-x-3.1.1/tools/cocos2d-console/bin/cocos new -d . -p com.example.testproject -l cpp TestProject

ActionBarSherlock: How To Build ViewPagerTutorial? No build.xml

I downloaded the ActionBarSherlock ViewPagerTutorial from here:
http://www.androidbegin.com/tutorial/android-actionbarsherlock-viewpager-tabs-tutorial/
But when I try to build the package it errors out saying:
$ ant debug
Buildfile: build.xml does not exist!
Build failed
Where can I find the build.xml file for this package?
Where can I find the build.xml file for this package?
You create it, by running the android update project command.

how to generate apk using ant

i want to know how can we generate apk file using ant script. i came to know that we can use "ant debug" command to do that.but when i am running this command it is returning error that " Target "debug" does not exist in the project". i am using ant1.7.0.is it the issue?i have tried given below code to generate apk.
<target depends="build-subprojects,build-project" name="build">
<jar destfile="bin/test.apk" basedir="bin/classes" >
<manifest>
<attribute name="Main-Class" value="test.Main" />
</manifest>
</jar>
</target>
but the generated apk is different from auto generated apk while build the app using eclipse.Please guide me.
but when i am running this command it is returning error that " Target "debug" does not exist in the project"
Then you did not create your Android project properly, or you modified your build.xml file, or something else is broken.
As a test, I just ran the following command from my /tmp directory on Linux:
android create project --target android-17 --path Foo --package com.foo --activity Foo
I then changed into the Foo directory and ran ant debug. The app compiled, and in my bin/ directory is Foo-debug.apk.
If you are not getting this sort of result, delete your build.xml file and run android update project --path ..., where ... is the path to your project, to create a fresh build.xml file.

Build android project from command line

I would like to build and android project from command line on Linux. In the root directory of the project there are the following files and directories:
AndroidManifest.xml build.xml default.properties res/ src/
Can you provide a sample Makefile how to build this project?
Do you have 'ant' installed? Try ant debug
The build.xml file is input to the Ant program, which will build your project. Use "ant build"

Categories

Resources