January 9, 2020
Android Emulator in Docker
$ make build-base && make build && make start. This provides emulator device waiting to run your tests.
PS I am not a big fan of building in docker, however it's possible using avd-base image from same project. I will cover this later.
January 8, 2020
Android: one ViewModel per view
Do not create huge ViewModels, keep it simple. Yes, it's more classes per view, however your support and development costs are closer to linear in time.
Labels: android, architecture, mvvm, software architecture, view, viewmodel
December 10, 2019
An interview assignment: ML image classifier (WhatsThat app)
WhatsThat app privacy policy:
No user data is collected by app.P.S. Actually it's completely offline app: contains no networking code at all.
Project summary
Summary of what's done is below, also see (more in repository readme):
- Android app in kotlin with MVVM and JetPack, TensorFlow image classifier for CameraX preview.
- Tests: unit (Robolectric JVM-based) and instrumented (uses Android emulator to run).
- Repository: Gitlab with safe workflow: development is done in feature branch, merge requests to master with Build/Test CI pipeline checks before able to merge to the master branch.
- CI: Gitlab integrated with Jenkins. Build is executed for any push to feature branch.
- Project tracking: Jira with Kanban. All commit messages are automapped to Jira tickets using "smart commit messages". Merge of MR leads to automatic Jira ticket state change (move to Done)
- CD: publishing is done to Artifactory (artefacts repository)
- Set up separate Jenkins slave to run project tests which require Android emulator for instrumented testing.
How to install app
- How to test: send me google account email to be added to internal testing group. Once confirmed a link will be sent and app can be installed. (Sorry for inconvenience, it's Google Play rules).
- How to install (for hackers: developer settings must be enabled and unsafe unknown sources installs option enabled there): download file, add .apk extension and upload to phone with adb install release.apk. Link to the latest master build: in Artifactory.
Update 10 Dec:
- Implemented unit and instrumented tests
- Added unit test to CI pipeline
- Started adding dockerized android for instrumented tests (problem: server does not provide /dev/kvm, so emulator needs to be tunes to use ARM system image)
- Added user to Jira, Jenkins, Artifactory. Will share credentials tomorrow in a task report.
- Todo: Add Jenkins-slave with kvm to run instrumented tests.
- Added MVVM with Jetpack to easily bind image classification with UI output
- Added dagger2 to more simple load of components
- TensorFlow model now works fine
- Project repo: https://gitlab.gotalkmobile.com/shamilg1/image-classifier
- Added Jira/Gitlab/Jenkins/Artifactory integrations and set up CI pipeline with CD to Artifactory.
- Added planned tasks to Jira (Kanban-based).
- Basic kotlin CameraX implementation is done.
- Tomorrow todos: set up basic quantized image analysis integration and further experiment with models.
5 Dec 2019. I've got assignment for the interview with a nice startup on ML image classification using existing pre-trained model. The aim of this project is to share my skills and experience in dealing with project, specifically an Android app.
- TensorFlow (for IoT and mobile devices, has pre-trained models)
- ML Kit
- CloudVision (google cloud backed only, has first-1000-images-free period)
- AutoML (this is on training a custom model)
There're some good ML learning materials not tied to specific framework:
- ML Practicum: Image Classification: https://developers.google.com/machine-learning/practica/image-classification
- ML crash course (this is a dependency for first one): https://developers.google.com/machine-learning/crash-course/
Labels: android, artifactory, dagger2, docker, espresso, interview assignment, jenkins, jetpack, jira, kotlin, machine learning, mvvm
April 23, 2019
Upgrading Android project to Studio 3.4
- dependency versions chain upgrade: studio -> gradle plugin -> kotlin version
- solving mysterious problems with desugaring D8 (add "android.enableD8.desugaring=false" to gradle.properties)
I'm not very happy when I'm unexpectedly forced to spend 3h+ on infinite chain of tasks. This repeats itself for most of the Android Studio upgrades.
Labels: android, android studio, kotlin, upgrade
March 15, 2019
Android "DataBindingComponent not found" error solution
dataBinding {
enabled = true
}
kapt {
javacOptions {
// Increase the max count of errors from annotation processors.
// Default is 100.
option("-Xmaxerrs", 500)
}
}
Labels: android, build, data binding, databinding, error, gradle, java, kotlin
August 28, 2018
Android emulator window @xfce does not gain keyboard focus
May 8, 2016
Software documentation
Moreover some talented developers seems don't want to document at all. Check out this one, very complex UI behaviour class AppBarLayout.Behavior. It says: "The default AppBarLayout.Behavior for AppBarLayout. Implements the necessary nested scroll handling with offsetting." That's all. What exactly is necessary?
Yes, I've heard many times that mantra of idlers "code source is the best documentation for itself". Without docs it requires sometimes hours or even days to know all the nuances of implementation. In total it requires additional man*years if some popular framework is poorly documented and decreases overall experience of developers and users for using such piece of technology.
So my friend, let's start documenting the sources we write with something more than the usual "f%ck off I'm busy"-style docs and comments that we see in so many docs by adding the details of implementation and side effects. And diagrams!
Labels: android, API, computer science, diagram, docs, documentation, framework, programming
December 4, 2014
android market -> play and back
Last week I downgraded Google Play using "Uninstall updates" button (on android ver 2.3.4), so I got fast Market app back (v. 2.3.4). Old Market app worked good and installed apps without problems, but when I needed to test In-app-billing, it for sure did not work :-) (Google requires ) So I tried to force it autoupdate (usually Market and Play apps updated automatically). I even installed all-hated Google Services Framework and Play Services, hoping that they will help Market to autoupdate. They did not. I followed recommendations to clear Market cache and data, but it only cleared list of "My apps". $%$#$&!
So the only way was to manually update Market to Play. As this is original apk signed with Google keys, all went OK. IAB working now.
Labels: android, autoupdate, downgrade, evil, framework, google, market, play, services, update, upgrade
April 3, 2012
Android: multiple logons breaks C2DM (android push)
April 1, 2012
android: rotate 3d animation
http://developer.android.com/resources/samples/ApiDemos/src/com/example/android/apis/animation/Rotate3dAnimation.html
http://stackoverflow.com/questions/3452687/better-implementation-of-rotate3danimation-in-android-viewflipper
Android: progress bar updating solution
http://www.helloandroid.com/tutorials/progressbar-updating-using-message-handler
November 1, 2011
SonyEricsson sk17i (mini pro) en hw keyboard layout FIX
FN-keys in cyanogen-mod are awful (especially on russian version kb) and no fix from xda-developers forum works!
So I've finished manually edited english layout file (FN-keyboard section) which you can download:
qwerty-en.xml
You should move it using root explorer to
/system/usr/keyboard-config/layouts/
then change owner to root (id=0) and group to root (id=0) and change permissions to RW-R--R-- and restart phone.
Don't forget to backup original file and, by the way! I'm not responsible for any side effect ;)
Labels: android, fix, keyboard, mini pro, sk17i, sony ericsson, xperia
March 16, 2011
some mobile smartphones impressions
Windows 7 phone (Lg E900):
- ugly ui, but surprisingly very useful :-) usability on high grade, seems designers were not allowed to give any recommendations :-))) This is the way, ppl!
- Very small number of apps: does not have any ssh/telnet terminal in marketplace
- search in marketplace gives artists, songs and albums instead of APPS! go to hell with all that paid bad music :-) i can make noise myself on guitar :)))
Android (HTC G1, HTC Desire Z):
- [android all] every app want access to everything (no way to manage permissions as it is for J2ME)
- very small (desire z) text
- it is not phone, nor SMART: messaging takes TIME to load! Every simple phone (from nokia 1100 up to sony ericsson k750) loads sms inbox very fast, to call one just start typing number. But in android you first FIND phone app... then wait it to load :-) suxx
- samsung galaxy tab: it HAS GPRS via SIM card, but does not have phone app and no way to install it without root-ing and firmware replace.
- Android officially is open-source, but very closed still (no access to ussd, no way to install native apps without rooting)
- by the way, every app with permission for messaging can read ALL incoming sms!
- NO GOOGLE EARTH FOR GOOGLE PHONE?! WTF!
iPhone:
- same as android trouble with finding 'phone' app, slow messaging load
- good screen for iphone 4 (ips matrix)
- closed proprietary platform: recently apple stopped posting security updates to iphone 3G. "Don't hold it..." ...anymore. Buy new one?!
Labels: android, iphone, mobile, phones, windows 7 phone
January 28, 2011
android dev: '?????? no permissions' trying to deploy to samsung galaxy tab
Update: this works until device disconnect only. After reconnect IDE could hang up :-)
Update: added string for HTC Desire Z
--
Ubuntu 10.04/android sdk 7(9? where the f%%k is sdk version? no version in readme! opensource sometimes is such an opensource.)
When you see such f%%% sh%%%:
./adb devices
List of devices attached
???????????? no permissions
To be able to deploy to samsung galaxy tab do the following:
1) create new file (51 is just some number below 99):
sudo vi /etc/udev/rules.d/51-android.rules
and put there:
SUBSYSTEM=="usb", SYSFS{idVendor}=="04e8", MODE="0666"
SUBSYSTEM=="usb", SYSFS{idVendor}=="18d1", MODE="0666"
04e8 is samsung id
18d1 is for HTC Desire Z
2) restart adb daemon:
sudo ./adb kill-server
sudo ./adb devices
you now should see this:
* daemon not running. starting it now on port NNNN *
* daemon started successfully *
List of devices attached
10001c18352d device
If above still doesn't help add more detailed description for usb device in 51-android.rules like this
SUBSYSTEMS=="usb", ATTRS{idVendor}=="0bb4", ATTRS{idProduct}=="0c91", MODE="0666"
here 0c91 is the HTC Desire Z product id. You can watch these details using 'lsusb' command:
Bus 002 Device 011: ID 0bb4:0c91 High Tech Computer Corp.
Labels: android, desire, desire z, galaxy tab, htc, linux, opensource, samsung, shit, ubuntu, уебунту
February 4, 2010
Android G1: more surprises
So, G1 usage cost $0.16 per minute.
It's of course not so bad as downloading Android updates via 3G (which ate 5$ in 3 minutes for me when I first switched G1 on). But: sending some SMS to network without my permission is not good.
Note that this is not some third-party app: I check every app when installing for permissions and I'm sure that nothing was set up with SMS sending permission.
Some threads (english translation) indicate that this is because G1 has some low-level T-mobile locks (although mine is officially unlocked one from singapore).
By the way, user has no way to officially way to rebuild and reflash its (open-source!) android OS.
July 27, 2009
[life] iphone -> iSkype-on
Sad that receiving any phone calls, even from a skype caller, skype credit is used.and more:
No calls can be made, no free calls received even when in WI-FI spot. This application is not ready for prime time ... If I wanted to IM, I would use another application. Please make Skype like it is on computers. Free calls computer-to-computer (or phone-to-skype_contact) over wifi or carrier's data plan.
Else is is useless.This is it. iPhone is better :-)



