Giter Club home page Giter Club logo

roboguice's Introduction

As of August 2016, RoboGuice is no longer supported. For nearly 5 years it was the #1 dependency injection framework on Android due to its ease-of-use, but other responsibilities have kept it from getting the attention it needed and over time it hasn't kept up with the needs of the community. There are now many other excellent DI frameworks for Android, please consider migrating to one of them.

Thank you for your many years of support.


### ~~Google Guice on Android, version 3.0~~ [![Build Status on Travis:](https://travis-ci.org/roboguice/roboguice.svg?branch=master)](https://travis-ci.org/roboguice/roboguice) [![Maven Central](https://maven-badges.herokuapp.com/maven-central/org.roboguice/roboguice/badge.svg)](https://maven-badges.herokuapp.com/maven-central/org.roboguice/roboguice)

RoboGuice 3 smoothes out some of the wrinkles in your Android development experience and makes things simple and fun. Do you always forget to check for null when you getIntent().getExtras()? RoboGuice 3 will help you. Think casting findViewById() to a TextView shouldn’t be necessary? RoboGuice 3 is on it.

RoboGuice 3 takes the guesswork out of development. Inject your View, Resource, System Service, or any other object, and let RoboGuice 3 take care of the details.

RoboGuice 3 slims down your application code. Less code means fewer opportunities for bugs. It also makes your code easier to follow -- no longer is your code littered with the mechanics of the Android platform, but now it can focus on the actual logic unique to your application.

There’s no “magic”. Everything you need is configured explicitly for you by RoboGuice 3 or can be overridden by you.

RoboGuice 3 applications have been Featured on the Android Market for years. It leverages the award-winning and production-ready Google Guice library to bring you simple dependency injection lightweight enough to use in a mobile application.

It works, and people are using it. Why not give it a spin?

Get Started with RoboGuice 3!


Related projects:



Agit (Android Git) Android Shuffle Bartab Bento CallerID
Cars.com CardStar ChessMates Crossfit Travel Crunchyroll
Digg GeoBeagle Getaways by Groupon Groupon Gymglish
LinkedIn Pulse Moola MOTOACTV MyEpisodes Manager Nike+
OpenTable TripIt! Skype Starbucks SwiftKey
TaskBomb Video to Facebook Wifi Syncr WorkTime Zynk

roboguice's People

Contributors

abombss avatar brodo avatar charlesmunger avatar donnfelker avatar emmby avatar gildegoma avatar johncarl81 avatar lbrasseur avatar marcab avatar mburton9 avatar mgurreta avatar mosabua avatar pyricau avatar serj-lotutovici avatar serso avatar sghill avatar stephanenicolas 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  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

roboguice's Issues

Broken links

Hi guys,
Please, fix the links on the wiki.

Cheers

@InjectFragment doesn't support android.app.Fragment

android.support.v4.app.Fragment is for supporting pre honeycomb android. Most of the handsets have android 4.0 now. Please support android.app.Fragment instead. Also, wiring up document should state that it requires android.support.v4 jar for Fragment support. I had to dig hard in the source code to find out.

Minimum SDK should be bumped to 4 or 5

There's not a consistent use of old/new APIs, and API level 3 isn't even on the dashboard of the play store because less than 0.1% of devices use it.

For example, there are places where Build.Version.SDK_INT is used to determine behavior - that's not even available in API level 3, so it'll crash.

Incorrect documentation about adding custom modules

https://github.com/emmby/roboguice/blob/master/roboguice/src/main/java/roboguice/RoboGuice.java#L68 states that you can add your own modules using RoboGuice.setAppliationInjector( app, RoboGuice.DEFAULT_STAGE, Modules.override(RoboGuice.newDefaultRoboModule(app)).with(new MyModule() ); first there is a typo in the method name but also the method signature doesn't seem to exist. This leaves new users a bit in the dark as how to add a custom module.

Either the comment should be correct or the method signature should be added so that the comment actually works.

DialogFragmentHelper - An easy way to show RoboDialogFragments

Guys what if Roboguice include something like this? It is based on the Github Android App, a helper class that helps to show Injected RoboDialogFragments, something like this:

public abstract class DialogFragmentHelper extends RoboDialogFragment {
    private static final String TAG = "dialog_fragment_helper";

    public static void show(FragmentActivity activity, RoboDialogFragment fragment, Bundle arguments) {
        FragmentManager manager = activity.getSupportFragmentManager();
        FragmentTransaction transaction = manager.beginTransaction();
        Fragment current = manager.findFragmentByTag(TAG);
        if (current != null) {
            transaction.remove(current);
            //transaction.addToBackStack(null);
            transaction.commit();
        }
        if(fragment.getArguments() == null) {
           fragment.setArguments(arguments);
        }else {
           fragment.getArguments().putAll(arguments);
        }
        fragment.show(manager, TAG);
    }

}

To use simple inject a RoboDialogFragment and use it:

public class MyRoboFragment extends RoboFragment...

@Inject
 private ProgressDialogFragment progressDialog;

 private void createProgressDialog(int resId) {
    Bundle arguments = new Bundle();
    arguments.putString(ProgressDialogFragment.MESSAGE, getString(resId));
    DialogFragmentHelper.show(getActivity(), progressDialog, arguments);
}

Could the Logging classes become standalone ?

