Delivering builds through slack with Circle CI not working in Android - android

I am configured "config.yml" file in Circle CI for Android, I need to deliver my APK to slack channel, all the things are configured as success, and build created successfully, but upload to slack does not work. Here is my config.yml code part for uploading
- run:
name: Upload to Slack
command: |
export GIT_COMMIT_DESC=$(git log --format=oneline -n 1 | sed -E 's/^[^ ]+
(.*)$/\1/g')
curl -F file=#app/build/outputs/apk/debug/empower_deposit-development.apk -F
channels=$SLACK_CHANNEL -F token=$SLACK_API_TOKEN -F title="${CIRCLE_PROJECT_REPONAME} |
branch -> ${CIRCLE_BRANCH} | commit -> ${GIT_COMMIT_DESC}"
https://slack.com/api/files.upload
Please help me for that.
Thanks

Related

BrowserStack Jenkins Pipeline AppUploader "File not found at" Error

I'm trying to set up a basic BrowserStack sample App with Jenkins a Jenkinsfile for the Pipeline.
Reading the documentation of the BrowserStack plugin for Jenkins I came up with the following step:
// ...
stages {
stage('assemble') {
// Here the App gets assembled
}
stage('upload-to-browserstack'){
steps{
browserstack(credentialsId: '<credentials>'){
sh 'test -e app/build/outputs/apk/flavorProduction/debug/browserstack-sample-debug.apk && echo exists || echo does not exist'
browserstackAppUploader('app/build/outputs/apk/flavorProduction/debug/browserstack-sample-debug.apk'){
}
}
}
}
}
// ...
This results in the following error message:
[BrowserStack] Starting upload process.
[BrowserStack] Uploading app app/build/outputs/apk/flavorProduction/debug/browserstack-sample-debug.apk to Browserstack.
[BrowserStack] [ERROR] File not found at app/build/outputs/apk/flavorProduction/debug/browserstack-sample-debug.apk
[BrowserStack] ERROR : App Id empty. ABORTING!!!
I can see, that the file exists on my Jenkins instance. How can I upload the APK to the BrowserStack server or am I using a wrong syntax for this?
You can use any of the two scripts in your Jenkins build step in order to upload an app and use the hash ID from the response.
result="$(curl -u ":" -X POST "https://api-cloud.browserstack.com/app-automate/upload" -F "file=#/Users/Downloads/BStackSampleApp_1.ipa" | jq -r '.app_url')"
result="$(curl -u ":" -X POST "https://api-cloud.browserstack.com/app-automate/upload" -F "file=#/Users/Downloads/BStackSampleApp_1.ipa" | jq '.app_url' | tr -d \")"
You can then export the value of the result as the environment variable for the Jenkins configuration.

How to install Fastlane on Buddybuild

I try to install Fastlane in a pre build step on Buddybuild.
My pre build script looks like this:
#!/bin/bash
if ! which fastlane >/dev/null; then
echo "Installing fastlane this may need sudo"
sudo gem install fastlane
else
echo "Updating fastlane this may need sudo"
sudo gem update fastlane
fi
I get the following error:
ERROR: Error installing fastlane:
ERROR: Failed to build gem native extension.
/usr/bin/ruby2.1 mkrf_conf.rb .
Building native extensions. This could take a while...
/usr/lib/ruby/2.1.0/rubygems/ext/builder.rb:89:in `run': ERROR: Failed to build gem native extension. (Gem::Ext::BuildError) .
/usr/bin/ruby2.1 extconf.rb .
mkmf.rb can't find header files for ruby at
/usr/lib/ruby/include/ruby.h
extconf failed, exit code 1
How can I solve this?
Rest of the Log
Gem files will remain installed in /var/lib/gems/2.1.0/gems/unf-0.2.0.beta2/ext/gems/gems/unf_ext-0.0.7.4 for inspection.
Results logged to /var/lib/gems/2.1.0/gems/unf-0.2.0.beta2/ext/gems/extensions/x86_64-linux/2.1.0/unf_ext-0.0.7.4/gem_make.out
from /usr/lib/ruby/2.1.0/rubygems/ext/ext_conf_builder.rb:38:in block in build
from /usr/lib/ruby/2.1.0/tempfile.rb:324:in 'open'
from /usr/lib/ruby/2.1.0/rubygems/ext/ext_conf_builder.rb:17:in 'build'
from /usr/lib/ruby/2.1.0/rubygems/ext/builder.rb:161:in 'block (2 levels) in build_extension'
from /usr/lib/ruby/2.1.0/rubygems/ext/builder.rb:160:in 'chdir'
from /usr/lib/ruby/2.1.0/rubygems/ext/builder.rb:160:in 'block in build_extension'
from /usr/lib/ruby/2.1.0/rubygems/ext/builder.rb:159:in 'synchronize'
from /usr/lib/ruby/2.1.0/rubygems/ext/builder.rb:159:in `build_extension'
from /usr/lib/ruby/2.1.0/rubygems/ext/builder.rb:198:in 'block in build_extensions'
from /usr/lib/ruby/2.1.0/rubygems/ext/builder.rb:195:in 'each'
from /usr/lib/ruby/2.1.0/rubygems/ext/builder.rb:195:in 'build_extensions'
from /usr/lib/ruby/2.1.0/rubygems/installer.rb:677:in 'build_extensions'
from /usr/lib/ruby/2.1.0/rubygems/installer.rb:232:in 'install'
from /usr/lib/ruby/2.1.0/rubygems/resolver/specification.rb:78:in 'install'
from /usr/lib/ruby/2.1.0/rubygems/request_set.rb:206:in 'block in install_into'
from /usr/lib/ruby/2.1.0/rubygems/request_set.rb:198:in 'each'
from /usr/lib/ruby/2.1.0/rubygems/request_set.rb:198:in 'install_into'
from /usr/lib/ruby/2.1.0/rubygems/request_set.rb:119:in 'install'
from /usr/lib/ruby/2.1.0/rubygems/dependency_installer.rb:389:in 'install'
from mkrf_conf.rb:15:in ''
rake failed, exit code 1
Gem files will remain installed in /var/lib/gems/2.1.0/gems/unf-0.2.0.beta2 for inspection.
Results logged to /var/lib/gems/2.1.0/extensions/x86_64-linux/2.1.0/unf-0.2.0.beta2/gem_make.out
Change your script to:
if ! which fastlane >/dev/null; then
echo "Installing fastlane..."
echo password | sudo -S gem install fastlane
else
echo "Updating fastlane..."
echo password | sudo -S gem update fastlane
fi
Our recommendation (and, as it turns out, fastlane's) is to use bundler and a Gemfile to achieve that. It lets you use a specific version of fastlane and, as a bonus, don't require sudo.
Let me know if this helps!

Building a kernel for Android: multiple target patterns

I am trying to build a kernel for Android following the instructions here.
Checking out the msm/angler:
git checkout -b android-msm-angler-3.10-marshmallow-mr1 origin/android-msm-angler-3.10-marshmallow-mr1
After make angler_defconfig, make results in the following error.
Makefile:796: *** multiple target patterns. Stop.
Would somebody help me to resolve this issue?
You can change prebuilts gcc
from:
arm/arm-eabi-X.X
to:
aarch64/aarch64-linux-android-X.X
go to aosp files.
In my scenario:
cd /aosp_files/out/target/product/angler
type in terminal:
dd if=kernel bs=1 skip=$(LC_ALL=C grep -a -b -o $'\x1f\x8b\x08\x00\x00\x00\x00\x00' kernel | cut -d ':' -f 1) | zgrep -a 'Linux version'
-> then You will see output with commit sha-1
Linux version 3.10.73-gde1f200
copy your sha-1 after 'g' -> de1f200
go to your kernel_files
git checkout your_sha1
then
export PATH=$(pwd)/prebuilts/gcc/linux-x86/arm/arm-eabi-4.6/bin:$PATH
export ARCH=arm64
export CROSS_COMPILE=aarch64-linux-android-
make angler_defconfig
make -j4
If You will get error
make distclean
repat from 4.
Should work : )

TeamCity: building with Gradle to retrieve path to <project name>/build/outputs/apk/*.apk regardless of which project?

We are currently setting up TeamCity with Gradle to build Android Projects and upload them to our in-house web server.
However, in order to upload the apk we would need to get the correct path to the build folder.
What would be the best approach to retrieve the apk from the build folder to extract as artefact, regardless of which project? We would like to use a meta-runner to get this working.
Thanks in advance!
To answer my initial question: I created a simple terminal search for the apk in the build folder sorted by date/last modified:
LAST_APK_FILE=`find . -name "*.apk" 2>/dev/null | xargs ls -1tr | tail -n 1`
We then copy this apk to a more readable filename:
NEW_APK_FILENAME=`echo $( echo "%teamcity.project.id%.apk" | tr " ()&'"! "______" )`
cp $LAST_APK_FILE $NEW_APK_FILENAME

color the lines of logcat on Linux [android]

The Logcat in Eclipse has colors for errors, warning, debug, ...
How can I do to get the same result on Linux (Ubuntu) when I run the command 'adb -e logcat' in a terminal to get it colored?
adb logcat -v color
from developer.android.com
Link with script
I think it will be useful for you and you can change script by yourself;)
This is my view of "colorizing" the logcat:
https://bitbucket.org/brunobraga/logcat-colorize
My favourite is pidcat, maintained by Jake Wharton based off of Jeff Sharkey's script (mentioned by Yaroslav Boichuk).
I have also used logcat-color, maintained by Marshall Culpepper, (also based off of Jeff's script) which allows you to create profiles you can activate (log per task, or per application, etc).
I have preferred pidcat because at the time logcat-color wouldn't filter by package name, and I never went back to try again once it was added. Seems to be reasonably popular still as well.
And yet another script:
#!/bin/sh
while :; do
adb $# logcat | sed \
-e 's:^V/:\x00\x1b[0;35m:g' \
-e 's:^D/:\x00\x1b[0;36m:g' \
-e 's:^I/:\x00\x1b[0;32m:g' \
-e 's:^W/:\x00\x1b[0;33m:g' \
-e 's:^E/:\x00\x1b[0;31m:g' \
-e 's:^F/:\x00\x1b[0;31m:g' \
-e '/Unexpected value from nativeGetEnabledTags/d' \
-e '/The application may be/d'
sleep 1
done
If you use Python, PyLogAnalyser can filter, colorize and analyse all type of logs in Linux, Windows and Mac (and Cygwin).
You can install it directly from PyPI:
python -m pip install pyloganalyser
And call it in order to print the log for the standard output (also, for text or HTML output):
adb logcat -v threadtime | python -m loganalyser --stdin --stdout -c Android_logcat_threadtime.conf
The file 'Android_logcat_threadtime.conf' is included in the module directory. So the actual invocation could be:
CONFPATH="$(python -c 'import loganalyser;print loganalyser.__file__.replace("/__init__.pyc","")')";
adb logcat -v threadtime | python -m loganalyser --stdin --stdout -c "$CONFPATH"/android/Android_logcat_threadtime.conf
Website: http://pyloganalyser.sourceforge.net
Have a try with lnav , add logcat config from here

Categories

Resources