• Stars
    star
    877
  • Rank 52,062 (Top 2 %)
  • Language
    HTML
  • License
    MIT License
  • Created over 9 years ago
  • Updated over 6 years ago

Reviews

There are no reviews yet. Be the first to send feedback to the community and the maintainers!

Repository Details

A bootstrap project for TDD Android.

Android TDD bootstrap project

Master branch build status codecov.io Android Arsenal

An Android TDD bootstrap project, using a collection of new technology, obeying the best practices, inspired by some popular architectures, and developed with many handy tools.

Project structure

  • base is the so called architecture part, and base classes, best practice, etc.
  • Package organization
  • Package by layer v.s. package by feature, read more about the Package organization part of this blog, and Package by feature, not layer.
  • Both features and models are packaged by their functions. users and repos are model modules, each one provides a Repo API for upper level modules. splash and trending are feature modules, each one is a standalone module, implementing a single feature.
  • All modules can be composed together as a full APK, containing all features.
  • Module organization
  • Modules are organized by contributors in the contrib dir, that can separate code and responsibility as much as possible. Because each person has his own style and flavor, others should obey the style of contributor in each module, that's a very clear rule.
  • Feature modules are 100% decomposed, that makes each feature module as lightweight as possible, and activity is launched through string url.
  • business contains app specific business code, configurations, etc.
  • bridge module is just like a bridge, connecting modules together, like the image above.

Build tips

  • Sign key config
  • Place KeyStore file in some place, and create a TemplateKeyStore.properties, and config the KeyStore in it, include keystore, keystore.password, key.password, key.alias.
  • To clone all submodules, please use git clone --recursive [email protected]:Piasy/AndroidTDDBootStrap.git
  • use flavor to control server configuration, use build type to control log behavior
  • dev for development server, prod for production server
  • debug enable log and dev tools, disable crash and analytics, release against it

Why another bootstrap project?

From the beginning of the year 2015, our team started a new project, and before we developing functionality in detail, we have tried to create a well-architected project from scratch, with well designed network layer, data layer, asynchronous execution, communication between modules, and last but not least: unit test and integrated testing support. After several months of development, we found some drawbacks of our current architecture, and also found some popular architectures, then I decided to extract our original well designed architecture and make it open-source, with amendment according to the drawbacks and features from the new popular architectures we've found. Recently I have seen a lot of bootstrap/base Android projects, including JakeWharton's u2020, mobiwiseco's Android-Base-Project, etc, but none of these projects cover all the features I include in this AndroidTDDBootStrap project. That's why I want more people to see this repo, and I also want get feedback from more people to improve this project.

Architecture

