The Problem I hope SPOON will help solve

Despite extensive testing with one of my apps, “Your word against mine” on Google Play, I’m seeing some app crashes reported on the console that I cannot recreate to date. I want to use Spoon to help with this.

My app uses real time multiplayer and also has an AI (artificial intelligence) mode where the player can play against the AI.

I figure that if I modify the app so that instead of the AI playing against the current user of the app, the AI plays against a remote player, I can get the two AIs to play against each other.

Once I have done this, I intend to use Spoon to drive two real devices with a signed APK installation that will operate over the Google real time multiplayer ecosystem and will allow the two AIs to battle it out and hopefully I can hit upon the conditions that are causing my spurious and non repeatable crash conditions, more frequently and I can see where I’ve gone wrong.


  1. I need both a release certificate signed instrumented APK and a release certificate signed debug app APK to run real time multiplayer under the control of an Espresso test. If I run without signing we will not be able to sign into Play services and will not be able to communicate with the other AI player.
  2. I need to consider room joining criteria so that any real players of my game are not affected by me running tests. For this post, I’ll ignore this as it’s not related to the technical problem solution.
  3. I need to modify my app so that the AIs will play each other. Again I’ll ignore this for now for the same reason.
  4. I need to deploy my app on two hardware devices and run it up to play a multiplayer game at the same time. This is where Spoon comes in.

Build a Release signed Debug APK

The problem is that I need both the app APK and the test APK to be signed with the release certificate. For now the way I’m doing this is to modify my build.

Create a build type for gradle to use that will apply the release key. Follow the instructions here.

Configure build type in gradle

Configuring a build type in gradle

Apply that build type to my project module as below.

Your word against mine applying build type to Android module

Applying my build type to my build

Build both the APP and TEST APK

Now I need to build both of my APKs.

./gradlew :android:assembleDebug
./gradlew :android:assembleAndroidTest

Install the APKs on my devices (removing any previous install if required)

adb -s device_*_id shell pm uninstall
adb -s device_*_id shell pm uninstall


Device 1 – the instrumented APK

adb -s device_1_id install /home/ian/android-projects/master/your-word-against-mine-2/android/build/outputs/apk/debug/android-debug.apk

Device 1 – the test APK

adb -s device_1_id install /home/ian/android-projects/master/your-word-against-mine-2/android/build/outputs/apk/androidTest/debug/android-debug-androidTest.apk

Device 2 – the instrumented APK

adb -s device_2_id install /home/ian/android-projects/master/your-word-against-mine-2/android/build/outputs/apk/debug/android-debug.apk

Device 2 – the test APK

adb -s device_2_id install /home/ian/android-projects/master/your-word-against-mine-2/android/build/outputs/apk/androidTest/debug/android-debug-androidTest.apk



Finally  I need to run spoon on the connected devices with  test I built and tweaked earlier with Espresso Run Recorder.

java -jar ~/spoon/spoon-runner-1.7.1-jar-with-dependencies.jar 
--apk /path/build/outputs/apk/debug/android-debug.apk 
--test-apk /path/android/build/outputs/apk/androidTest/debug/android-debug-androidTest.apk 
--sdk /path/Android/Sdk --class-name multiplayer.FakedMultiplayerSingleDeviceTest

I hope this works for you and helps you to automate your testing in a more realistic environment. If you want to try out my game, here’s the link to “Your word against mine” on Google Play.

Celtic Intuition

Celtic Intuition have been building applications software since 1994 and developing Android applications since 2015.

Related Posts


Travelling Santa Problem is now released

Finally after 690 hours of effort to date, Travelling Santa Problem has been released to Google Play. Guide Santa’s reindeer and sleigh through the night in this challenging Christmas game of dexterity and skill. Deliver Read more…


Travelling Santa Problem 2017 – Addressing lag

For 2017 I’m going to address the lag issue which has manifested on lower performance devices. Follow my Google+ profile to keep up to date with the latest news on Travelling Santa Problem. Travelling Santa Read more…