asked    Miranda     2018-10-22       android       79 view        1 Answer

[SOLVED] VSTS Continuous Integration - Change SDK path

I'm looking for a solution for a problem. That is arise during Continuous Integration. To run the build command on my agent I have to give the path of the sdk of my server where build is going to be run. Normally the local.properties files are not part of git change list. I have come to know that there are git hooks for running custom scripts but after reading more, it seems like they are made for some other purpose.

What I want is that after I push the code the sdk directory path in local.properties gets changed to reflect the sdk path of my server and whenever i pull the code from the remote repository, the path automatically changes back to my local sdk path.

Please suggest, should i use the git hooks for this purpose or is there any better solution you guys follow or know.

Regards

  1 Answer  

        answered    Archibald     2018-10-22      

Okay, so i changed my approach. I used a powershell script as part of my build. So in the build pipeline before gradle build i added the powershell script task. After the agent copies the source code to the server the script runs and add a local.properties file with the path of the android sdk (server's). This was a more easier approach i believe.

Any one looking for solution. All you have to do is to create a new file with .ps1 extension at the root of your project. Here is the code

param([string] $fileName)
$sdkDir = "sdk.dir=C\:\\Users\\xyz\\AppData\\Local\\Android\\android-sdk" (path to your build server sdk)

Set-Content $fileName $sdkDir

the param will come from the argument section of the PowerShell Script task in build. You simply have to pass local.properties.

This way the local.properties file won't be part of git change list. Hope this helps someone. If you have any more questions regarding this feel free to ask.





Your Answer





 2018-10-22         Vivian

Best practice to include C++ libraries on my project

I am facing some problems related to how to handle C++ projects. I have a set of repositories all of the tracked with git (hosted on gitlab).repo_A: my current projectrepo_B: a library I have created and need to use in repo_AWhich is the best practice to include repo_B in repo_A?.Installing repo_B at system level? And then use repo_B from repo_A by using the CMakelistsAdding repo_B as submodule on repo_AAdding it in the CMakeLists by using something similar to what is explained in the googletest repositorycmake_minimum_required(VERSION 2.8.2)project(googletest-download NONE...
 c++                     1 answers                     57 view
 2018-10-22         Zora

Create (Cmake) C/C++ Library to Android without Android Studio

My goal is create a external library made in C/C++ which I can import in my Android Project.I know how to import, I know how to create a library from C/C++ inside the project using JNI, Cmake, etc. But this is not my goal.For this I'm using small steps, first with a simple library:gmath.c#include "gmath.h"#if defined(__GNUC__) && __GNUC__ >= 4#define GMATH_EXPORT __attribute__((visibility("default")))#elif defined(__SUNPRO_C) && (__SUNPRO_C >= 0x590)#define GMATH_EXPORT __attribute__((visibility("default")))#else#define GMATH_EXPORT#endifGMATH_EXPORT u...
 android                     1 answers                     61 view
 2018-10-22         Wordsworth

Multiplatform application to be executed from USB key

A client asked me to realize an application that must be executed from a USB key in Mac or Windows. It must be run without installation, the user has to insert the USB key and the program should run.I'm thinking to use Electron by copying .exe for Win and .app for Mac and all the files needed for the runtime on the USB key, but have never tried that.Has anyone tried it or something similar? You should specify a little more which kind of application you need.For example, assuming a browser is installed on every Windows PC and MacOS and internet connection is available may...
 usb                     1 answers                     55 view