Ruby and Gem was already installed, so I just called (docs):
sudo gem install calabash-android
Run the following command for a nice overview!
Prepare Example Project (Telegram Messanger)
I use a slighly modified version of the official android client of telegram as example for a simple test. This modifications are important to compile it. You can find the modified code on github.
The changes include following parts:
- remove hockey (third-party service for app development)
- add missing integer casts
- fix keystore-extension (android studio forces the
*.jksfile-extension, but telegram uses
- add multidex support to allow more than 65k methods (docs, stackoverflow)
- hotfix: more memory for gc to avoid GC overhead
java.lang.OutOfMemoryError: GC overhead limit exceeded(stackoverflow)
- install NDK (see instructions)
- build it: navigate to the directory (e.g.
Telegram/TMessagesProj/jni) and call
So they are only bugfixes and I had to remove debugging parts because I don't need them. Furthermore I changed the path to the keysore, because android studio forces the
*.jks file-extension, but telegram uses in his
git clone https://github.com/inkrement/Telegram.git
To get it running you also have to obtain API Keys from the telegram dev site.
Update the Settings in your
Build VariantsWindow (docs).
You have to create the keystore.. I used the telegram default location for releases
(Telegram/TMessagesProj/config/release.keystore). In Android Studio you can create an keystore by selecting the Build-Menu entry
Generate Signed APK.
The specific key settings are defined in the
gradle.properties file. I'll use the default settings:
RELEASE_STORE_PASSWORD=password RELEASE_KEY_ALIAS=alias RELEASE_KEY_PASSWORD=password
I created a new folder for the test-files:
mkdir telegram-tests cd telegram-tests
Then I called gen to generate the feature folder incl. some demo test
Then setup your keystore:
The output should look like this:
~/Documents/dipl/Telegram/TMessagesProj/conf/release.jks. I solved it manually by editing the generated
Now you can run your test cases. I tried the standard examples generated by
calabash-android gen (They will fail, because they are just for demo purposes and not written for the telegram application).
calabash-android run ../Telegram/TMessagesProj/build/outputs/apk/TMessagesProj-release.apk
- You can use the
-vargument of calabash-android for debugging purposes.