我正在尝试使用 RoboGuice 2 启动并运行,我已将guice-3.0-no_aop、roboguice-2.0和jsr305-1.3.9 jar 添加到项目类路径中,但是当我尝试下面给出的代码时出现以下异常:
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>
有人可以帮我理解吗?
谢谢。
编辑:我正在使用带有 Android 开发工具的 Android API 17。