Building single project for android under jenkins - android

I just set up jenkins to build android projects for me but at the moment it seems to build all my projects under the workspace. Is there a way to define which project I want jenkins to build?
Current workspace structure is as below
Workspace
- project 1
- project 2
- project 3
In git I have it all checked under one branch. So when I check out it checks out all my projects.
I just need to know how to get jenkins to only build one of those projects. Any help would be greatly appreciated.
Thanks in advance

If there is a command line way of building your projects then I will execute a shell script as a part of the build (Execute shell). This shell script can take an passed parameter which will actually stand for the project you want to build.

Related

Android Studio - going to "Android" file tree format from "project" file tree format results in showing "gradle scripts" only

I'm importing from Bitbucket and am experiencing the issue. There are also no run configurations available. Do any Android gurus have an idea?
Thank you
-T
edit run config:
Different views will show and group your project files differently in Android Studio and IntelliJ IDEs. I think if you choose "Files", you will see all project files, and the actual directories in which they exist.
If this is a project you downloaded from bitbucket, you will most likely have to build the project yourself, and that is why you only see gradle scripts in the project view. You will also most likely have to create your own Run configurations.
Developers usually only upload the source files-- it's up to the end users downloading the project to build it themselves to generate the build files.
You could try creating and running your own "Android" Run configuration, and see where the build breaks, patch the current build failure + rerun. Rinse and repeat. Sorry for the bad news-- I've been frustrated in the past getting Android projects from github running for the same reasons.

Android Studio not including latest JNI libraries on Build -> Rebuild