Hi RoboGuicers, ;)

first, thanks for this great lib (and your good answers on stack over flow).

Second, do you think it would be possible to make the RoboGuice logging classes a separate standalone library ? I really enjoyed using it. I often use a derivative of your classes in my projects but I would love to see it more official...

Stéphane

WallpaperService support

I'm working on a Live Wallpaper and I didn't find a way to add RoboJuice to my project because I haven't an Activity, my main class is WallpaperService

Unable to extends to RoboActivity without exception

Hi, I'ms started with Roboguice.

I can't use your API because when I extends my Activity to RoboActivity, the program returns exceptions like that:

05-19 04:07:12.971: I/dalvikvm(30057): Failed resolving Lcom/google/inject/Provider; interface 1451 'Ljavax/inject/Provider;'
05-19 04:07:12.971: W/dalvikvm(30057): Link of class 'Lcom/google/inject/Provider;' failed
05-19 04:07:12.971: W/dalvikvm(30057): VFY: unable to find class referenced in signature (Lcom/google/inject/Provider;)
05-19 04:07:12.971: I/dalvikvm(30057): Failed resolving Lcom/google/inject/Provider; interface 1451 'Ljavax/inject/Provider;'
05-19 04:07:12.971: W/dalvikvm(30057): Link of class 'Lcom/google/inject/Provider;' failed
05-19 04:07:12.971: W/dalvikvm(30057): VFY: unable to find class referenced in signature (Lcom/google/inject/Provider;)
05-19 04:07:12.971: I/dalvikvm(30057): Failed resolving Lcom/google/inject/Provider; interface 1451 'Ljavax/inject/Provider;'
05-19 04:07:12.971: W/dalvikvm(30057): Link of class 'Lcom/google/inject/Provider;' failed
05-19 04:07:12.971: W/dalvikvm(30057): VFY: unable to find class referenced in signature (Lcom/google/inject/Provider;)
05-19 04:07:12.971: I/dalvikvm(30057): Failed resolving Lcom/google/inject/Provider; interface 1451 'Ljavax/inject/Provider;'
05-19 04:07:12.971: W/dalvikvm(30057): Link of class 'Lcom/google/inject/Provider;' failed
05-19 04:07:12.971: I/dalvikvm(30057): Failed resolving Lroboguice/inject/AssetManagerProvider; interface 638 'Lcom/google/inject/Provider;'
05-19 04:07:12.971: W/dalvikvm(30057): Link of class 'Lroboguice/inject/AssetManagerProvider;' failed
05-19 04:07:12.971: E/dalvikvm(30057): Could not find class 'roboguice.inject.AssetManagerProvider', referenced from method roboguice.config.DefaultRoboModule.configure
05-19 04:07:12.971: W/dalvikvm(30057): VFY: unable to resolve const-class 1512 (Lroboguice/inject/AssetManagerProvider;) in Lroboguice/config/DefaultRoboModule;
05-19 04:07:12.971: D/dalvikvm(30057): VFY: replacing opcode 0x1c at 0x0083
05-19 04:07:12.971: I/dalvikvm(30057): Failed resolving Lcom/google/inject/Provider; interface 1451 'Ljavax/inject/Provider;'
05-19 04:07:12.971: W/dalvikvm(30057): Link of class 'Lcom/google/inject/Provider;' failed
05-19 04:07:12.971: I/dalvikvm(30057): Failed resolving Lroboguice/inject/SystemServiceProvider; interface 638 'Lcom/google/inject/Provider;'
05-19 04:07:12.971: W/dalvikvm(30057): Link of class 'Lroboguice/inject/SystemServiceProvider;' failed
05-19 04:07:12.971: D/dalvikvm(30057): DexOpt: unable to opt direct call 0x2782 at 0x14a in Lroboguice/config/DefaultRoboModule;.configure
05-19 04:07:12.971: I/dalvikvm(30057): Failed resolving Lcom/google/inject/Provider; interface 1451 'Ljavax/inject/Provider;'
05-19 04:07:12.981: W/dalvikvm(30057): Link of class 'Lcom/google/inject/Provider;' failed
05-19 04:07:12.981: I/dalvikvm(30057): Failed resolving Lroboguice/inject/SystemServiceProvider; interface 638 'Lcom/google/inject/Provider;'
05-19 04:07:12.981: W/dalvikvm(30057): Link of class 'Lroboguice/inject/SystemServiceProvider;' failed
05-19 04:07:12.981: D/dalvikvm(30057): DexOpt: unable to opt direct call 0x2782 at 0x15a in Lroboguice/config/DefaultRoboModule;.configure
05-19 04:07:12.991: I/dalvikvm(30057): Failed resolving Lcom/google/inject/Provider; interface 1451 'Ljavax/inject/Provider;'
05-19 04:07:12.991: W/dalvikvm(30057): Link of class 'Lcom/google/inject/Provider;' failed
05-19 04:07:12.991: I/dalvikvm(30057): Failed resolving Lroboguice/inject/SystemServiceProvider; interface 638 'Lcom/google/inject/Provider;'
05-19 04:07:12.991: W/dalvikvm(30057): Link of class 'Lroboguice/inject/SystemServiceProvider;' failed
05-19 04:07:12.991: D/dalvikvm(30057): DexOpt: unable to opt direct call 0x2782 at 0x16a in Lroboguice/config/DefaultRoboModule;.configure
05-19 04:07:12.991: I/dalvikvm(30057): Failed resolving Lcom/google/inject/Provider; interface 1451 'Ljavax/inject/Provider;'
05-19 04:07:12.991: W/dalvikvm(30057): Link of class 'Lcom/google/inject/Provider;' failed
05-19 04:07:12.991: I/dalvikvm(30057): Failed resolving Lroboguice/inject/SystemServiceProvider; interface 638 'Lcom/google/inject/Provider;'
05-19 04:07:12.991: W/dalvikvm(30057): Link of class 'Lroboguice/inject/SystemServiceProvider;' failed
05-19 04:07:12.991: D/dalvikvm(30057): DexOpt: unable to opt direct call 0x2782 at 0x17a in Lroboguice/config/DefaultRoboModule;.configure
05-19 04:07:12.991: I/dalvikvm(30057): Failed resolving Lcom/google/inject/Provider; interface 1451 'Ljavax/inject/Provider;'
05-19 04:07:12.991: W/dalvikvm(30057): Link of class 'Lcom/google/inject/Provider;' failed
05-19 04:07:12.991: I/dalvikvm(30057): Failed resolving Lroboguice/inject/SystemServiceProvider; interface 638 'Lcom/google/inject/Provider;'
05-19 04:07:12.991: W/dalvikvm(30057): Link of class 'Lroboguice/inject/SystemServiceProvider;' failed
05-19 04:07:12.991: D/dalvikvm(30057): DexOpt: unable to opt direct call 0x2782 at 0x18a in Lroboguice/config/DefaultRoboModule;.configure
05-19 04:07:12.991: I/dalvikvm(30057): Failed resolving Lcom/google/inject/Provider; interface 1451 'Ljavax/inject/Provider;'
05-19 04:07:12.991: W/dalvikvm(30057): Link of class 'Lcom/google/inject/Provider;' failed
05-19 04:07:12.991: I/dalvikvm(30057): Failed resolving Lroboguice/inject/SystemServiceProvider; interface 638 'Lcom/google/inject/Provider;'
05-19 04:07:12.991: W/dalvikvm(30057): Link of class 'Lroboguice/inject/SystemServiceProvider;' failed
05-19 04:07:12.991: D/dalvikvm(30057): DexOpt: unable to opt direct call 0x2782 at 0x19a in Lroboguice/config/DefaultRoboModule;.configure
05-19 04:07:12.991: I/dalvikvm(30057): Failed resolving Lcom/google/inject/Provider; interface 1451 'Ljavax/inject/Provider;'
05-19 04:07:12.991: W/dalvikvm(30057): Link of class 'Lcom/google/inject/Provider;' failed
05-19 04:07:12.991: I/dalvikvm(30057): Failed resolving Lroboguice/inject/SystemServiceProvider; interface 638 'Lcom/google/inject/Provider;'
05-19 04:07:12.991: W/dalvikvm(30057): Link of class 'Lroboguice/inject/SystemServiceProvider;' failed
05-19 04:07:12.991: D/dalvikvm(30057): DexOpt: unable to opt direct call 0x2782 at 0x1aa in Lroboguice/config/DefaultRoboModule;.configure
05-19 04:07:12.991: I/dalvikvm(30057): Failed resolving Lcom/google/inject/Provider; interface 1451 'Ljavax/inject/Provider;'
05-19 04:07:12.991: W/dalvikvm(30057): Link of class 'Lcom/google/inject/Provider;' failed
05-19 04:07:12.991: I/dalvikvm(30057): Failed resolving Lroboguice/inject/SystemServiceProvider; interface 638 'Lcom/google/inject/Provider;'
05-19 04:07:12.991: W/dalvikvm(30057): Link of class 'Lroboguice/inject/SystemServiceProvider;' failed
05-19 04:07:12.991: D/dalvikvm(30057): DexOpt: unable to opt direct call 0x2782 at 0x1ba in Lroboguice/config/DefaultRoboModule;.configure
05-19 04:07:12.991: I/dalvikvm(30057): Failed resolving Lcom/google/inject/Provider; interface 1451 'Ljavax/inject/Provider;'
05-19 04:07:12.991: W/dalvikvm(30057): Link of class 'Lcom/google/inject/Provider;' failed
05-19 04:07:12.991: I/dalvikvm(30057): Failed resolving Lroboguice/inject/SystemServiceProvider; interface 638 'Lcom/google/inject/Provider;'
05-19 04:07:12.991: W/dalvikvm(30057): Link of class 'Lroboguice/inject/SystemServiceProvider;' failed
05-19 04:07:12.991: D/dalvikvm(30057): DexOpt: unable to opt direct call 0x2782 at 0x1ca in Lroboguice/config/DefaultRoboModule;.configure
05-19 04:07:12.991: I/dalvikvm(30057): Failed resolving Lcom/google/inject/Provider; interface 1451 'Ljavax/inject/Provider;'
05-19 04:07:12.991: W/dalvikvm(30057): Link of class 'Lcom/google/inject/Provider;' failed
05-19 04:07:12.991: I/dalvikvm(30057): Failed resolving Lroboguice/inject/SystemServiceProvider; interface 638 'Lcom/google/inject/Provider;'
05-19 04:07:12.991: W/dalvikvm(30057): Link of class 'Lroboguice/inject/SystemServiceProvider;' failed
05-19 04:07:13.001: D/dalvikvm(30057): DexOpt: unable to opt direct call 0x2782 at 0x1da in Lroboguice/config/DefaultRoboModule;.configure
05-19 04:07:13.001: I/dalvikvm(30057): Failed resolving Lcom/google/inject/Provider; interface 1451 'Ljavax/inject/Provider;'
05-19 04:07:13.001: W/dalvikvm(30057): Link of class 'Lcom/google/inject/Provider;' failed
05-19 04:07:13.001: I/dalvikvm(30057): Failed resolving Lroboguice/inject/SystemServiceProvider; interface 638 'Lcom/google/inject/Provider;'
05-19 04:07:13.001: W/dalvikvm(30057): Link of class 'Lroboguice/inject/SystemServiceProvider;' failed
05-19 04:07:13.001: D/dalvikvm(30057): DexOpt: unable to opt direct call 0x2782 at 0x1ea in Lroboguice/config/DefaultRoboModule;.configure
05-19 04:07:13.001: I/dalvikvm(30057): Failed resolving Lcom/google/inject/Provider; interface 1451 'Ljavax/inject/Provider;'
05-19 04:07:13.001: W/dalvikvm(30057): Link of class 'Lcom/google/inject/Provider;' failed
05-19 04:07:13.001: I/dalvikvm(30057): Failed resolving Lroboguice/inject/SystemServiceProvider; interface 638 'Lcom/google/inject/Provider;'
05-19 04:07:13.001: W/dalvikvm(30057): Link of class 'Lroboguice/inject/SystemServiceProvider;' failed
05-19 04:07:13.001: D/dalvikvm(30057): DexOpt: unable to opt direct call 0x2782 at 0x1fa in Lroboguice/config/DefaultRoboModule;.configure
05-19 04:07:13.001: I/dalvikvm(30057): Failed resolving Lcom/google/inject/Provider; interface 1451 'Ljavax/inject/Provider;'
05-19 04:07:13.001: W/dalvikvm(30057): Link of class 'Lcom/google/inject/Provider;' failed
05-19 04:07:13.001: I/dalvikvm(30057): Failed resolving Lroboguice/inject/SystemServiceProvider; interface 638 'Lcom/google/inject/Provider;'
05-19 04:07:13.001: W/dalvikvm(30057): Link of class 'Lroboguice/inject/SystemServiceProvider;' failed
05-19 04:07:13.001: D/dalvikvm(30057): DexOpt: unable to opt direct call 0x2782 at 0x20a in Lroboguice/config/DefaultRoboModule;.configure
05-19 04:07:13.001: I/dalvikvm(30057): Failed resolving Lcom/google/inject/Provider; interface 1451 'Ljavax/inject/Provider;'
05-19 04:07:13.001: W/dalvikvm(30057): Link of class 'Lcom/google/inject/Provider;' failed
05-19 04:07:13.001: I/dalvikvm(30057): Failed resolving Lroboguice/inject/SystemServiceProvider; interface 638 'Lcom/google/inject/Provider;'
05-19 04:07:13.001: W/dalvikvm(30057): Link of class 'Lroboguice/inject/SystemServiceProvider;' failed
05-19 04:07:13.001: D/dalvikvm(30057): DexOpt: unable to opt direct call 0x2782 at 0x21a in Lroboguice/config/DefaultRoboModule;.configure
05-19 04:07:13.001: I/dalvikvm(30057): Failed resolving Lcom/google/inject/Provider; interface 1451 'Ljavax/inject/Provider;'
05-19 04:07:13.001: W/dalvikvm(30057): Link of class 'Lcom/google/inject/Provider;' failed
05-19 04:07:13.001: I/dalvikvm(30057): Failed resolving Lroboguice/inject/ContextScopedSystemServiceProvider; interface 638 'Lcom/google/inject/Provider;'
05-19 04:07:13.001: W/dalvikvm(30057): Link of class 'Lroboguice/inject/ContextScopedSystemServiceProvider;' failed
05-19 04:07:13.001: D/dalvikvm(30057): DexOpt: unable to opt direct call 0x2744 at 0x22a in Lroboguice/config/DefaultRoboModule;.configure
05-19 04:07:13.001: I/dalvikvm(30057): Failed resolving Lcom/google/inject/Provider; interface 1451 'Ljavax/inject/Provider;'
05-19 04:07:13.001: W/dalvikvm(30057): Link of class 'Lcom/google/inject/Provider;' failed
05-19 04:07:13.001: I/dalvikvm(30057): Failed resolving Lroboguice/inject/ContextScopedSystemServiceProvider; interface 638 'Lcom/google/inject/Provider;'
05-19 04:07:13.001: W/dalvikvm(30057): Link of class 'Lroboguice/inject/ContextScopedSystemServiceProvider;' failed
05-19 04:07:13.001: D/dalvikvm(30057): DexOpt: unable to opt direct call 0x2744 at 0x23a in Lroboguice/config/DefaultRoboModule;.configure
05-19 04:07:13.011: I/dalvikvm(30057): Failed resolving Lcom/google/inject/Provider; interface 1451 'Ljavax/inject/Provider;'
05-19 04:07:13.011: W/dalvikvm(30057): Link of class 'Lcom/google/inject/Provider;' failed
05-19 04:07:13.011: W/dalvikvm(30057): VFY: unable to find class referenced in signature (Lcom/google/inject/Provider;)
05-19 04:07:13.011: I/dalvikvm(30057): Failed resolving Lcom/google/inject/Provider; interface 1451 'Ljavax/inject/Provider;'
05-19 04:07:13.011: W/dalvikvm(30057): Link of class 'Lcom/google/inject/Provider;' failed
05-19 04:07:13.011: I/dalvikvm(30057): Failed resolving Lroboguice/inject/ContextScope$1; interface 638 'Lcom/google/inject/Provider;'
05-19 04:07:13.011: W/dalvikvm(30057): Link of class 'Lroboguice/inject/ContextScope$1;' failed
05-19 04:07:13.011: E/dalvikvm(30057): Could not find class 'roboguice.inject.ContextScope$1', referenced from method roboguice.inject.ContextScope.scope
05-19 04:07:13.011: W/dalvikvm(30057): VFY: unable to resolve new-instance 1516 (Lroboguice/inject/ContextScope$1;) in Lroboguice/inject/ContextScope;
05-19 04:07:13.011: D/dalvikvm(30057): VFY: replacing opcode 0x22 at 0x0000
05-19 04:07:13.011: I/dalvikvm(30057): Failed resolving Lcom/google/inject/Provider; interface 1451 'Ljavax/inject/Provider;'
05-19 04:07:13.011: W/dalvikvm(30057): Link of class 'Lcom/google/inject/Provider;' failed
05-19 04:07:13.011: I/dalvikvm(30057): Failed resolving Lroboguice/inject/ContextScope$1; interface 638 'Lcom/google/inject/Provider;'
05-19 04:07:13.011: W/dalvikvm(30057): Link of class 'Lroboguice/inject/ContextScope$1;' failed
05-19 04:07:13.011: D/dalvikvm(30057): DexOpt: unable to opt direct call 0x2724 at 0x02 in Lroboguice/inject/ContextScope;.scope
05-19 04:07:13.011: E/dalvikvm(30057): Could not find class 'javax.inject.Provider', referenced from method com.google.inject.internal.MoreTypes.canonicalizeForKey
05-19 04:07:13.011: W/dalvikvm(30057): VFY: unable to resolve const-class 1451 (Ljavax/inject/Provider;) in Lcom/google/inject/internal/MoreTypes;
05-19 04:07:13.011: D/dalvikvm(30057): VFY: replacing opcode 0x1c at 0x0021
05-19 04:07:13.011: D/AndroidRuntime(30057): Shutting down VM
05-19 04:07:13.011: W/dalvikvm(30057): threadid=1: thread exiting with uncaught exception (group=0x40aa4210)
05-19 04:07:13.021: E/AndroidRuntime(30057): FATAL EXCEPTION: main
05-19 04:07:13.021: E/AndroidRuntime(30057): java.lang.NoClassDefFoundError: javax.inject.Provider
05-19 04:07:13.021: E/AndroidRuntime(30057):    at com.google.inject.internal.MoreTypes.canonicalizeForKey(MoreTypes.java:81)
05-19 04:07:13.021: E/AndroidRuntime(30057):    at com.google.inject.Key.<init>(Key.java:119)
05-19 04:07:13.021: E/AndroidRuntime(30057):    at com.google.inject.Key.get(Key.java:212)
05-19 04:07:13.021: E/AndroidRuntime(30057):    at roboguice.inject.ContextScope.enter(ContextScope.java:87)
05-19 04:07:13.021: E/AndroidRuntime(30057):    at roboguice.inject.ContextScope.<init>(ContextScope.java:61)
05-19 04:07:13.021: E/AndroidRuntime(30057):    at roboguice.RoboGuice.newDefaultRoboModule(RoboGuice.java:163)
05-19 04:07:13.021: E/AndroidRuntime(30057):    at roboguice.RoboGuice.setBaseApplicationInjector(RoboGuice.java:120)
05-19 04:07:13.021: E/AndroidRuntime(30057):    at roboguice.RoboGuice.getBaseApplicationInjector(RoboGuice.java:59)
05-19 04:07:13.021: E/AndroidRuntime(30057):    at roboguice.RoboGuice.getInjector(RoboGuice.java:149)
05-19 04:07:13.021: E/AndroidRuntime(30057):    at roboguice.activity.RoboActivity.onCreate(RoboActivity.java:76)
05-19 04:07:13.021: E/AndroidRuntime(30057):    at com.app.express.activity.Login.onCreate(Login.java:65)
05-19 04:07:13.021: E/AndroidRuntime(30057):    at android.app.Activity.performCreate(Activity.java:4465)
05-19 04:07:13.021: E/AndroidRuntime(30057):    at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1049)
05-19 04:07:13.021: E/AndroidRuntime(30057):    at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:1931)
05-19 04:07:13.021: E/AndroidRuntime(30057):    at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:1992)
05-19 04:07:13.021: E/AndroidRuntime(30057):    at android.app.ActivityThread.access$600(ActivityThread.java:127)
05-19 04:07:13.021: E/AndroidRuntime(30057):    at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1158)
05-19 04:07:13.021: E/AndroidRuntime(30057):    at android.os.Handler.dispatchMessage(Handler.java:99)
05-19 04:07:13.021: E/AndroidRuntime(30057):    at android.os.Looper.loop(Looper.java:137)
05-19 04:07:13.021: E/AndroidRuntime(30057):    at android.app.ActivityThread.main(ActivityThread.java:4441)
05-19 04:07:13.021: E/AndroidRuntime(30057):    at java.lang.reflect.Method.invokeNative(Native Method)
05-19 04:07:13.021: E/AndroidRuntime(30057):    at java.lang.reflect.Method.invoke(Method.java:511)
05-19 04:07:13.021: E/AndroidRuntime(30057):    at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:823)
05-19 04:07:13.021: E/AndroidRuntime(30057):    at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:590)
05-19 04:07:13.021: E/AndroidRuntime(30057):    at dalvik.system.NativeStart.main(Native Method)

