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
Related
Please how can I use the Gradle shipped with android studio out of android studio? I tried running gradle -v on my ubuntu command line but it says the command is not recognized.
For running gradle:
Download gradle
Unzip the zip file
add GRADLE_HOME/bin to your PATH environment variable
Somenthing like:
wget https://services.gradle.org/distributions/gradle-2.5-bin.zip
unzip gradle-2.5-bin.zip
export GRADLE_HOME="$HOME/yourGradleFolder"
PATH="$PATH:$GRADLE_HOME/bin"
More info here.
AndroidStudio donwloads the gradle distributions in this folder:
/home/xxxx/.gradle/wrapper/dists
If you would like to use the gradle wrapper inside the projects, it is enough to run
./gradlew xxxxxx
May you can install grade from
Gradel download link
Building and Running from the Command Line
then Follow this link Building and Running from the Command Line
please let me know if any issue.Thanks for asking.
I have a project I created in Android Studio. I want to update the package name, packageName inside java files, inside xml files, Android manifest and in build.gradle. I am using this command:
android update project --path /pathToMyProject --package updatedPackageName
however this command gives an error Error: Flag '--package' is not valid for 'update project'.
So the question is how can I achieve my objective using command line so that I can automate the process?
Best Regards
The command-line android tool hasn't been kept up-to-date for Gradle-based projects like Android Studio uses, so you're better off not using it.
Use of android tool is deprecated; instead use sdkmanager:
androidsdk/tools/bin/sdkmanager --update
https://developer.android.com/studio/command-line/sdkmanager.html
Make sure you have the Android SDK Command line tools installed:
and then the path is: androidsdk/cmdline-tools/latest/bin/sdkmanager (default path for on a mac: ~/Library/Android/sdk/cmdline-tools/latest/bin/sdkmanager
I am new to phonegap the tutorials I have referred to says that there should be a cordova.jar file inside the phonegap-2.9.1\lib\android path. But I don't have it in this phonegap 2.9.1 version.
Can I download the cordova.jar from anywhere or is there any alternative?
Someone please help me.
Thanks.
First, you need the following requisites, for sure are covered if you have been playing with phonegap/cordova for a while ;)
Java JDK 1.5 or greater
Apache ANT 1.8.0 or greater
Android SDK http://developer.android.com
And then, to generate the cordova-2.9.1.jar file, follow the next steps:
Download and extract the phonegap-2.9.1.zip file.
In a terminal/cmd window go inside the recently extracted directory:
$ cd phonegap-2.9.1\lib\android\framework\
Execute the following commands (you need android sdk and ant already configured in your system path):
$ android update project -p . -t android-17
If required add the --subprojects parameter:
$ android update project -p . -t android-17 --subprojects
You get a message like this:
Updated project.properties
Updated local.properties
build.xml: Found version-tag: custom. File will not be updated.
Updated file D:\work_NEW\phonegap-2.9.1\lib\android\framework\proguard-project.txt
Updated and renamed default.properties to project.properties
Updated local.properties
No project name specified, using Activity name 'DroidGap'.
If you wish to change it, edit the first line of build.xml.
Added file D:\work_NEW\phonegap-2.9.1\lib\android\framework\bin\build.xml
Added file D:\work_NEW\phonegap-2.9.1\lib\android\framework\bin\proguard-project.txt
Finally run:
$ ant jar
Blablabla....
jar:
[jar] Building jar: xxx\phonegap-2.9.1\lib\android\framework\ cordova-2.9.1.jar
BUILD SUCCESSFUL
Total time: 4 seconds
Done!!!!! The file is ready! And you can find this and other information reading a file inside the phonegap-2.9.1.zip:
phonegap-2.9.1\lib\android\README.md
Since 3.x version phonegap has changed a lot. I suggest you to install 3.3 version and create a proyect following the steps described in the offical page.
Also, you can download cordova from cordova web page, add to path, and create a proyect using terminal:
cordova create app_name
cordova platform add android || cordova build android
In 3.3.0 version, You can get cordova-3.3.0.jar file by following these steps:
Go to Command Prompt:
$ cd %HOMEPATH%/.cordova/lib/android/cordova/3.3.0/framework
$ android update project -p
$ ant jar
After executing these commands you will get cordova-3.3.0.jar in framework folder i.e.
=> %HOMEPATH%/.cordova/lib/android/cordova/3.3.0/framework/cordova-3.3.0.jar
When was the cordova.jar file removed from Cordova and replaced with CordovaLib? I was previously running Cordova 3.1.0-0.1.0.
Today I have upgraded to Cordova 3.3.0 (which was quite a headache, but I've completed the upgrade) and I've noticed a difference in my Android project structure: Cordova has created my project (with what I've named it) and it has also created -CordovaLibs.
Is this right? I know iOS it does this - but not Android (as I say, usually a JAR is added).
It's introduced in 3.3, had me baffled too.
Cordova 3.3 release notes:
http://cordova.apache.org/announcements/2013/12/16/cordova-330.html
CB-5232 Change create script to use Cordova as a Library Project
instead of a .jar
To generate file cordova3.3.0.jar, just follow these steps bellow:
Open your cmd, and go to the root folder where Cordova is installed:
$ cd ~/.cordova/lib/android/cordova/3.3.0/framework
Run the following command, notice the trailing dot
$ android update project -p .
Use ant to generate file jar. Be sure you have configure PATH for
$ ant jar
Now, you can copy file cordova3.3.0.jar to libs directory and import to your project. Hope it's helpful
I am developing android application on Linux platform because i have to make a system.img with a application.
When adding a drawable resource and building the project with mm command, i met a below error.
"cannot find symbol
R.drawable.icon_send_type"
At above error, the icon_send_type is the added resource.
This error occurred because the mm command did not generate R.java.
So, I want to know how to generate R.java by a manual on Linux platform.
I solved the error that the R.java was not generated by mm command on linux platform.
The drawable resource's date was the problem.
I used a linux's touch command in res/drawable folder and i run the mm command, then R.java generated renewedly.
Try to remove the R.stamp file from your intermediates directory, like
out/target/common/obj/YOUR_APP_intermediates/src/R.stamp
Developing on Linux is no reason for not using the whole Eclipse IDE and the integration of all the tools that it brings you.
If you can't use Eclipse you can build your project with ant. If you create a project with the Android SDK there should be an ant file that helps you to build your project. I recommend reading this part of the documentation on how to work with other IDEs or without Eclipse.
I found tons of solutions about this problem, none worked.
My problem relied on Android SDK installation.
The ADT plugin for eclipse installed the SDK without the build tools, incredible but true.
So I brought to sight the Android sdk manager:
windows --> customize perspectives... --> command groups availability (I checked Android SDK and AVD manager)
After that I installed the build tools:
Window --> Android SDK manager (I checked the build tools for android)
Close and restart eclipse
Finally the CLEAN command worked