I've created a android project using eclipse. But I needs to do that same using command line. So, I use below command
> android update project --path .
> ant clean debug
Using above command its created-- Welcome-debug.apk and WelCome-debug-unaligned.apk
I also write the ant.properties file below-
key.store=./mykey.keystore
key.alias=MA
key.store.password=mypassword
key.alias.password=mypassword
now when I tried to build release version-
> ant relase
Unfortunately its not creating any release file. How do i create the release version using command line.
Expecting your response.
Thanks,
Pijman
You have a typo: it should be ant release.
You don't need to do anything specific. ant clean release should do the trick. However, note the clean target: ant is lazy and is trying to skip as much of the work as possible - thus if you do not clean it will not recreate the class files and you will actually pack an apk featuring the debug compiled files.
Related
I have android lib module (with native implementation). When I build the app (as debug) it also build this lib module (as debug) and as a result of lib build I get .aar (as a debug). All is fine here, I try to build debug and I get debug .aar.
Then, I need to build this android lib without the whole android app, just this lib. In order to do it I open Gradle tab at the right side in Android Studio window then I found my lib name -> Tasks -> build -> assemble. And this gradle task make a build for only this lib.
Issue is that as a result I get two .aar files one debug and one release. I don't need to get two I would like to have an option to choose what to build - debug or release.
Main issue here that it takes a lot of time for build this lib in debug and in release. Because of this I would like to choose how to build and it should save a time.
So, how to do it?
Since you are building all variant it will take time so You can use android build comment ./gradlew :app:assembleDebug or ./gradlew :app:assembleRelease . Run comment in your application root folder
NB:- if you application not in app folder means submodule use corresponding folder name instead of app ./gradlew ::assembleDebug
So I tried run, make, assemble, from android studio on a vanilla hello world app (it's the app that it creates from the default file -> new project and I can't find the unsigned APK in the MyApplication/build folder. I can generate a signed apk going through the build menu but I can't seem to find the auto generated debug apk.
I also tried following some instructions on going through the project structure menu but I can't find a plus button that adds an artifact.
If your project has modules (e.g., an app/) module, APKs go in the module. So, I would look in app/build/outputs/apk/ (again, assuming that you have an app/ module).
You should build apk by gradle.
1.Enter the root directory of your project and command ./gradlew -v to download gradle.
![./gradlew -v][1]
[1]: http://i.stack.imgur.com/iMbGO.jpg if you download successfully, you'll see this formation.
2.command ./gradlew clean to download dependencies of gradle.
![./gradlew clean][1]
[1]: http://i.stack.imgur.com/WlWQR.jpg if successfully, you'll see this formation.
3.command ./gradlew build to build and generate apks.
Enter [Your-project]/app/build/outputs/apk, you will see app-debug.apk, app-debug-unaligned.apk, app-release-unsigned.apk.
You can use the option Build -> Analyse Apk and you can find the path of your apk
I have a Xamarin project am looking to build a Android apk using mdtool, and the command line.
Here is the setup :
I have a mac mini - Xamarin Studio installed on it, I have the solution which build no problem.
Now from the command line this is what I an trying to do
#REM Traverse to the folder which holds the .sln file
cd One/Xamarin/Android/OneAndroid
#REM start the build using mdtool
'/Applications/Xamarin Studio.app/Contents/MacOS/mdtool' -v build OneAndroid.sln
The above completes the build for me , however I do not get an apk file.
Could someone share with me which option needs to be added onto mdtool to generate an apk file?
Thanks
Rajesh
I understand I maybe missing some parameters for mdtool
Use XBuild to compile the APK, for example:
xbuild MyXamarinAndroidApplication.csproj /p:Configuration=Release /t:SignAndroidPackage
This will compile the project in release mode and generate a signed and unsigned APK. If you just want an unsigned APK:
xbuild MyXamarinAndroidApplication.csproj /p:Configuration=Release /t:PackageForAndroid
It's worth noting that you have to specify a .csproj, not a .sln. If you give it a solution file, you'll get an error complaining that it can't find the "SignAndroidPackage" target.
Check out the build process documentation from Xamarin: http://docs.xamarin.com/guides/android/advanced_topics/build_process/offline.pdf
I am trying to set up a CI build server for an Android app project and its JUnit test project. I've generated the appropriate build.xml files for both app and test projects.
Both projects build and execute fine under Eclipse.
However, when I try to do ant debug on the test project without having first built both projects with Eclipse, I get several [javac] errors saying error: cannot find symbol which refer to classes in the app project.
I think this is a difference between the classpath that Eclipse sees and the classpath that Ant is using...
How do I tell Ant where to find the app classes?
It seems the Android default build.xml defines all the targets, so I was wondering how to insert the appropriate reference in the app project's build.xml... rather than having to start the build file from scratch.
Tried exporting the Ant build file from Eclipse; that fails to build either project.
What seems to work is to re-run:
android update test-project -m ../../app_project/ -p .
within the test project.
The only change it made was to create an ant.properties file with one non-comment line:
tested.project.dir=../../app_project/
And now it all works swimmingly outside of Eclipse!
anybody tell me, building apk using ant script
Check the android developers documentation in the Building and Running from the Command Line topic. Assumed you created your project with the android tool it should be:
ant release
The documentation also describes the "eclipse with ADT" way
If you first set up the project with eclipse than try to create a new temp project with the android create project command line command and take the build.xml (and build.properties + local.properties) from the new project for your existing one.
http://androidyou.blogspot.com/2012/12/android-project-ant-build-and-put.html
add one target to get the version, using the regular expression to extract it from the manifest.xml
then add this as a dependency to the release target