If I use other extends like Activity, it's works.
I use guice 3.0 no-aop and roboguice 2.0

Can't create views when testing with Robolectric 2.0

I can't test my activities. No views can be instantiated with Robolectric's RobolectricTestRunner. I get the following errors

Tests run: 1, Failures: 0, Errors: 1, Skipped: 0, Time elapsed: 2.129 sec <<< FAILURE!
testAttemptsLoginWhenSignInButtonIsClicked(com.clearc2.HomeActivityTest) Time elapsed: 2.121 sec <<< ERROR!
java.lang.RuntimeException: Failed to create a android.widget.EditText
at org.robolectric.res.builder.LayoutBuilder.constructView(LayoutBuilder.java:182)
at org.robolectric.res.builder.LayoutBuilder.create(LayoutBuilder.java:109)
at org.robolectric.res.builder.LayoutBuilder.doInflate(LayoutBuilder.java:42)
at org.robolectric.res.builder.LayoutBuilder.doInflate(LayoutBuilder.java:45)
at org.robolectric.res.builder.LayoutBuilder.doInflate(LayoutBuilder.java:45)
at org.robolectric.res.builder.LayoutBuilder.doInflate(LayoutBuilder.java:45)
at org.robolectric.res.builder.LayoutBuilder.inflateView(LayoutBuilder.java:62)
at org.robolectric.shadows.ShadowLayoutInflater.inflate(ShadowLayoutInflater.java:50)
at org.robolectric.shadows.ShadowLayoutInflater.inflate(ShadowLayoutInflater.java:55)
at android.view.LayoutInflater.inflate(LayoutInflater.java)
at org.robolectric.tester.android.view.RoboWindow.setContentView(RoboWindow.java:80)
at org.robolectric.shadows.ShadowActivity.setContentView(ShadowActivity.java:265)
at android.app.Activity.setContentView(Activity.java)
at com.clearc2.HomeActivity.onCreate(HomeActivity.java:38)
at android.app.Activity.performCreate(Activity.java:5008)
at org.fest.reflect.method.Invoker.invoke(Invoker.java:112)
at org.robolectric.util.ActivityController$1.run(ActivityController.java:111)
at org.robolectric.util.ActivityController.runPaused(ActivityController.java:195)
at org.robolectric.util.ActivityController.create(ActivityController.java:106)
at org.robolectric.util.ActivityController.create(ActivityController.java:117)
at com.clearc2.HomeActivityTest.setUp(HomeActivityTest.java:21)
at org.junit.runners.model.FrameworkMethod$1.runReflectiveCall(FrameworkMethod.java:44)
at org.junit.internal.runners.model.ReflectiveCallable.run(ReflectiveCallable.java:15)
at org.junit.runners.model.FrameworkMethod.invokeExplosively(FrameworkMethod.java:41)
at org.junit.internal.runners.statements.RunBefores.evaluate(RunBefores.java:27)
at org.junit.internal.runners.statements.RunAfters.evaluate(RunAfters.java:31)
at org.robolectric.RobolectricTestRunner$2.evaluate(RobolectricTestRunner.java:246)
at org.junit.runners.BlockJUnit4ClassRunner.runNotIgnored(BlockJUnit4ClassRunner.java:79)
at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:71)
at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:49)
at org.junit.runners.ParentRunner$3.run(ParentRunner.java:193)
at org.junit.runners.ParentRunner$1.schedule(ParentRunner.java:52)
at org.junit.runners.ParentRunner.runChildren(ParentRunner.java:191)
at org.junit.runners.ParentRunner.access$000(ParentRunner.java:42)
at org.junit.runners.ParentRunner$2.evaluate(ParentRunner.java:184)
at org.robolectric.RobolectricTestRunner$1.evaluate(RobolectricTestRunner.java:181)
at org.junit.runners.ParentRunner.run(ParentRunner.java:236)
at org.apache.maven.surefire.junit4.JUnit4TestSet.execute(JUnit4TestSet.java:59)
at org.apache.maven.surefire.suite.AbstractDirectoryTestSuite.executeTestSet(AbstractDirectoryTestSuite.java:120)
at org.apache.maven.surefire.suite.AbstractDirectoryTestSuite.execute(AbstractDirectoryTestSuite.java:103)
at org.apache.maven.surefire.Surefire.run(Surefire.java:169)
at org.apache.maven.surefire.booter.SurefireBooter.runSuitesInProcess(SurefireBooter.java:350)
at org.apache.maven.surefire.booter.SurefireBooter.main(SurefireBooter.java:1021)
Caused by: java.lang.reflect.InvocationTargetException
at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:57)
at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45)
at java.lang.reflect.Constructor.newInstance(Constructor.java:525)
at org.robolectric.res.builder.LayoutBuilder.constructView(LayoutBuilder.java:167)
at org.robolectric.res.builder.LayoutBuilder.create(LayoutBuilder.java:109)
at org.robolectric.res.builder.LayoutBuilder.doInflate(LayoutBuilder.java:42)
at org.robolectric.res.builder.LayoutBuilder.doInflate(LayoutBuilder.java:45)
at org.robolectric.res.builder.LayoutBuilder.doInflate(LayoutBuilder.java:45)
at org.robolectric.res.builder.LayoutBuilder.doInflate(LayoutBuilder.java:45)
at org.robolectric.res.builder.LayoutBuilder.inflateView(LayoutBuilder.java:62)
at org.robolectric.shadows.ShadowLayoutInflater.inflate(ShadowLayoutInflater.java:50)
at org.robolectric.shadows.ShadowLayoutInflater.inflate(ShadowLayoutInflater.java:55)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:601)
at org.robolectric.bytecode.ShadowWrangler$ShadowMethodPlan.run(ShadowWrangler.java:440)
at android.view.LayoutInflater.inflate(LayoutInflater.java)
at org.robolectric.tester.android.view.RoboWindow.setContentView(RoboWindow.java:80)
at org.robolectric.shadows.ShadowActivity.setContentView(ShadowActivity.java:265)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:601)
at org.robolectric.bytecode.ShadowWrangler$ShadowMethodPlan.run(ShadowWrangler.java:440)
at android.app.Activity.setContentView(Activity.java)
at com.clearc2.HomeActivity.onCreate(HomeActivity.java:38)
at android.app.Activity.$$robo$$Activity_c57b_performCreate(Activity.java:5008)
at android.app.Activity.performCreate(Activity.java)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:601)
at org.fest.reflect.method.Invoker.invoke(Invoker.java:112)
at org.robolectric.util.ActivityController$1.run(ActivityController.java:111)
at org.robolectric.util.ActivityController.runPaused(ActivityController.java:195)
at org.robolectric.util.ActivityController.create(ActivityController.java:106)
at org.robolectric.util.ActivityController.create(ActivityController.java:117)
at com.clearc2.HomeActivityTest.setUp(HomeActivityTest.java:21)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:601)
at org.junit.runners.model.FrameworkMethod$1.runReflectiveCall(FrameworkMethod.java:44)
at org.junit.internal.runners.model.ReflectiveCallable.run(ReflectiveCallable.java:15)
at org.junit.runners.model.FrameworkMethod.invokeExplosively(FrameworkMethod.java:41)
at org.junit.internal.runners.statements.RunBefores.evaluate(RunBefores.java:27)
at org.junit.internal.runners.statements.RunAfters.evaluate(RunAfters.java:31)
at org.robolectric.RobolectricTestRunner$2.evaluate(RobolectricTestRunner.java:246)
at org.junit.runners.BlockJUnit4ClassRunner.runNotIgnored(BlockJUnit4ClassRunner.java:79)
at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:71)
at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:49)
at org.junit.runners.ParentRunner$3.run(ParentRunner.java:193)
at org.junit.runners.ParentRunner$1.schedule(ParentRunner.java:52)
at org.junit.runners.ParentRunner.runChildren(ParentRunner.java:191)
at org.junit.runners.ParentRunner.access$000(ParentRunner.java:42)
at org.junit.runners.ParentRunner$2.evaluate(ParentRunner.java:184)
at org.robolectric.RobolectricTestRunner$1.evaluate(RobolectricTestRunner.java:181)
at org.junit.runners.ParentRunner.run(ParentRunner.java:236)
at org.apache.maven.surefire.junit4.JUnit4TestSet.execute(JUnit4TestSet.java:59)
at org.apache.maven.surefire.suite.AbstractDirectoryTestSuite.executeTestSet(AbstractDirectoryTestSuite.java:120)
at org.apache.maven.surefire.suite.AbstractDirectoryTestSuite.execute(AbstractDirectoryTestSuite.java:103)
at org.apache.maven.surefire.Surefire.run(Surefire.java:169)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:601)
... 2 more
Caused by: java.lang.NumberFormatException: For input string: "@0"
at java.lang.NumberFormatException.forInputString(NumberFormatException.java:65)
at java.lang.Integer.parseInt(Integer.java:492)
at com.android.internal.util.XmlUtils.convertValueToInt(XmlUtils.java:123)
at android.content.res.TypedArray.getInt(TypedArray.java:254)
at android.widget.TextView.constructor(TextView.java:827)
at android.widget.TextView.(TextView.java:447)
at android.widget.EditText.(EditText.java:60)
at android.widget.EditText.(EditText.java:56)
at org.robolectric.res.builder.LayoutBuilder.constructView(LayoutBuilder.java:167)
at org.robolectric.res.builder.LayoutBuilder.create(LayoutBuilder.java:109)
at org.robolectric.res.builder.LayoutBuilder.doInflate(LayoutBuilder.java:42)
at org.robolectric.res.builder.LayoutBuilder.doInflate(LayoutBuilder.java:45)
at org.robolectric.res.builder.LayoutBuilder.doInflate(LayoutBuilder.java:45)
at org.robolectric.res.builder.LayoutBuilder.doInflate(LayoutBuilder.java:45)
at org.robolectric.res.builder.LayoutBuilder.inflateView(LayoutBuilder.java:62)
at org.robolectric.shadows.ShadowLayoutInflater.inflate(ShadowLayoutInflater.java:50)
at org.robolectric.shadows.ShadowLayoutInflater.inflate(ShadowLayoutInflater.java:55)
at android.view.LayoutInflater.inflate(LayoutInflater.java)
at org.robolectric.tester.android.view.RoboWindow.setContentView(RoboWindow.java:80)
at org.robolectric.shadows.ShadowActivity.setContentView(ShadowActivity.java:265)
at android.app.Activity.setContentView(Activity.java)
at com.clearc2.HomeActivity.onCreate(HomeActivity.java:38)
at android.app.Activity.performCreate(Activity.java:5008)
at org.fest.reflect.method.Invoker.invoke(Invoker.java:112)
at org.robolectric.util.ActivityController$1.run(ActivityController.java:111)
at org.robolectric.util.ActivityController.runPaused(ActivityController.java:195)
at org.robolectric.util.ActivityController.create(ActivityController.java:106)
at org.robolectric.util.ActivityController.create(ActivityController.java:117)
at com.clearc2.HomeActivityTest.setUp(HomeActivityTest.java:21)
at org.junit.runners.model.FrameworkMethod$1.runReflectiveCall(FrameworkMethod.java:44)
at org.junit.internal.runners.model.ReflectiveCallable.run(ReflectiveCallable.java:15)
at org.junit.runners.model.FrameworkMethod.invokeExplosively(FrameworkMethod.java:41)
at org.junit.internal.runners.statements.RunBefores.evaluate(RunBefores.java:27)
at org.junit.internal.runners.statements.RunAfters.evaluate(RunAfters.java:31)
at org.robolectric.RobolectricTestRunner$2.evaluate(RobolectricTestRunner.java:246)
at org.junit.runners.BlockJUnit4ClassRunner.runNotIgnored(BlockJUnit4ClassRunner.java:79)
at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:71)
at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:49)
at org.junit.runners.ParentRunner$3.run(ParentRunner.java:193)
at org.junit.runners.ParentRunner$1.schedule(ParentRunner.java:52)
at org.junit.runners.ParentRunner.runChildren(ParentRunner.java:191)
at org.junit.runners.ParentRunner.access$000(ParentRunner.java:42)
at org.junit.runners.ParentRunner$2.evaluate(ParentRunner.java:184)
at org.robolectric.RobolectricTestRunner$1.evaluate(RobolectricTestRunner.java:181)
at org.junit.runners.ParentRunner.run(ParentRunner.java:236)
at org.apache.maven.surefire.junit4.JUnit4TestSet.execute(JUnit4TestSet.java:59)
at org.apache.maven.surefire.suite.AbstractDirectoryTestSuite.executeTestSet(AbstractDirectoryTestSuite.java:120)
at org.apache.maven.surefire.suite.AbstractDirectoryTestSuite.execute(AbstractDirectoryTestSuite.java:103)
at org.apache.maven.surefire.Surefire.run(Surefire.java:169)
... 2 more

