A simple calculator on Android for the talk Create a testable Android App and don't fail trying: the MVP pattern on the JavaDay Ecuador conference.
The project has two implementations of the same Activity
: One not using the MVP pattern (CalculatorActivity
) and another using the patten (CalculaterActivityMVP
)
- Download the android system image. For example, if you want the android-22 image, do:
sdkmanager "system-images;android-22;default;armeabi-v7a"
- Set up the emulator with the same image of the previous step.
avdmanager create avd -n <name_of_device> -k "system-images;android-22;default;armeabi-v7a"
To know the complete list of android system images run
sdkmanager --list
This project uses Gradle
for package managing. To build it, use the following command on the root folder of your project:
./gradlew androidDependencies
To build and install the app on a running emulator:
emulator -avd <name_of_device> & # Run emulator on the background
./gradlew installDebug
To install on a running emulator and existing APK:
emulator -avd <name_of_device> &
adb install path/to/your_app.apk
Once you build the project, you can run the tests:
./gradlew test
Note: Keep in mind that this command will also run the linter
Once you have done an emulator set up, launch it on the background and run the tests:
emulator -avd <name_of_device> &
./gradlew connectedAndroidTest
Recomendation: Use Android Studio to ease the process of Running and testing the app.
For development:
- Butterknife
- Retrofit
- RxAndroid
- RxJava
- Uses newton's API to calculate math results.
For testing:
See Gradle
file for more information