Questions tagged [roboguice]

Roboguice brings the power and testability of using the Google Guice dependency injection framework to Android application development.

RoboGuice is a framework that brings the simplicity and ease of Dependency Injection to Android, using Google's own Guice library.

Useful links

330 questions
85
votes
2 answers

Process crashes during creation of RoboGuice injector, if there is a mocked instance in any module

I have a problem with using RoboGuice and AndroidMock frameworks in unit testing. I've created a simple project to show my problem. Here I create a mocked instance and register it in the RoboGuice. But the process crashes between the "setUp()" and…
Andrey
  • 851
  • 5
  • 3
49
votes
6 answers

Where is log output written to when using Robolectric + Roboguice?

I'm using Robolectric to test Android. I'm running my tests via maven, e.g. mvn -Dtest=LogTest test If I have code that writes to the logs, such as Log.d("TAG", "blah"); or using Roboguice's Ln Ln.d("blah"); I don't see any output in maven's…
Tyler Collier
  • 9,964
  • 9
  • 63
  • 74
42
votes
1 answer

Using Dependency Injection with Roboguice?

I'm working on an Android project and I would like to know any recommendations about what's a good architecture to build an android application. I want to use dependency injection using Roboguice and I've been reading about MVVM pattern or MVC…
Jose R. Cruz
  • 889
  • 1
  • 9
  • 15
31
votes
2 answers

Keep annotated class in Proguard

I have a bunch of classes that use e.g. an @Singleton annotation like so @Singleton public class ImageCache that I would like to keep. How can I configure a proguard -keep statement so it applies to all classes that have that annotation. Btw in…
Manfred Moser
  • 28,342
  • 13
  • 87
  • 120
23
votes
4 answers

Does it make sense to use Guice for Android

I'm debating using guice in an android project that is quite complex and has a lot of business logic. Guice seems like a good fit, but whenever I start reading deeper into it, it starts to look more complicated than it needs to be. One thing I…
Otto
  • 1,588
  • 2
  • 19
  • 26
23
votes
1 answer

What are the specific benefits of using DI on Android?

What are the specific benefits or advantages of using a dependency injection framework for Android, like Dagger, Transfuse or RoboGuice? For example, what kind of apps would benefit the most from using DI? is there more of a performance advantage,…
Acapulco
  • 2,847
  • 8
  • 35
  • 44
15
votes
1 answer

Android & RoboGuice - Inject views on Fragment?

I have a fragment that I need to display on the screen. I want to be able to use InjectView to inject my UI elements. InjectView works fine on activities because the view (xml) is set during onCreate, however on fragments the view is set on…
aryaxt
  • 69,636
  • 87
  • 281
  • 421
15
votes
3 answers

java.io.FileNotFoundException: com/google/inject/internal/util/$Finalizer.class at the start of android app

I'm developing and android countdown app. In the app you can add or delete as many countdowns as you want. All the Countdowns are saved in an ArrayList. I can't just save them in an database or in the shared preferences because the countdown have to…
klange
  • 3,245
  • 3
  • 14
  • 16
14
votes
2 answers

Any simple examples using roboguice with fragments in android?

I'm having issues finding a working example of using fragments + RoboGuice. The problem happens when you attempt to add/remove fragments with the Android fragment transaction manager. Once you tell the fragment to inherit from RoboFragment the…
technoviking
  • 161
  • 3
  • 7
13
votes
1 answer

Using Guice to inject dependencies into an Android activity's constructor

Does anybody know of a way to use Guice to inject dependencies into the constructor of an Activity in Android? It looks like activities normally have only the default constructor so that the platform can easily create a new instance. While it is…
benstpierre
  • 30,487
  • 46
  • 163
  • 272
12
votes
2 answers

Guice @Provides Methods vs Provider Classes

I'm working on a fairly large project that has a lot of injections. We're currently using a class that implements Provider for each injection that needs one, and they mostly have one line get methods. It's starting to get annoying to create a new…
Eliezer
  • 6,606
  • 9
  • 54
  • 100
10
votes
3 answers

Android Roboguice Exception

Just starting my way with Roboguice for android. Tried implementing this simple context injection but getting this exception. I googled it and ran into quite a few posts but non solved my issue. This is the exception below, any ideas? Thanks in…
forhas
  • 9,955
  • 18
  • 72
  • 103
10
votes
1 answer

Robolectric + PowerMock + Mockito not working

I'm struggling to get this rare combination works, but I haven't got luck. My project uses JUnit + Mockito + Robolectric for testing and Roboguice for injection, when I added PowerMock to the equation weird things happened, this are some of the…
JavierSP1209
  • 846
  • 6
  • 17
10
votes
2 answers

Android Roboguice proguard warning

I can't seem to compile without warnings. This is the warning: Warning:roboguice.activity.RoboMapActivity: can't find superclass or interface com.google.android.maps.MapActivity Warning:roboguice.activity.RoboSherlockActivity: can't find superclass…
JY2k
  • 2,749
  • 1
  • 26
  • 49
9
votes
2 answers

RoboGuice 3.0 NoClassDefFoundError: roboguice.inject.ContextScopedRoboInjector

This is not always seen but seen on particular API 14 and 19. Below is the stacktrace java.lang.NoClassDefFoundError: roboguice.inject.ContextScopedRoboInjector at roboguice.RoboGuice.getInjector(RoboGuice.java:197) at…
rsakhale
  • 863
  • 9
  • 21
1
2 3
21 22