Roboguice

Hi,

is there a way to set up custom module for Android Instrumentation testing?
and is there a way to inject singletons to test case in order to test their state?

NullPointerException when starting a RoboService

I'm getting a NullPointerException in the onStart() method because eventManager is null. onCreate() is not executed before onStart().
According to this post the methods are both called asynchronously. I don't really know what to do about this as I'm new to the codebase and this whole Android thing...

I hope someone has an idea how to fix this.

Problems when trying to use support library v13

Worked around this by extending the android.app.Fragment instance in my fragments instead of RoboFragment and manually injecting.

/**
 * {@inheritDoc}
 */
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container,
        Bundle savedInstanceState) {
    View view = inflater.inflate(R.layout.home, container, false);

    // NB: I know this isn't ideal it is part of a system to work around the
    // roboguice dependency on v4 of the support API when I wish to use the 
    // real Fragment objects.
    // NB: Cannot use @InjectViews as a result of this decision due to 
    // no call to inject view members with correct Fragment.
    Application app = getActivity().getApplication();
    RoboInjector injector = RoboGuice.getInjector(app);
    injector.injectMembers(this);

    return view;
}

The only problem is that I can no longer use @InjectView and this is not as nice as simply extending a class.

Thoughts?

On Tuesday, 9 July 2013 13:35:20 UTC+8, Jeremy Connor wrote:
I am using support v13 and associated Fragment classes and want to continue using Roboguice; however the roboguice classes depend on the v4 view of the Fragment API which isn't appropriate when dealing with the android.app fragment abstraction instead of the v4 support version.

Any suggestions which will allow me to continue using roboguice and also using v13 of the support library?

You received this message because you are subscribed to the Google Groups "roboguice" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [email protected].
To post to this group, send email to [email protected].
Visit this group at http://groups.google.com/group/roboguice.
For more options, visit https://groups.google.com/groups/opt_out.

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.