Based on the project architecture I'm currently working on, YOLO, and inspired by popular architectures: Android Clean Architecture, Against Android Unit Tests: The Square way.

  • MVP: YaMvp, Yet another Mvp library. Super simple, but with enough functionality.
  • Dependency injection
  • Dagger2, A fast dependency injector for Android and Java.
  • ButterKnife, View "injection" library for Android.
  • Model layer, 完美的安卓 model 层架构(上)
  • OkHttp, An HTTP+SPDY client for Android and Java applications.
  • Retrofit, Type-safe HTTP client for Android and Java by Square, Inc.
  • Gson, A Java library that can be used to convert Java Objects into their JSON representation.
  • SQLBrite, A lightweight wrapper around SQLiteOpenHelper which introduces reactive stream semantics to SQL operations..
  • SQLDelight, Generates Java models from CREATE TABLE statements.
  • AutoValue, Generated immutable value classes for Java 1.6+.
  • auto-value-gson, AutoValue Extension to add Gson De/Serializer support.
  • auto-value-parcel, An Android Parcelable extension for Google's AutoValue.
  • Reactive programming
  • RxJava – Reactive Extensions for the JVM – a library for composing asynchronous and event-based programs using observable sequences for the Java VM.
  • RxAndroid, RxJava bindings for Android.
  • RxBinding, RxJava binding APIs for Android's UI widgets.
  • RxLifecycle, Lifecycle handling APIs for Android apps using RxJava.
  • Communication between modules: EventBus, Android optimized event bus that simplifies communication between Activities, Fragments, Threads, Services, etc. Less code, better quality.
  • Image loader: Fresco, An Android library for managing images and the memory they use.
  • Other core libraries
  • SafelyAndroid, Build safely Android app, no more Activity not found error and Activity state loss error!
  • Router, Using string url to launch activities, allowing us decompose feature modules.
  • RetroLambda, Backport of Java 8's lambda expressions to Java 7, 6 and 5.
  • ThreeTenABP, An adaptation of the JSR-310 backport for Android.
  • AutoBundle, AutoBundle generates boilerplate code for field binding with android.os.Bundle.
  • FlexLayout, A powerful Android layout view that use java expression in layout params to describe relative positions.
  • Developer tools
  • XLog, Method call logging based on dexposed.
  • LeakCanary, A memory leak detection library for Android and Java.
  • ANR-WatchDog, A simple watchdog that detects Android ANR (Application Not Responding) error and throws a meaningful exception.
  • AndroidPerformanceMonitor, A transparent ui-block detection library for Android. (known as BlockCanary)
  • strictmode-notifier, Improving StrictMode's report on Android.
  • Timber, A logger with a small, extensible API which provides utility on top of Android's normal Log class.
  • OkHttp Logging Interceptor, An OkHttp interceptor which logs HTTP request and response data.
  • Ok2Curl, Convert OkHttp requests into curl logs.
  • Stetho, Stetho is a debug bridge for Android applications, enabling the powerful Chrome Developer Tools and much more.
  • android-git-sha-plugin, Automatically add current GIT SHA value to your apk. It can rise an error if the current git branch is dirty.
  • Codestyle, Customized base on Square java-code-styles.
  • Others
  • Iconfy, Android integration of multiple icon providers such as FontAwesome, Entypo, Typicons,...
  • Fabric, Crash report.
  • Once, A small Android library to manage one-off operations.
  • Unit test
  • Junit && Android Junit
  • Following the Square Way
  • Android Unmock Gradle Plugin, Gradle plugin to be used in combination with the new unit testing feature of the Gradle Plugin / Android Studio to use real classes for e.g. SparseArray.
  • mockito, Tasty mocking framework for unit tests in Java.
  • RESTMock, HTTP Server for Android Instrumentation tests.
  • Espresso
  • Continuous integration
  • Travis CI
  • Code quality, customized from Vincent Brison's vb-android-app-quality repo
  • AndroidCodeQualityConfig
  • Checkstyle, Checkstyle is a development tool to help programmers write Java code that adheres to a coding standard. By default it supports the Google Java Style Guide and Sun Code Conventions, but is highly configurable. It can be invoked with an ANT task and a command line program.
  • Find bugs, FindBugs is a defect detection tool for Java that uses static analysis to look for more than 200 bug patterns, such as null pointer dereferences, infinite recursive loops, bad uses of the Java libraries and deadlocks.
  • PMD, PMD is a source code analyzer.
  • Lint
  • Code coverage
  • Jacoco && Codecov

Dev tips

  • Create a new contrib module: ./new_contrib_module.sh contrib/<contributor name>/<module name>
  • Compose all modules together: ./install_app.sh <build type>
  • Buck build for each feature module: ./install_buck.sh contrib/piasy/trending or ./install_buck.sh app
  • You can also click the run button of AndroidStudio for each feature module, but it doesn't work for app module.
  • Create Activity
  • TODO use the MVP feature generator
  • Unit test
  • use the check*.sh script in buildsystem dir
  • Run ./buildsystem/ci.sh before git push.

Todo

  • CheckStyle
  • MVP source generator plugin
  • Espresso test
  • exopackage for each feature module
  • try MVVM
  • try React Native
  • try Kotlin

Coverage

codecov.io

Acknowledgement

  • Thanks for our team, YOLO.
  • Thanks for my colleague & mentor, promeG.

More Repositories

1

BigImageViewer

Big image viewer supporting pan and zoom, with very little memory usage and full featured image loading choices. Powered by Subsampling Scale Image View, Fresco, Glide, and Picasso. Even with gif and webp support! 🍻
Java
3,980
star
2

RxAndroidAudio

Maybe the most robust Android Audio encapsulation library, with partial Rx support.
Java
1,570
star
3

SafelyAndroid

Build safely Android app, no more Activity not found, Activity state loss and NPE during fragment transaction!
Java
400
star
4

notes

tech notes
GCC Machine Description
395
star
5

RxScreenshotDetector

Android screenshot detector with ContentObserver and Rx.
Java
241
star
6

AudioMixer

A cross-platform audio mixer, supports Android, iOS, macOS and Windows. Powered by WebRTC, FFmpeg and Djinni.
C++
188
star
7

FridaAndroidTracer

A runnable jar that generate Javascript hook script to hook Android classes.
Java
134
star
8

WebRTC-Docker

Out-of-the-box docker images for AppRTC dev/test purpose.
Shell
132
star
9

AdvancedRxJava

Advanced RxJava http://akarnokd.blogspot.com/ 系列博客的中文翻译,已征得作者授权。
CSS
127
star
10

