GithubHelp home page GithubHelp logo

athkalia / just-another-android-app Goto Github PK

View Code? Open in Web Editor NEW
1.6K 48.0 174.0 2.18 MB

An Android base app with loads of cool libraries/configuration NOT MAINTAINED

License: Apache License 2.0

Java 88.54% Kotlin 11.46%
android android-development android-architecture mvp-android dagger2 mosby fabric crashlytics rxjava retrofit2

just-another-android-app's Introduction

Please note that this this project is no longer maintained

Android Sample app with MVP architecture

Sample project that displays some images from the dribble API. Demonstrates some cool stuff that you can do with the modern libraries and tooling in Android these days.

As someone said on reddit: "It's not over-engineered, it's just a skyscraper without the skyscraper part, just the foundations :)"

1

Newest additions:

  • Upgraded android gradle plugin to v3.0.1
  • Added support for Spoon. See https://github.com/square/spoon for more details. Also added the gradle plugin for it. One can run the tests with 'gradlew spoon' and then open up the generated reports in 'build/spoon' directory.
  • Added screenshot grabbing while running espresso tests in Firebase
  • Added test coverage for unit tests in teamcity CI Server
  • Added a runtime permission example. Uses the PermissionsDispatcher library. See RuntimePermissionsActivity class. (https://github.com/permissions-dispatcher/PermissionsDispatcher)
  • Restructured dependencies a bit, check build.gradle file and dependencies.gradle file
  • Added support for dagger android bindings (dagger v2.11)
  • Added auto-factory library the little cousin of auto-value (https://github.com/google/auto/tree/master/factory) into the project to help with dagger assisted injection (this post explains it quite well: https://stackoverflow.com/questions/22799407/looking-for-an-example-for-dagger-assisted-injection)
  • Added an Espresso test using the OkReplay (https://github.com/airbnb/okreplay) library that records and replays server responses. See com.example.features.dashboard.view.MainActivityOkReplayEspressoTest for more details.
  • Added support for Firebase cloud testing (firebase.google.com/docs/test-lab/) through Teamcity! Now every pull request/ nightly build/release build uses the service to run Espresso tests. See JustAnotherAndroidApp_RunEspressoTestsInFirebase.xml for more details.
  • Added support for Burst library (https://github.com/square/burst) for parametrized unit tests (see com.example.util.StringUtilsTest for more details).
  • Added app shortcuts! Static, dynamic, and dynamic used via the https://github.com/MatthiasRobbers/shortbread library! For details please check bottom of App class, MainActivity @Shortcut declaration and shortcuts.xml file.
  • Added 2 more custom lint checks around colors (Check class NonMaterialColorsDetector and DirectMaterialPaletteColorUsageDetector).
  • Added a custom lint check for hardcoded colors. (Check class HardcodedColorsDetector)
  • Gradle plugin to check APK size and automatically fail the build if the APK size is more than a specific value (check the build.gradle and gradle.properties file for the configuration and https://github.com/vanniktech/gradle-android-apk-size-plugin for the actual gradle plugin).
  • Added support for Teamcity CI scripts committed in VCS! They are written in Kotlin/xml (Check .teamcity folder or read more at the bottom of this file)
  • Added Sherlock into the project so that developers (and QA) can have easy access to exceptions occurring (and share them) through the app (see App class and the build.gradle file and https://github.com/ajitsing/Sherlock for the project).
  • Added Traceur into the project that allows for displaying more useful stacktraces with RxJava 2 (check TraceurTool class and the other related classes or https://github.com/T-Spoon/Traceur for the library).
  • Added chuck library for seeing network calls right on the phone. See https://github.com/jgilfelt/chuck for the library and the NetworkModule class for the added interceptor.
  • Disabling animations before espresso tests and re-enabling them afterwards! (See grant_animation_permission.gradle and EspressoTestHelper class)
  • Added Butterknife Actions (See ButterknifeActions class)
  • Support for mocking parts of your Dagger graph via DaggerMock library (see MainActivityTest class)
  • Added constraint layout! (See activity_main.xml)
  • Added an RxJava scheduler that informs Espresso via a CountingIdlingResource on when to pause test execution and wait for asynchronous tasks to finish (check com.example.util.rx.RxIdlingScheduler)
  • Upgraded project to use the new Mosby MVP v3!! Check https://github.com/sockeqwe/mosby for more details.
  • Added support for RxJavaPlugins class, that allows easy overriding of RxJava 2 schedulers in tests. See setup method of MainPresenterTest class.
  • Added some variations of the quick settings tiles. See https://medium.com/google-developers/quick-settings-tiles-e3c22daf93a8 for information on the feature and the com.example.features.tiles.PassiveTileServiceOnlyToggle class for the implementation (plus there are some more goodies in the same package)

Contents:

libraries:
  • RxJava
  • Dagger 2 with examples of assisted injection and different modules depending on build type. Also support for android dagger v2.11
  • Retrofit 2 and Retrofit Mock mode for debug builds
  • Mosby MVP with View State support (v3!)
  • Timber
  • Auto Value and Auto Factory
  • Glide with a wrapper
  • Butterknife
  • AssertJ for fluent assertions
  • Fabric (Crashlytics and Answers)
  • Retrolambda
  • Stetho
  • Chuck
  • ShortBread (https://github.com/MatthiasRobbers/shortbread)
  • PermissionsDispatcher for runtime permissions (https://github.com/permissions-dispatcher/PermissionsDispatcher)
Static analysis:
  • PMD (https://pmd.github.io/ - check file static_analysis_java.gradle)
  • Checkstyle (check file static_analysis_java.gradle)
  • Lint (check file lint.gradle)
  • Findbugs (check file static_analysis_java.gradle)
  • Jacoco code coverage that can generate reports for unit tests, espresso tests or the combination of the two
  • A set of custom IDE inspection rules
  • A module with custom lint rules and tests for them
Testing:
  • Added support for Spoon. See https://github.com/square/spoon for more details. Also added the gradle plugin for spoon. One can run the tests with 'gradlew spoon' and then open up the generated reports in 'build/spoon' directory.
  • Test coverage running in Teamcity CI server
  • Espresso tests with and without mock web server
  • Mock web server tests that loads responses from json files
  • Robolectric tests
  • Normal unit tests
  • Ok http interceptor for changing the base url in tests
  • Idling resources
  • Unlocking screen for Espresso tests (check class com.example.util.EspressoTestRunner)
  • Support for RxJavaPlugins class, that allows easy overriding of RxJava 2 schedulers in tests (check MainPresenterTest class)
  • Support for an RxJava scheduler that helps with espresso tests and asynchronous code execution. (check com.example.util.rx.RxIdlingScheduler)
  • Support for mocking parts of your Dagger graph via DaggerMock library (see MainActivityTest class)
  • Disabling animations before espresso tests and re-enabling them afterwards! (See grant_animation_permission.gradle and EspressoTestHelper class)
  • Added Sherlock into the project so that developers (and QA) can have easy access to exceptions occurring (and share them) through the app (see App class and the build.gradle file and https://github.com/ajitsing/Sherlock for the project).
  • Burst library (https://github.com/square/burst) for parametrized unit tests (see com.example.util.StringUtilsTest for more details).
  • Added support for Firebase cloud testing (firebase.google.com/docs/test-lab/) through Teamcity! Now every pull request/ nightly build/release build uses the service to run Espresso tests. See JustAnotherAndroidApp_RunEspressoTestsInFirebase.xml for more details.
  • Added an Espresso test using the OkReplay (https://github.com/airbnb/okreplay) library that records and replays server responses. See com.example.features.dashboard.view.MainActivityOkReplayEspressoTest for more details.
View Related:
  • Added constraint layout! (See activity_main.xml)
  • Added Butterknife Actions (See ButterknifeActions class)
Other:
  • Gradle plugin to check APK size and automatically fail the build if the APK size is more than a specific value (check the build.gradle and gradle.properties file for the configuration and https://github.com/vanniktech/gradle-android-apk-size-plugin for the actual gradle plugin).
  • Separate app icons according to build type
  • Some advanced source sets configuration for splitting up tests
  • Loading some project config from property files in Android Manifest and build.gradle
  • Shared folders for some build types or tests
  • Working proguard config
  • Android Studio external annotations (https://www.jetbrains.com/help/idea/2016.3/external-annotations.html)
  • Package level annotations for @Nullable and @NonNull
  • OkHttp interceptor for adding auth token to headers easily
  • Strict mode
  • Plugin to publish app on the playstore
  • Dex count plugin for counting the number of methods in the apk
  • Separate Timber logging tree for crashlytics. See com.example.tools.timber.CrashlyticsTree
  • Quick settings tiles (See com.example.features.tiles.PassiveTileServiceOnlyToggle)
  • Added Traceur into the project that allows for displaying more useful stacktraces with RxJava 2 (check TraceurTool class and the other related classes or https://github.com/T-Spoon/Traceur for the library).
  • App shortcuts! Static, dynamic, and dynamic used via the https://github.com/MatthiasRobbers/shortbread library! For details please check bottom of App class, MainActivity @Shortcut declaration and shortcuts.xml file.

..and all sorts of other goodies!

Teamcity - Continuous Integration

The project benefits from Teamcity's feature of storing the CI server configuration in Kotlin in a Version Control System. See https://confluence.jetbrains.com/display/TCD10/Kotlin+DSL for more details. The settings can be found under the .teamcity folder in the project.

Build Configurations:

There's 3 build configurations:

  • 'Pull requests' build configuration, triggered on every Pull Request. Verifies correctness of a Pull Request (usually for the 'develop' branch). QA would fetch the relevant APK from HockeyApp created by this build configuration in order to manually test the feature/fix that the Pull Request introduces. This build:
    • Runs all static analysis tools.
    • Runs all unit tests for all build types.
    • Perform method count for all build types.
    • Checks for duplicates.
    • Builds APKs.
    • Runs all espresso tests on Firebase Test Cloud.
    • Uploads APKs to HockeyApp.
    • Updates Github with the status of the job (success/failure).
  • 'Nightly Builds' build configuration, triggered every night at midnight on 'develop' branch. QA would fetch the relevant APK from HockeyApp created by this build config in order to test the integration of features of the app. This build is also deployed to a closed alpha playstore group for people to test. This build:
    • Runs all unit tests for all build types.
    • Performs method count for all build types.
    • Checks for duplicates.
    • Builds APKs.
    • Runs all espresso tests on Firebase Test Cloud.
    • Uploads APKs to HockeyApp.
    • Uploads Release APK to private alpha channel in Playstore.
  • 'Releases' build configuration, triggered on every branch matching the 'release/*' logical branch name. QA would fetch the relevant APK from HockeyApp to perform the final testing before the release. This build is also deployed to an open beta playstore group for people to test. This build:
    • Runs all static analysis tools.
    • Runs all unit tests for all build types.
    • Performs method count for all build types.
    • Checks for duplicates.
    • Builds APKs.
    • Runs all espresso tests on Firebase Test Cloud.
    • Uploads APKs to HockeyApp.
    • Uploads Release APK to public beta channel in Playstore.
Reports:

There's also all sorts of reports available:

  • Checkstyle static analysis report shows all the checkstyle warnings in the project. Would usually report back empty as there's a zero tolerance policy in the project. On failed builds it pinpoints the issues that need to be fixed.

2

  • Unit test reports for all build types show all the tests that were run along with additional details and stacktraces should an error occur. 2 dashboards, one is the Teamcity generated Test report, the other is the original Junit4 html report.

3

11

  • Dex method counter reports for all build types show the method count for every APK, along with an interesting drill down visualization that makes it very easy to spot libraries that contain too many methods. As a note, usually release and QA APKs have a smaller method counts in these reports as Proguard is running in these build types, stripping unused methods.

4

  • Findbugs static analysis report shows all the findbugs warnings in the project. Would usually report back empty as there's a zero tolerance policy in the project. On failed builds it pinpoints the issues that need to be fixed.

5

  • Lint static analysis report shows all the lint warnings in the project. Would usually report back empty as there's a zero tolerance policy in the project. On failed builds it pinpoints the issues that need to be fixed.

6

  • PMD static analysis report shows all the PMD warnings in the project. Would usually report back empty as there's a zero tolerance policy in the project. On failed builds it pinpoints the issues that need to be fixed.

7

12

Teamcity Plugins:

A couple of Teamcity plugins were used to make my life easier:

Notes:

HockeyApp

I am using HockeyApp to save and (in theory) distribute the APKs to QA or stakeholders. See https://hockeyapp.net for more details on the product. This is what it looks like in the HockeyApp dashboard:

8

As you can see there's different builds for the different CI build configurations and all the build types. HockeyApp guys were kind enough to provide me with a free account to demonstrate the usage of their tool.

Playstore reviews in slack

Using Review bot for this (https://reviewbot.io/?utm_source=github&utm_medium=athkalia-just-another-android-app) Not much to say, just a super simple tool that gets the job done. When a review comes it looks like this:

13

Roadmap

  • Upgrade to latest version of gradle
  • fingerprint authentication
  • Conductor library

Submitting PRs

Please make sure the command gradlew check completes successfully before creating the PR. This command runs all the tests for all the variants, plus the 4 static analysis tools: lint, checsktyle, pmd, findbugs.

List of stuff that I won't be adding, feel free to contribute if you like any of these!
  • Run test coverage in firebase cloud testing, fetch the reports, (possibly merge them with unit tests coverage reports), and provide reporting back to the CI server. This would require paying for an S3 bucket, and I am uncertain about the usefulness of tracking this to be honest.
  • Automate releases more, like tagging releases, merging back to develop etc. Requirements around this are very project specific, and given that there may be conflicts etc, not worth automating for now.
  • Automatic screenshots through the "Fastlane - Screengrab" tool (https://github.com/fastlane/fastlane/tree/master/screengrab) They don't support windows and I don't have a Mac :(

Any feedback/pull request is welcome!

You can catch me at www.sakiskaliakoudas.com

just-another-android-app's People

Contributors

egor-n avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

just-another-android-app's Issues

While app launch: java.lang.NoClassDefFoundError: Failed resolution of: Lcom/facebook/stetho/Stetho

Environment: Android Studio 2.23
Gradle: 3.2.1

The stack trace is here:

E/AndroidRuntime: FATAL EXCEPTION: main
                  Process: com.example.develop, PID: 4309
                  java.lang.NoClassDefFoundError: Failed resolution of: Lcom/facebook/stetho/Stetho;
                      at com.example.util.StethoToolImpl.init(StethoToolImpl.java:24)
                      at com.example.App.initStetho(App.java:93)
                      at com.example.App.onCreate(App.java:32)
                      at com.android.tools.fd.runtime.BootstrapApplication.onCreate(BootstrapApplication.java:370)
                      at android.app.Instrumentation.callApplicationOnCreate(Instrumentation.java:1036)
                      at android.app.ActivityThread.handleBindApplication(ActivityThread.java:5492)
                      at android.app.ActivityThread.-wrap2(ActivityThread.java)
                      at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1571)
                      at android.os.Handler.dispatchMessage(Handler.java:102)
                      at android.os.Looper.loop(Looper.java:154)
                      at android.app.ActivityThread.main(ActivityThread.java:6209)
                      at java.lang.reflect.Method.invoke(Native Method)
                      at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:865)
                      at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:755)
E/AndroidRuntime: Caused by: java.lang.ClassNotFoundException: Didn't find class "com.facebook.stetho.Stetho" on path: DexPathList[[dex file "/data/data/com.example.develop/files/instant-run/dex/slice-support-annotations-25.1.1_dfefee911e18261d2128ab14c28ff3558b0a6e4e-classes.dex", dex file "/data/data/com.example.develop/files/instant-run/dex/slice-slice_9-classes.dex", dex file "/data/data/com.example.develop/files/instant-run/dex/slice-slice_8-classes.dex", dex file "/data/data/com.example.develop/files/instant-run/dex/slice-slice_7-classes.dex", dex file "/data/data/com.example.develop/files/instant-run/dex/slice-slice_6-classes.dex", dex file "/data/data/com.example.develop/files/instant-run/dex/slice-slice_5-classes.dex", dex file "/data/data/com.example.develop/files/instant-run/dex/slice-slice_4-classes.dex", dex file "/data/data/com.example.develop/files/instant-run/dex/slice-slice_3-classes.dex", dex file "/data/data/com.example.develop/files/instant-run/dex/slice-slice_2-classes.dex", dex file "/data/data/com.example.develop/files/instant-run/dex/slice-slice_1-classes.dex", dex file "/data/data/com.example.develop/files/instant-run/dex/slice-slice_0-classes.dex", dex file "/data/data/com.example.develop/files/instant-run/dex/slice-retrofit-mock-2.1.0_20acf898747ed2b5aea8574ad8b28a56e295c7bd-classes.dex", dex file "/data/data/com.example.develop/files/instant-run/dex/slice-retrofit-2.1.0_d08a4fe87b2eedd5fcddf3c1613c08274b04542b-classes.dex", dex file "/data/data/com.example.develop/files/instant-run/dex/slice-okio-1.9.0_5b3627987d6cb4bcccd7450ffe5951f2b7e40eea-classes.dex", dex file "/data/data/com.example.develop/files/instant-run/dex/slice-nl.littlerobots.rxlint-rxlint-1.1_1267bf6a80c8f1d546a2834b1934cebadede0fa7-classes.dex", dex file "/data/data/com.example.develop/files/instant-run/dex/slice-mvp-common-2.0.1_8e3316f36c2fb44012af1712b007de9d56e9e2df-classes.dex", dex file "/data/data/com.example.develop/files/instant-run/dex/slice-logging-interceptor-3.4.2_f6bef079f71b174b0a377cc156a745543e889458-classes.dex", dex file "/data/data/com.example.develop/files/instant-run/dex/slice-javax.inject-1_95309d88f62e0e5ae92674ebc77695ae406206a4-classes.dex", dex file "/data/data/com.example.develop/files/instant-run/dex/slice-io.reactivex-rxandroid-1.2.1_607f4bcd5845bc6492191050ded4a61ed1d51fd0-classes.dex", dex file "/data/data/com.example.develop/files/instant-run/dex/slice-io.fabric.sdk.android-fabric-1.3.14_1e0a9a9d0a06273d8a6ad5b7e53a8d055e92edc6-classes.dex", dex file "/data/data/com.example.develop/files/instant-run/dex/slice-gson-2.7_383633617374820f09d175a61ba649b649396bca-classes.dex", dex file "/data/data/com.example.develop/files/instant-run/dex/slice-dagger-2.7_1a87ca17ae0b9929681ad7246648556e27329938-classes.dex", dex file "/data/data/com.example.develop/files/instant-run/dex/slice-converter-gson-2.1.0_e8e506bc66855717700ce98d82f021729957e054-classes.dex", dex file "/data/data/com.example.develop/files/instant-run/dex/slice-commons-cli-1.2_96c24d7520f35645d6371a1082a8728ea8781ef5-classes.dex", dex file "/data/data/com.example.develop/files/instant-run/dex/slice-com.jakewharton.timber-timber-4.5.1_76b27343422d69f488c8c7ac1cd46d9ebcd56523-classes.dex", dex file "/data/data/com.example.develop/files/instant-run/dex/slice-com.jakewharton-butterknife-8.5.1_e9bdc7c02c1db4264ae2f2144306d6e8eccb2992-classes.dex", dex file "/data/data/com.example.develop/files/instant-run/dex/slice-com.hannesdorfmann.mosby-viewstate-2.0.1_a5a0954275db8764deba9476390d32aae9b160d7-classes.dex", dex file "/data/data/com.example.develop/files/instant-run/dex/slice-com.hannesdorfmann.mosby-mvp-2.0.1_6aa0b174f54ed73a38ead4c616d8fa33ba232e94-classes.dex", dex file "/data/data/com.example.develop/files/instant-run/dex/slice-com.facebook.stetho-stetho-okhttp3-1.4.2_c2660d1bc97134c9f85eed142be688e5ef1ad4a1-classes.dex", dex file "/data/data/com.example.develop/files/instant-run/dex/slice-com.facebook.android-facebook-android-sdk-4.10.0_06a008f9c7fe54133e79d203829a3073632bec9a-classes
E/AndroidRuntime: .dex", dex file "/data/data/com.example.develop/files/instant-run/dex/slice-com.crashlytics.sdk.android-crashlytics-core-2.3.14_6cf2eb24d5b258b549423db7e9cf52e7b6bd407f-classes.dex", dex file "/data/data/com.example.develop/files/instant-run/dex/slice-com.crashlytics.sdk.android-crashlytics-2.6.5_16af0bf55b4c81f01f8c366f2577bf6731b6e3e4-classes.dex", dex file "/data/data/com.example.develop/files/instant-run/dex/slice-com.crashlytics.sdk.android-beta-1.2.2_d70c92730da784e744687cf6ac5f171124a4a754-classes.dex", dex file "/data/data/com.example.develop/files/instant-run/dex/slice-com.crashlytics.sdk.android-answers-1.3.10_02615646608fe8dcf1e8685d880c6ec0c2669897-classes.dex", dex file "/data/data/com.example.develop/files/instant-run/dex/slice-com.android.support.test.espresso-espresso-idling-resource-2.2.2_62809e7264bcd1018b825d078ccf623c9928a3cd-classes.dex", dex file "/data/data/com.example.develop/files/instant-run/dex/slice-com.android.support-support-vector-drawable-25.1.1_80e413894e3895c57c6cd5511cb5f13315dbe515-classes.dex", dex file "/data/data/com.example.develop/files/instant-run/dex/slice-com.android.support-support-v4-25.1.1_64eb787ff00381bd39de19f241da92c7c22d9695-classes.dex", dex file "/data/data/com.example.develop/files/instant-run/dex/slice-com.android.support-support-media-compat-25.1.1_227b3fc179969b390ffef7d1f40e14e585565608-classes.dex", dex file "/data/data/com.example.develop/files/instant-run/dex/slice-com.android.support-support-fragment-25.1.1_4a6dcd1af950af471bd79da072210ee7ddf7fc3a-classes.dex", dex file "/data/data/com.example.develop/files/instant-run/dex/slice-com.android.support-support-core-utils-25.1.1_15ecf2a0ff46e4e396629230e3c2b226dee24c5e-classes.dex", dex file "/data/data/com.example.develop/files/instant-run/dex/slice-com.android.support-support-core-ui-25.1.1_e1e1ccbe1a3683ce8d4a152029f56ee1e9a38e0c-classes.dex", dex file "/data/data/com.example.develop/files/instant-run/dex/slice-com.android.support-support-compat-25.1.1_addfabc2846c9ce368ff749697e01e6e0f6c3dd2-classes.dex", dex file "/data/data/com.example.develop/files/instant-run/dex/slice-com.android.support-recyclerview-v7-25.1.1_84a5e65d606d4bfc81172b51da992051e168f044-classes.dex", dex file "/data/data/com.example.develop/files/instant-run/dex/slice-com.android.support-multidex-1.0.1_6e558d4b5533beb308b8fb20613be4a5c87f2e3e-classes.dex", dex file "/data/data/com.example.develop/files/instant-run/dex/slice-com.android.support-cardview-v7-23.4.0_2f158647b14988d7fec4152a937479b2e016a388-classes.dex", dex file "/data/data/com.example.develop/files/instant-run/dex/slice-com.android.support-appcompat-v7-25.1.1_c67f60d5c86f2a02499744b126452c32d5ceb14b-classes.dex", dex file "/data/data/com.example.develop/files/instant-run/dex/slice-com.android.support-animated-vector-drawable-25.1.1_3e2ef11865299d7e77f495c1f776d0d8683a62f5-classes.dex", dex file "/data/data/com.example.develop/files/instant-run/dex/slice-butterknife-annotations-8.5.1_c624622a7361f1b94a0ecb56778b100c13132ea1-classes.dex", dex file "/data/data/com.example.develop/files/instant-run/dex/slice-bolts-tasks-1.3.0_ca831ced3df47f5762172a380e06fd22af4150ef-classes.dex", dex file "/data/data/com.example.develop/files/instant-run/dex/slice-bolts-applinks-1.3.0_75ce204d49f8c7d7bc7633845970b427ae934954-classes.dex", dex file "/data/data/com.example.develop/files/instant-run/dex/slice-annotations-2.0.1_e40182c42347edfcee33760093b1997d7faf5f2d-classes.dex", dex file "/data/data/com.example.develop/files/instant-run/dex/slice-adapter-rxjava-2.1.0_7f6d2a0d04e52fa760d394e9a2a115433c462092-classes.dex"],nativeLibraryDirectories=[/data/app/com.example.develop-1/lib/arm64, /system/lib64, /vendor/lib64]]
                      at dalvik.system.BaseDexClassLoader.findClass(BaseDexClassLoader.java:56)
                      at com.android.tools.fd.runtime.IncrementalClassLoader$DelegateClassLoader.findClass(IncrementalClassLoader.java:90)
                      at java.lang.ClassLoader.loadClass(ClassLoader.java:380)
                      at java.lang.ClassLoader.loadClass(ClassLoader.java:312)
E/AndroidRuntime: 	... 14 more

Any ideas how to fix it?

[Question] better way to create component factory

Hello, I have a question, there is a better way to implement a factory for all components if the project has many component alot of boilerplate will be needed, with 4 component that Component Factory looks like

public final class ComponentFactory {

    @ForTestingPurposes
    @Nullable
    private static SplashActivityComponent splashActivityComponent;
    
    @ForTestingPurposes
    @Nullable
    private static LoginActivityComponent loginActivityComponent;
    
    @ForTestingPurposes
    @Nullable
    private static HomeActivityComponent homeActivityComponent;
    
    @ForTestingPurposes
    @Nullable
    private static DetailsActivityComponent detailsActivityComponent;

    private ComponentFactory() {
        throw new AssertionError();
    }

    public static SplashActivityComponent getSplashComponent() {
        if(splashActivityComponent == null) {
            splashActivityComponent = DaggerSplashActivityComponent.builder()
                    .applicationComponent(App.getApplicationComponent())
                    .build();
            return splashActivityComponent;
        }
        return splashActivityComponent;

    }

    public static LoginActivityComponent getLoginComponent() {
        if(loginActivityComponent == null) {
            loginActivityComponent = DaggerLoginActivityComponent.builder()
                    .applicationComponent(App.getApplicationComponent())
                    .build();
            return loginActivityComponent;
        }
        return loginActivityComponent;
    }

    public static HomeActivityComponent getHomeComponent() {
        if(homeActivityComponent == null) {
            homeActivityComponent = DaggerHomeActivityComponent.builder()
                    .applicationComponent(App.getApplicationComponent())
                    .build();
            return homeActivityComponent;
        }

        return  homeActivityComponent;
    }

    public static DetailsActivityComponent getDetailComponent() {
        if(detailsActivityComponent == null) {
            detailsActivityComponent = DaggerDetailsActivityComponent.builder()
                    .applicationComponent(App.getApplicationComponent())
                    .build();
            return detailsActivityComponent;
        }

        return  detailsActivityComponent;
    }

    @ForTestingPurposes
    @VisibleForTesting
    public static void setSplashActivityComponent(@Nullable SplashActivityComponent splashActivityComponent) {
        ComponentFactory.splashActivityComponent = splashActivityComponent;
    }

    @ForTestingPurposes
    @VisibleForTesting
    public static void setLoginActivityComponent(LoginActivityComponent loginActivityComponent) {
        ComponentFactory.loginActivityComponent = loginActivityComponent;
    }

    @ForTestingPurposes
    @VisibleForTesting
    public static void setHomeActivityComponent(HomeActivityComponent homeActivityComponent) {
        ComponentFactory.homeActivityComponent = homeActivityComponent;
    }

    @ForTestingPurposes
    @VisibleForTesting
    public static void setDetailsActivityComponent(DetailsActivityComponent detailsActivityComponent) {
        ComponentFactory.detailsActivityComponent = detailsActivityComponent;
    }
}

any suggestion?

Create a details Activity

Hello, there is any possibility to add a details activity? I would like to see how works with SubComponent and etc..

gradlew test fails

not sure if I am executing the right command, but running

gradlew test

results in

...
com.example.lint.detectors.AndroidLogDetectorTest > test_detector_triggering FAILED
    junit.framework.AssertionFailedError at AndroidLogDetectorTest.java:43

com.example.lint.detectors.AndroidLogDetectorTest > test_detector_not_triggering FAILED
    junit.framework.AssertionFailedError at AndroidLogDetectorTest.java:33

4 tests completed, 2 failed
:lint:test FAILED

Examining the generated result (using build/reports/tests/test/index.html) is not particularly helpful, at least to me.

junit.framework.AssertionFailedError: Found compilation problems in lint test not overriding allowCompilationErrors():
AndroidLogNotExistingTestCase.java:Error: 1: The type java.lang.Object cannot be resolved. It is indirectly referenced from required .class files
AndroidLogNotExistingTestCase.java:Error: 5: Implicit super constructor Object() is undefined. Must explicitly invoke another constructor

	at junit.framework.Assert.fail(Assert.java:57)

Was very tricky to integrate React-native into the app

This is not a bug.

But it turned out to be very very tricky to integrate react native into the Just-another-android app.
The problem turned out to be conflict in versions of okhttp

See this discussion
http://stackoverflow.com/questions/43020878/react-native-activity-crashes-probably-related-to-packaging-okhttp3

so just sharing, if others run into it.
Or may be, it would make sense to add some comments in to the gradle wrt this potential conflict (if it persists in the next couple of iterations of react native).

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.