Annotation Processor

Robo MVP uses annotation to associate Presenter with View. At runtime, it leans on reflection to collect presenter-view mapping information from annotation marked up on the view. You might want to get rid of your application reading annotation as it's somehow slow, so you can use Annotation Processor to pre-collect mappings at compile time.

In Gradle

Add following dependency to your build.gradle:

dependencies {
    compile 'com.robocreative.android:robo-mvp-processor:1.0'
}

Note that you also need the plugin 'com.neenbedankt.android-apt' to be sure that Android Studio will pick up generated source from annotation processors as well as it can understand apt configuration for excluding annotation processors from runtime dependencies.

buildscript {
    dependencies {
        classpath 'com.neenbedankt.gradle.plugins:android-apt:1.8'
    }
}

apply plugin: 'com.neenbedankt.android-apt'

Specify package and name of the pre-compiled mapping collector that you want the compiler to generate for you.

apt {
    arguments {
        presenterMappingCollector 'com.example.myapplication.IndexedCollector'
    }
}

Also exclude Processor from the packaging.

android {
    packagingOptions {
        exclude 'META-INF/services/javax.annotation.processing.Processor'
    }
}

Below is a sample build.gradle for your references

apply plugin: 'com.android.application'
apply plugin: 'com.neenbedankt.android-apt'

android {
    compileSdkVersion 23
    buildToolsVersion '23.0.1'

    defaultConfig {
        applicationId 'com.example.myapplication'
        minSdkVersion 11
        targetSdkVersion 23
        versionCode 1
        versionName 11.0'
    }
    buildTypes {
        release {
            minifyEnabled false
            proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
        }
    }

    packagingOptions {
        exclude 'META-INF/services/javax.annotation.processing.Processor'
    }
}

dependencies {
    compile 'com.google.inject:guice:3.0:no_aop'
    compile 'com.android.support:appcompat-v7:23.3.0'
    compile 'com.android.support:support-v4:23.3.0'
    compile 'com.robocreative.android:robo-common:1.0'
    compile 'com.robocreative.android:robo-messaging:1.0'
    compile 'com.robocreative.android:robo-mvp:1.0'
    compile 'com.robocreative.android:robo-mvp-support-v7:1.0'
    compile 'com.robocreative.android:robo-mvp-support-v4:1.0'
    compile 'com.robocreative.android:robo-mvp-processor:1.0'
    compile 'com.robocreative.android:robo-mvp-guice:1.0'
    compile 'com.robocreative.android:robo-navigation-commands:1.0'
}

apt {
    arguments {
        presenterMappingCollector 'com.example.myapplication.IndexedCollector'
    }
}

Now rebuild your project. If the output window prints messages like "Found presenter for..." and the build does not produce any errors, then everything is setup correctly.

In your bootstrapper, override the method getPresenterMappingCollector() and let it return an instance of the class IndexedCollector generated at compile time.

package com.example.myapplication;

import com.robo.mvp.PresenterMappingCollector;
import com.robo.mvp.guice.AbstractBootstrapper;

public class MyBootstrapper extends AbstractBootstrapper {

    @Override
    protected PresenterMappingCollector createPresenterMappingCollector() {
        return new IndexedCollector();
    }
}

Now enjoy some speed up. Note that the difference might not be day and night. But it's actually faster than not using Annotation Processor.