HackWebRTC

Let's hack into WebRTC :)
C++
125
star
11

AndroidPlayground

An Android project that try new things, new ideas, research purpose... Just a playground.
Java
104
star
12

YaMvp

Yet another Mvp library. Super simple, but with enough functionality.
Java
96
star
13

HandyWidgets

Handy Android widgets.
Java
89
star
14

RxComboDetector

Android view click combo detector with Rx.
Java
80
star
15

VideoCRE

A component for Video Capture, Render and Encode, extracted from WebRTC.
Java
71
star
16

ShapedDraweeView

Fresco custom view with mask shape.
Java
68
star
17

FlutterWebRTCDataChannel

A Flutter plugin allowing apps to use WebRTC DataChannel to establish P2P connection and exchange text messages.
Objective-C
66
star
18

AndroidCodeQualityConfig

Code quality config for android project, including lint, pmd, findbugs, checkstyle, jacoco code coverage. Serve as a submodule for repo AndroidTDDBootStrap
66
star
19

LearnOpenGL

OpenGL learning tutorial, following https://learnopengl.com/
Java
46
star
20

CameraCompat

Create a camera preview app with beautify and camera api compatibility!
Java
46
star
21

UltraGpuImage

The ultimate 2D image rendering engine, inspired from cats-oss/android-gpuimage, reinventing the wheel as my first OpenGL project after walking through the Learn OpenGL tutorial.
Java
43
star
22

RxQrCode

When QrCode meets RxJava...
Java
40
star
23

InsideCodec

Random walks around codec stuff, H.264, H.265, MediaCodec, VideoToolbox, etc.
C++
35
star
24

decaf-mind-compiler

The principle of compiler course project
Java
32
star
25

Piasy.github.io

Dev blog
HTML
31
star
26

ChatRecyclerView

Implement your user friendly chat RecyclerView in one line!
Java
26
star
27

VulkanTutorial-Android

Step by step tutorial of Vulkan on Android, follow https://vulkan-tutorial.com.
C++
17
star
28

Graduate

Graduate design project
HTML
16
star
29

double-tf-android

[Deprecated, checkout https://bintray.com/google/tensorflow/tensorflow-android] A pure Gradle port of the TensorFlow library for Android!
Shell
14
star
30

GradleScripts

My common used gradle scripts.
Java
12
star
31

Xrash

Xrash is a CMake based cross-platform project for C++ sources, and also illustrate crash symbolicate within them.
C++
11
star
32

JavaUniverse

A demo project that showcase how to use Java to conquer the universe, with the help of J2ObjC and GWT :)
Java
9
star
33

GitHubAndroidOAuth

OAuth for GitHub in Android.
Java
9
star
34

Udacity-DLND

Udacity Nanodegree Deep Learning Foundations
HTML
8
star
35

AndroidTDDBootStrap-base

Base part of AndroidTDDBootStrap
Java
8
star
36

CppUniverse

A demo project that showcase how to use C++ to conquer the universe, with the help of Djinni and WebAssembly :)
C++
7
star
37

LoveStory

Love story pages, include counting, 2048, and timeline.
JavaScript
7
star
38

THCO-MIPS-CPU

Computer Organization course project:THCO-MIPS CPU
VHDL
6
star
39

KmppBootstrap

Bootstrap project for multiplatform development with Kotlin multiplatform.
Objective-C
6
star
40

DialogFragmentAnywhere

Anchor your dialog fragment to anywhere!
Java
5
star
41

live-template

AndroidStudio and Idea live templates.
Shell
5
star
42

ghrc

Github rank China, by dashboard repo stars.
Go
5
star
43

OurBar

Kotlin
5
star
44

VideoCodecAnatomy

Anatomy of video codec.
C++
4
star
45

talks

Slides of public talks.
3
star
46

tcp_ip_illustrated

A playground of the TCP/IP Illustrated book.
Go
2
star
47

pcapanalyse

a pcap trace analyser
Java
2
star
48

resume

My resume under version control.
HTML
2
star
49

searchengine

The course project of search engine.
Java
1
star
50

code2png

Render source code in image with syntax highlight
Go
1
star
51

scripts

my dotfiles and useful scripts
Vim Script
1
star
52

modp_b64

C
1
star
53

QQTang

The software engineer course project, a android platform network game.
Java
1
star
54

BeegoTDDBootStrap

bootstrap repo for api server develop based on beego framework
JavaScript
1
star
55

AndroidTDDBootStrap-testbase

TestBase part of AndroidTDDBootStrap
Java
1
star