Error java.lang.TypeNotPresentException: Type android.app.Application not present

26 views
Skip to first unread message

Viacheslav Vdovenko

unread,
Aug 27, 2015, 11:29:40 AM8/27/15
to Transfuse
Hello,

I'm looking to switch my project from dagger to transfuse.
Playing around with sample project and not able to get it works.
If I do add @Factory or @TransfuseModule annotation project not able to compile with that error message:
Error:Execution failed for task ':app:compileDebugJava'.
> java.lang.TypeNotPresentException: Type android.app.Application not present

I'm using Android Studio 1.3
That gradle dependencies:
    classpath 'com.neenbedankt.gradle.plugins:android-apt:1.7'
    classpath 'com.android.tools.build:gradle:1.2.3'

That project dependencies:
    apt 'org.androidtransfuse:transfuse:0.3.0-beta-7'
    compile 'org.androidtransfuse:transfuse-api:0.3.0-beta-7'

Including that apt settings:
apt {
    arguments {
        androidManifestFile variant.outputs[0].processResources.manifestFile
    }
}


All classes from example: http://androidtransfuse.org/documentation.html#dependency_injection_di

public class Example {
}

public class ExampleProvider implements Provider<Example> {
    public Example get() {
        return new Example();
    }
}

@TransfuseModule
@BindProviders({
        @BindProvider(type = Example.class, provider = ExampleProvider.class)
})
public class Module {
}

public class MainActivity extends Activity {

    @Inject
    Example mExample;

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_main);
        Log.d("MainActivity", "mExample: " + mExample);
    }
}


Thanks for help,

Viacheslav Vdovenko

unread,
Aug 28, 2015, 4:44:36 AM8/28/15
to Transfuse
With John's help looks like my set up missed android dependency:
compile 'com.google.android:android:2.1_r1'

Looks like we need to add android dependency explicitly.

Regards,
Reply all
Reply to author
Forward
0 new messages