There is some issue with android studio. My changes to the native code(library) are not getting effected on rebuild project. Following are the steps I am following.
Remove the existing libraries (rm -r jniLibs/* rm -r obj/local/*)
clean the project
make the project.
Run the app
I have to repeat the above steps 4 to 5 times and then my changes are seen. I am pretty sure I am missing something. Can you guys help me out if i need to change any configuration or something..
Here is the ndk command I am using..
ndk-build NDK_LIBS_OUT=./app/src/main/jniLibs
The above command is building my native code and is properly creating library in jniLibs folder. I am loading this library from my Java source code.

Android build application: gradlew does not exist

This is the first Android application I am running. I am reading up the tutorial and following it (as much as I can).
I would like to get myself comfortable with the CLI instead.
I created a project using "android" executable. Although to build the application it says to run the "gradlew" executable which is supposed to be in my project's root. I don't see it there.
What might I be missing ?
Created the project using
android create project --target 1 --name HelloWorld --path HelloWorld --activity HW --package com.developers.helloworld
Indeed, it does not exist, because when you create a project from the command line, the generated project is an Android project without gradle.
You have 3 options however:
Use the official IDE supported by Google - Android Studio - to build and run your apps. (recommended), or
Download and install Ant and
a) Change directory to your project root.
b) Execute from command line ant debug to compile your project.
c) Then adb install YourApp.apk to transfer the apk to your device (once compiled successfully, apk you'll find in the bin directory), or
Manually add Gradle to your project. But keep in mind that Gradle is a build tool that expects a project to have a specific directory structure, if you don't want to configure anything.
In general, is good to know what happens behind a shiny IDE, and know let say, how to generate an android project on your own, from the command line. This also is useful when you want to use an IDE of your preference, or have more control over the Android build.
But, honestly, if you are just getting started with Android, I would highly suggest you use Android Studio. With this option you get an intelligent code editor, implicit support for Gradle, access to a multitude of open source projects from Github that already use the gradle project structure, and other advantages.
UPDATE: how to view logs:
from command line: adb logcat
from GUI: navigate to <android-sdk>/tools, find and open monitor.
Once the window opens, you'll find a tab called LogCat, usually located in the left - bottom of the window, but if it is not there, then go to: Window -> Show View -> Android -> LogCat -> OK, to add it.
note: make sure only one device is connected to adb bridge
for filtering:
check this & this.
The tools/andoird create project has the --gradle flag to specify to use the gradle template instead of ant template.
Use tools/android create project help for more details.

How do I build an Android project using Ant? (IntelliJ IDE)

I've a project in the IntelliJ IDEA IDE and I want to set up a parallel, production Ant build process that I can extend over time.
I have used IntelliJ's feature to create an Ant build file, and it is on the Build menu, so the Ant build process is running, and working within the IDE. All good.
But the Ant script IntelliJ has created is only compiling to class files, and is not doing a full Android build process through to an APK (as far as I can tell).
Can you point me towards a reference source (or an example) to help me understand how to get an ANT script doing a full build of an Android project?
If you know, would also be v useful to know how to then extend it to include Proguard, production signing, and inserting the production Maps key :)
Use this as a starting point:
http://developer.android.com/guide/developing/other-ide.html
I don't know IntelliJ but I shoudn't be very hard to create an ant file with the most frequent commands you need.
UPDATE:
run the following command:
android create project --target 8 --name "MyFirstProject" --path /path/to/project --activity StartingActivity --package net.sample.package
This will create a project structure. This includes a build.xml file that contains targets to build the project.
To build the application, in the root folder (/path/to/project/) run:
ant debug
It should compile your application.
You may have to install or configure ant before this works correctly but you should be able to figure it out by yourself! :)
(All the info is in the link I posted earlier)
It's pretty well described in SDK documentation. Just 3 steps to make it work:
Assuming you have been developing your activity for a while with such powerful thing as IntelliJ Idea. So as Ollie mentioned in comment you don't have to create android project from scratch. Run in command line:
android update project --path "Path to your project" --target "android-X"
where X is API level
After step one build.xml was created automatically. Now you open IntelliJ, go to ant build panel and add that build.xml.
The important step is to open properties of created task and add debug OR release to command line at execution tab.
Now you can run target and enjoy the result. It will take some more efforts to compile into signed release.
Note: your existing project structure should match to android project. Please review documentation. E.g. I had external library put in "lib" subfolder and I managed it to work only after renaming "lib" to "libs"

How to Compile Sample Code

I'm breaking into GUI programming with android, trying to compile and analyze Lunar Lander sample program. The instructions for using Eclipse say to select "Create project from existing source" but that option doesn't exist. If I select File->New->Project I can select "Java project from Existing Ant Buildfile". Using that I've tried selecting various xml files as "Ant Buildfile" but all give me the "The file selected is not a valid Ant buildfile" error.
I just want to run GUI sample projects, preferably with Eclipse. Any useful tips will be appreciated.
First of all you need to install Eclipse ADT plugin, here are the instructions http://developer.android.com/guide/developing/eclipse-adt.html.
Then you can import sample code in two ways:
File -> New -> Android Project, and choose "Create project from existing source"
If it is already an Eclipse project, click File -> Import, after that right click on the Project and choose Make it an Android Project
I read you prefer Eclipse, but you can always work from command line.
In a GNU/Linux system it's possible to do
$ cp -r $ANDROID_SDK/samples/android-15/LunarLander .
$ android update project --path LunarLander/ --target 3 --subprojects
$ cd LunarLander/
$ ant debug install
You have to choose the target according to your system.
It's possible to pick one id from the list you get with this command
$ android list targets
It should be File->New-> Android Project you need to select. Apparently, you didn't install Android SDK
In the past you can use "ant" to compile:
https://tthtlc.wordpress.com/2015/08/01/how-to-quickly-compile-all-the-android-samples-via-command-line/
But since June 2014, the SDK has been encouraging user to migrate to using gradle, but it is frauds with lots of problem. By June 2015, compilation has been mostly successful. Here are the steps:
https://tthtlc.wordpress.com/2015/10/30/how-to-build-android-sdk-samples-using-gradle/
And the full compilation of all the samples under the "android-22" branch: I have 84 successful and 19 failures.
The full logs is available here:
http://pastebin.com/33JBDAqj

Categories

Resources