$ git clone git@github.com:Chronstruct/android-starter.git <YOUR_REPO_NAME>
$ cd <YOUR_REPO_NAME>
$ git remote set-url origin <YOUR_NEWLY_CREATED_GIT_REPO_URL>
$ git remote add upstream git@github.com:Chronstruct/android-starter.git #for merging future updates
Now, rename the project with the steps listed in this SO post.
You should be able to run the app without errors (gradle has some red warnings, but that is OK).
You need a keystore.properties
in the root of your project with the following format (without the <``>
s):
storeFile=<full/path/to/keystore.properties>
storePassword=<KEY_PASSWORD>
keyAlias=<ALIAS>
keyPassword=<ALIAS_PASSWORD>
Don't have a key to sign with you? Follow this link. TODO
You need a key.p12
file in the root of your project to use Play Console's API.
Don't have a key.p12
yet? Follow this link. TODO
Also, fill in the serviceAccountEmail = '<YOUR_SERVICE_ACCOUNT_EMAIL>'
(project's build.gradle
) with your generated email with Play Store API access.
Instant Apps
Discovery via Instant App
Search - query to instant app
ads - to instant app
links
"Try Now" is like window shopping. A gateway to try without commitment. "Try Now" removes commitment anxiety, and reduces install friction.
Web banners: from "Install" to "Open"
Single Activity Apps
Activity manages common app chrome (appbar, bottom bar, etc).
transitions and animations managed by Navigation, not by hand
fragments now form the screens
Since this app is not set up with dynamic feature
modules, it's root folder name is app
. If you switch over to using feature modules, be sure to rename app
-> base
.
Follow codelabs like Your First Android App Bundle and Navigation Codelab to get going.
./gradlew connectedAndroidTest
- run UI tests
- ViewModels and LiveData: Patterns + AntiPatterns – Google Developers – Medium
- LiveData beyond the ViewModel — Reactive patterns using Transformations and MediatorLiveData
- LiveData with SnackBar, Navigation and other events (the SingleLiveEvent case)
wasabeef/awesome-android-ui: A curated list of awesome Android UI/UX libraries for widgets already built
- Designing Adaptive Icons – Google Design – Medium
- With this sketch starter
- Create app icons with Image Asset Studio | Android Developers
- Adaptive icons | Android Developers
Test focused on a single behavior. Test behaviors independently.
Use common setup methods only for scaffolding (creating object under test and wiring up depenecies)
Only mock your own classes, not something from the Android framework
Use Roboelectric for unit tests with android framework (for unit tests). This is better than mocks.
Android Test - for on-device and off-device
- scaffolding (AndroidJUnit4)
- given (ActivityTestRule, Builder)
- when (espresso)
- then (intents, assertions)
Espresso cheat sheet | Android Developers
Adam McNeilly - Espresso Patronum: The Magic Of The Robot Pattern on Vimeo
Espresso Robot Pattern in Kotlin – Android Bits – Medium
from Android Architecture Part 5: How to Test Clean Architecture • Five
specification-style naming: Name does not say anything about the implementation, and from the tests’ names – specification – we can write the actual concrete class. Specification-style names are usually the best way to go, but if you think you cannot test some implementation specific edge cases, you can always throw in few example-style tests.
@Test
public void shouldDeleteExistingFeed() throws Exception {
}
@Test
public void shouldIgnoreDeletingNonExistingFeed() throws Exception {
}
Example-style tests are examples of system usage. They are nice when testing edge cases, but don’t use them for everything, they are too coupled with the implementation.
@Test
public void doSomethingWithIdsSmallerThanZero() throws Exception {
}
@Test
public void ignoreWhenNullIsPassed() throws Exception {
}
- documentation goes stale
- tests should not
With Android TDD, to get your first Integration test to fail (correctly, not throw exceptions), just need an empty Activity with some resource IDs.
from Unit Testing in Android Studio Canary with Kotlin – AndroidPub
- Sit down and think and write a rough specification.
- Write the tests to exercise the specification.
- Write stubs for the code.
- Run the tests from the command line — yay! everything fails!
- Start writing the code, augmenting the tests where I feel it’s a good idea to catch edge cases. (Don’t reduce the number of tests — always increase)
- Run the tests again, potentially with debug to step through the code to see where I’ve been an idiot.
- Repeat the last two steps as often as is required.
from Droidcon 2015 / TDD for Android - Matteo Vaccari - YouTube: Start with failing acceptance test.
Cycle into RGF of UNIT tests. After many cycles, your original acceptance test will pass.
Write new failing acceptance test and cycle.
Mock your view before it exists.
Use Mocks for designing YOUR interfaces, not Android's
giveSomeSetupCondition() whenSomethingExecutes() thenAssertsHappen()
instead of // Given code code code // When code code code // Then code code code
Only test a single View, Fragment, or Activity
Use .also()
in chains for logging