Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Android - Setting up Roboguice 2.0?

I started a new project (In Eclipse classic), added roboguice-2.0.jar guice-2.0-no-aop.jar and jsr305-1.3.9.jar to my project and my build path.

The first step is to extend RoboApplication, but eclipse cannot find the matching package for this class. I looked at the source and the package for roboguice is roboguice.application.RoboApplication which does not exist. There is no application under roboguice in my project.

What am I missing?

like image 656
aryaxt Avatar asked Jul 12 '12 05:07

aryaxt


2 Answers

So, frustratingly, the roboguice library development has outpaced its documentation. There is no RoboApplication class in the new libary.

Instead you should remove that file and create a roboguice.xml file in your values that points to your custom robo module:

<?xml version="1.0" encoding="utf-8"?>
  <resources> 
    <string-array name="roboguice_modules">
    <item>com.mypackage.MyModule</item>
  </string-array>
</resources>

Also if you were using AbstractAndroidModule or RoboModule for your module code it is now called AbstractModule.

like image 56
JasonOfEarth Avatar answered Oct 19 '22 16:10

JasonOfEarth


If you are using RoboGuice 2 you should be using Guice 3 and not Guice 2!!! There is quite a bit of documentation available on the wiki. Specifically check out

http://code.google.com/p/roboguice/wiki/InstallationNonMaven

http://code.google.com/p/roboguice/wiki/UpgradingTo20

like image 35
Manfred Moser Avatar answered Oct 19 '22 16:10

Manfred Moser