0

I am trying to get myself up and running with RoboGuice 2 and I have added guice-3.0-no_aop, roboguice-2.0 and jsr305-1.3.9 jars into the projects classpath but I am getting following exception when I try the code given below:

E/AndroidRuntime(1143): java.lang.RuntimeException: Unable to instantiate activity 
ComponentInfo{com.wickedlynotsmart.myfirstapp/com.wickedlynotsmart.myfirstapp.acti
vity.MainActivity}: java.lang.ClassNotFoundException: Didn't find class 
"com.wickedlynotsmart.myfirstapp.activity.MainActivity" on path: 
/data/app/com.wickedlynotsmart.myfirstapp-2.apk

MainActivity.java

public class MainActivity extends RoboActivity {

    @InjectView(R.id.helloTextView)
    private TextView helloTextView;

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_main);

        helloTextView.setText("Hello, My First App!");
    }

    //...     

}

MyFirstAppModule.java

public class MyFirstAppModule extends AbstractModule{

    @Override
    protected void configure() {
        // TODO Auto-generated method stub      
    }

}

roboguice.xml

<?xml version="1.0" encoding="utf-8"?>
<resources>
    <string-array name="roboguice_modules">
        <item>com.wickedlynotsmart.myfirstapp.module.MyFirstAppModule</item>
    </string-array>    
</resources>

Could someone help me understand with it?

Thanks.

EDIT: I am using Android API 17 with Android Development Tool.

skip
  • 12,193
  • 32
  • 113
  • 153

2 Answers2

1

Removed guice-3.0-no_aop, roboguice-2.0 and jsr305-1.3.9 jars from project's build path.

Adding following jars to libs folder inside the project got the project working:

1. roboguice-2.0.jar
2. guice-3.0-no_aop.jar
3. javax.inject.jar
skip
  • 12,193
  • 32
  • 113
  • 153
0

There is a problem with the ADT. I tried Roboguice on both ADT with Android Development Toolkit v22 and Eclipse JUNO with Android Development Toolkit v21.It worked in Eclipse JUNO with ADT v21.

In ADT i put the jar files to libs folder and i get ClassNotFoundException. In Eclipse JUNO, when i put the jar files to libs folder, it automatically creates and puts the jar files under Android Dependencies. This doesnt happen in ADT.

Adding jar files to build path didnt work either.

Murat
  • 3,084
  • 37
  • 55
  • 1
    Adding `roboguice-2.0.jar`, `guice-3.0-no_aop.jar` and `javax.inject.jar` into the `libs` folder worked just fine for me for both ADT package 21 and 22. – skip Jun 05 '13 at 15:39