Bamboo integration for HockeyApp and Android - android

We are using HockeyApp for our Android application.
We want to automate all the deployment process. We started using Bamboo to build our .apk file and final step would be to distribute it to Hockey.
After a lot of browsing on the internet, I couldn't found any plugin available to do that. The only thing I found out available was: IOS, Cocoa and Xcode Support for Bamboo plugin - but this is for IOS only.
If there is no other plugin for Bamboo to use maybe someone knows a way that we can automate the process to distribute the .apk to Hockey? (e.g. write a script or something that HockeyApp supports).
Thank you,
Luisa

After some tinkering I found a method that works for me. I added an additional Script to the Build Job and used the following in the script body (be sure to use the apk filename in your config):
curl \
-F "status=2" \
-F "notify=1" \
-F "notes=Some new features and fixed bugs." \
-F "notes_type=0" \
-F "ipa=#app/build/outputs/apk/app-release.apk" \
-H "X-HockeyAppToken: AppTokenHere" \
https://rink.hockeyapp.net/api/2/apps/upload

Related

Unable to get gradle build-tools in docker - Apple M1

I recently switched to Apple M1 and am having a problem creating a docker image that eventually runs on a Buildkite linux CI. The same code runs just fine on my MacBook with an Intel chip and successfully creates a docker image.
The problem happens when sdkmanager tries to pull in build-tools;${ANDROID_BUILD_TOOLS_VERSION} with the latest commandlinetools, it fails with the following errors:
Warning: Dependant package with key emulator not found!
Warning: Unable to compute a complete list of dependencies.ates...
The closest issues I can find are Install build-tools: emulator not found and Error with android sdk, both without any resolutions. Also note that I have run sdkmanager --list, and emulator is not present as an available package there (just on M1).
Here is my Dockerfile (I don't work with docker too often so please excuse if the code is not the cleanest):
FROM gradle:7.4-jdk11
ENV SDK_URL="https://dl.google.com/android/repository/commandlinetools-linux-8092744_latest.zip" \
ANDROID_HOME="/usr/local/android-sdk" \
ANDROID_VERSION=32 \
ANDROID_BUILD_TOOLS_VERSION=32.0.0
RUN mkdir "$ANDROID_HOME" .android \
&& cd "$ANDROID_HOME" \
&& curl -o sdk.zip $SDK_URL \
&& unzip sdk.zip \
&& rm sdk.zip \
&& yes | $ANDROID_HOME/cmdline-tools/bin/sdkmanager --sdk_root=$ANDROID_HOME --licenses \
&& $ANDROID_HOME/cmdline-tools/bin/sdkmanager --sdk_root=$ANDROID_HOME --update \
&& $ANDROID_HOME/cmdline-tools/bin/sdkmanager --sdk_root=$ANDROID_HOME "platform-tools" "build-tools;${ANDROID_BUILD_TOOLS_VERSION}" \
&& $ANDROID_HOME/cmdline-tools/bin/sdkmanager --sdk_root=$ANDROID_HOME "platforms;android-${ANDROID_VERSION}" \
&& apt-get update \
&& apt-get install -y build-essential file apt-utils curl gnupg \
&& curl -sL https://deb.nodesource.com/setup_14.x | bash - \
&& apt-get -y install nodejs \
&& npm install -g firebase-tools -y \
&& rm -rf /var/lib/apt/lists/*
Side note; I had to upgrade usage of jdk8 to jdk11 for the Android build agent, the previous implementation was pulling in sdk-tools-linux-3859397.zip instead of commandlinetools-linux-8092744_latest.zip, and that was able to pull in build-tools via the sdkmanager just fine on the M1 as well and created a docker image.
Given that it builds on Intel, my task is technically complete, but it's going to be much easier in the long run that it runs on M1. Any ideas? Or can anyone suggest what the right place would be to raise this? Do you reckon it is a google command line tool issue or docker issue?
I just had the same problem on M1 Pro and this solved the issue for me.
In short: emulator is not available on Arm (M1) yet so you need to install it manually. You can follow the official guide but in short, this worked for me
Download emulator for Apple Silicon (example or you find more links in the [official guide](https://developer.android.com/studio/emulator_archive
Unzip the folder in Android SDK folder (it will create a SKD/emulator folder with files inside)
Create SDK/emulator/package.xml file with content from here and update the last part of the xml <revision><major>31</major><minor>1</minor><micro>4</micro></revision> with the version you downloaded
You should not see the same error again on M1 🎉
Spoiler Alert: I'm still not able to fully build on M1 because, during the actual build, I get the error
qemu-x86_64: Could not open '/lib64/ld-linux-x86-64.so.2': No such file or directory
I have same issue. I think there is no android 'emulator' package for linux/armv8 . So you won't be able to use docker with native images.
I tried to configure docker-compose file in order to use linux/x86_64 instead of linux/armv8 but there are others issues.
I add this line in docker-compose.yaml :
platform: linux/x86_64
like this :
version: '3.7'
services:
android:
platform: linux/x86_64
build:
dockerfile: Dockerfile
context: ./Docker
working_dir: /app/Android/Scripts
volumes:
- ../:/app:rw,cached
command: ./build_distribution.sh
# command: sh -c "while true; do sleep 10; done"
But I get a lot of issue with network. It seems that network layer on this architecture is buggy and sometimes it is stuck downloading an image or a component randomly...
Is there a way to make it work with one or other architecture ?

how to do image analysis on android camera api

I am currently working on making an document scanner app that draws the page detected in the camera preview. For this, I have been exploring many camera APIs and seem to find CameraX the easiest since it reduces the work for the developer a lot. Some issues that I am facing are:
Almost all of the examples of CameraX with ImageAnalysis are in
Kotlin. Even then, they all seem to just do rudimentary analysis
such as calculating the luminosity. What I want to do is draw a
border around the page in the preview itself. Can someone help me or
direct me to some resources that allow me to achieve this. For ex,
how to I even draw on the camera preview? Opencv requires the bitmap
to do all the image processing so which view should I use (ex:
SurfaceView, TextureView, PreviewView, etc...)? I have already tried most of them, but they all seem to give errors here and there.
This is not an immediate concern, but originally I was using OpenCV to make this
app but my goal was to eventually implement it from scratch since
using OpenCV considerably increases the APK size. I am a little
familiar with some of the algorithms and their workings (ex: Canny
edge, Harris Corner, inverse perspective transform, etc) but I need
help to actually implement them in android (preferably java) since that is where I am completely lost.
Even though I am completely new to Kotlin, I read most of the documentation on Kotlin, watched the CameraX google keynote events and went through the codelabs tutorial for setting up kotlin. When I understood all this, I looked at the Official sample app provided by google called CameraX Basic on github, I was completely lost. They put so much on there that it is hard for me to even understand it. An no matter where I look, not a single decent example suits my needs. Plus, on their docs, they have implementations in both kotlin and java but they only have the sample app in java.
In summary, I am not able to understand how to add my own ImageAnalysis to CameraX to scan a document and save the image (so I can provide more options later such as export to pdf, etc...)
I think your main problem is bigger OpenCV size. If you compile all the modules it would consume over 100MB (3.x version). But if you want to image processing than imgproc should suffice your needs. You can compile imgproc alone (around 4-5MB) by switching it ON and rest other modules to OFF using following command:
// Clone opencv git repo
$ git clone https://github.com/opencv/opencv.git
$ cd opencv
// Checkout the version that you need, example 3.4.3, ...
$ git checkout 3.4.3
// Create a build directory
$ mkdir build
$ cd build
// Run cmake command
$ cmake -DCMAKE_TOOLCHAIN_FILE=../platforms/android/android.toolchain.cmake -DANDROID_ABI=armeabi-v7a \
-DANDROID_NATIVE_API_LEVEL=23 \
-D WITH_CUDA=OFF \
-D WITH_MATLAB=OFF \
-D BUILD_ANDROID_EXAMPLES=OFF \
-D BUILD_DOCS=OFF \
-D BUILD_PERF_TESTS=OFF \
-D BUILD_TESTS=OFF \
-D ANDROID_STL=c++_shared \
-D BUILD_SHARED_LIBS=ON \
-D BUILD_opencv_objdetect=OFF \
-D BUILD_opencv_video=OFF \
-D BUILD_opencv_videoio=OFF \
-D BUILD_opencv_features2d=OFF \
-D BUILD_opencv_flann=OFF \
-D BUILD_opencv_highgui=OFF \
-D BUILD_opencv_ml=OFF \
-D BUILD_opencv_photo=OFF \
-D BUILD_opencv_python=OFF \
-D BUILD_opencv_shape=OFF \
-D BUILD_opencv_stitching=OFF \
-D BUILD_opencv_superres=OFF \
-D BUILD_opencv_ts=OFF \
-D BUILD_opencv_videostab=OFF \
-D BUILD_opencv_imgproc=ON \
..
// Build the repo
$ make
// After successful compilation, install the libraies
$ sudo make install
NOTE: To compile opencv build, you need to have build tools like android ndk, cmake, etc installed. For more information, please refer to opencv Android building process.
There are quite a few settings, please select them as you need. You can also compile with another option here

Permission denied from Bitbucket pipeline

I am trying to use the bitbucket pipeline to upload my build apk to hockey app but when i try to run my script i get
bash: ./deploy-hockey-dev.sh: Permission denied
this is the deploy-hockey-dev.sh :
#!/bin/sh
# upload apk to hockey app
curl \
-F "status=2" \
-F "notify=0" \
-F "ipa=#app/build/outputs/apk/debug/app-debug.apk" \
-H "X-HockeyAppToken: myToken" \
https://rink.hockeyapp.net/api/2/apps/upload
Does any one know what the problem here is ?
The issue is that the file was not given the correct execution permissions before it was checked into BitBucket.
If you are developing locally in a unix environment, you would normally set execute permissions (ie. chmod 755) on the script file so you can test it locally before committing. With this approach you would not experience the permission denied error in pipeline build when you check it in.
However, sometimes we are authoring our scripts on Windows without a unix emulator, so we can only test our scripts in a pipeline environment. Even though Windows does not support execute permissions in its file system, we can still use git to show and set these execute permissions.
cd <dir-with-shell-scripts>
git ls-files --stage # show file permissions (last 3 digits of first number)
git update-index --chmod=+x <files> # set execute permissions
Commit the updated files as per your normal process.
It turns out that right before i execute the script i had to use - chmod +x deploy-hockey-dev.sh so the .yml file that is used in bitbucket should have this line before the execution of the script. I made a tutorial of how to make the entire process hope it help some one.
This looks like Linux permissions problem to me rather than programming. Check if the script has executable permission (the x bit in ls -l). You can consult chmod (man chmod) or the Internet for details how Linux permissions work, as I believe that is offtopic for this site.
This worked for me.
In your code terminal, you need to update the permissions for the files to be executable (x in them)
chmod +x path/to/file
Then commit and push. The pipeline should pass for this issue

Using Qt on Android installation

I am trying to install Qt 5.1 for Android, I am using steps described here: http://qt-project.org/wiki/Qt5ForAndroidBuilding
I installed all the prerequisites (JDK, Android SDK, NDK, etc.). My problem is with step 4, I cannot download Qt 5 from the git repo (git://gitorious.org/qt/qt5.git).
Has somebody encountered the same problem?
I took another Qt 5 for Android directly from http://qt-project.org/downloads but it would not build. When I use step 4.4 (configure -....) I got the The system cannot find the file specified: arch.cpp and arch.obj error.
If you have a link or something that wil help me install Qt and deploy an app to Android please share.
The Qt Android version that you have download on qt-project is already built. You don't need to build Qt for Android, but build with Qt for Android. You just need to config Qt Creator to define SDK and NDK dirs. Follow this doc : http://qt-project.org/doc/qtcreator-2.8/creator-developing-android.html (main page : http://qt-project.org/doc/qt-5.1/qtdoc/android-support.html)
This should work:
git clone git://gitorious.org/qt/qt5.git qt5
cd qt5
perl init-repository --no-webkit
configure.bat \
-developer-build \
-xplatform android-g++ \
-nomake tests \
-nomake examples \
-openssl
-android-ndk D:/GitRepo/Resources/X2Go_Android/android-ndk-r8e \
-android-sdk D:/GitRepo/Resources/X2Go_Android/AndroidSDK/sdk \
-skip qttools \
-skip qttranslations \
-skip qtwebkit \
-skip qtwebkit-examples-and-demos
make

What is the most primitive possible toolchain for android programming?

I feel as though I'm trying to learn android programming in the middle of a fireworks display during a rodeo. All the fancy IDE stuff recommended by all the books I seem to find is just monumentally distracting from discovering what I really and truly need just to develop an android app.
Can anyone point me at documentation for the minimal set of the tools needed to actually build an app? I feel like if I could understand what the heck was actually going on, I'd be better able to use the fancy IDE.
Primitive? So, not Eclipse, and also not ant. You can use aapt, javac, dx, apkbuilder, and signer directly. Or more-or-less directly; you're still a programmer, you have ways of dealing with repetition.
I do some on-device app development with Terminal IDE. This is one my build scripts (named 'make'):
P=me/rapacity/stitch
rm src/$P/R.java
mkdir -m 770 -p dist || exit
mkdir -m 770 -p build/classes || exit
mkdir -m 770 -p tmp || exit
./index.perl
aapt p -f -M AndroidManifest.xml -F build/resources.res \
-I ~/sdk/3.2/android.jar -S res/ -J src/$P || exit
cd src
for F in \
SelectActivity.java Tilesets.java \
StitchActivity.java \
TilesetView.java \
; do
if test $P/$F -nt ../build/classes/$P/$(dirname $F)/$(basename $F .java).class; then
echo Building $P/$F
REBUILD=1
javac -d ../build/classes $P/$F 2> ../tmp/javac.out
../redcat ../tmp/javac.out
grep error ../tmp/javac.out && exit
fi
done
cd ..
if [ ! -z $REBUILD ]; then
set -x
( cd src; javac -d ../build/classes $P/R.java )
( cd build/classes; dx --dex --verbose --no-strict --output=../core.dex me ) || # 'me' as in me.rapacity.
apkbuilder dist/core.apk -u -z build/resources.res -f build/core.dex || exit
signer dist/core.apk core-debug.apk
else
echo +++ No need to rebuild .apk
fi
in which some lengths are gone to to avoid recompilation and to promptly exit after an error. Very little of that needs to be edited per-project.
Java SE 6 (NOT Java7!)
Recommended IDE is Eclipse (recommended as there are guides for it on the official documentation)
Android SDK (you need to download the API you want to develop for) and ADT - the android development tools - Guide
Optional:
Device and a connection for it, recommended, not necessary as an Emulator is bundled in the Android SDK
Give AIDE a try for Android on-device App development. It is very easy to get started and the project format is fully compatible with Eclipse, so if you want to continue development on your PC you can.
Getting started video: http://www.youtube.com/watch?feature=player_embedded&v=NGT9MqT3W2w

Categories

Resources