Skip to content
Alexander Blinov edited this page Nov 14, 2017 · 20 revisions

Problem
Presenter.getViewState() always is null.

Solution
Check your Presenter is annotated with @InjectViewState. If you don't want this annotation, then set ViewState manually using MvpPresenter<View extends MvpView>.setViewState(MvpViewState<View>).


Problem
Presenter annotated @InjectPresenter is always null.

Solution

  • Check Presenter has public default constructor
  • Check Annotation Processor is enabled
  • Check you use the same method for all annotation processors. In build.gradle file should be only one of words: annotationProcessor, apt, kapt
  • Check class, that contains it's field, calls MvpDelegate methods. MvpDelegate.onCreate(Bundle) is required for presenter injection. (Or it can be inherited from MvpFragment or MvpActivity)

Problem
Executing gradlew assembleDebug will fail if android-apt version is 1.8 (most recent for now)

Solution
android-apt 1.8 needs in JDK 1.8. You can tell gradlew to use specific version of JDK by setting it up in gradle.properties or by adding parameter to the terminal command like: gradlew -Dorg.gradle.java.home="path_to_jdk_home" assembleDebug


Problem
Gradle log warning: Warning:Ignoring Android API artifact com.google.android:android:4.0.1.2 for debug

Solution
Exclude com.google.android from dependency:

compile ('com.arello-mobile:moxy:0.5.4'){
    exclude group: 'com.google.android'
}
compile ('com.arello-mobile:moxy-android:0.5.4'){
    exclude group: 'com.google.android'
}
apt 'com.arello-mobile:moxy-compiler:0.5.4'

Problem
Need to use @InjectPresenter inside ViewHolder of RecyclerView

Solution
See these gist


Problem
Perfect tips for processing getMapAsync() callback in MapFragment


Solution
https://gist.github.com/terrakok/cd080a6a0213ef7430bdd72ebe92c9ef


Problem
Is it possible to inject presenter using Dagger instead of @InjectPresenter?


Solution
https://github.com/Arello-Mobile/Moxy/issues/100


Problem
I'm using kotlin, kapt and plugin: 'kotlin-kapt'. And sometimes I see some like this:

Error:(19, 140) error: cannot find symbol class MainActivity$$PresentersBinder
Error:Execution failed for task ':sample-kotlin:compileDebugJavaWithJavac'.
> Compilation failed; see the compiler error output for details.


Solution
This is known kapt/gradle issue: https://youtrack.jetbrains.com/issue/KT-20341 . And there is some quick fix:

android {
    compileOptions {
        incremental = false 
    }
}