简单的Andr​​oid应用程序roboguice抛出异常 [英] Simple android application with roboguice throwing exceptions

查看:123
本文介绍了简单的Andr​​oid应用程序roboguice抛出异常的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个工作非常简单的应用程序,但是当我添加roboguice它抛出

I have a very simple application that works but when i add roboguice it throws

了java.lang.RuntimeException:无法实例化应用   com.MyFirstApp.MyFirstApplication:抛出java.lang.ClassNotFoundException:   com.MyFirstApp.MyFirstApplication

java.lang.RuntimeException: Unable to instantiate application com.MyFirstApp.MyFirstApplication: java.lang.ClassNotFoundException: com.MyFirstApp.MyFirstApplication

应用程序类:

public class MyFirstApplication extends RoboApplication {

    @Override
    protected void addApplicationModules(List<Module> modules) {
        //modules.add(new DefaultModule());
    }
}

在MainActivity:

The MainActivity:

public class MainActivity extends RoboActivity {

    @Override
    public void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.main);
    }
}

清单:

<manifest 
    xmlns:android="http://schemas.android.com/apk/res/android"
    package="com.MyFirstApp"
    android:versionCode="1"
    android:versionName="1.0" >

    <uses-sdk 
        android:minSdkVersion="14" />

    <application
        android:icon="@drawable/ic_launcher"
        android:label="@string/app_name"
        android:name="MyFirstApplication">
        <activity
            android:name="com.MyFirstApp.Activities.MainActivity"
            android:label="@string/app_name" >
            <intent-filter>
                <action 
                    android:name="android.intent.action.MAIN" />
                <category 
                    android:name="android.intent.category.LAUNCHER" />
            </intent-filter>
        </activity>
    </application>
</manifest>

我已经把吉斯-2.0-no_aop.jar和roboguice-1.1.3.jar的资产文件夹,并将它们添加到构建路径。

I have put guice-2.0-no_aop.jar and roboguice-1.1.3.jar in the assets folder and added them to the buildpath.

当我删除ROBO部分正常工作。谁能告诉我,我做错了什么。

when i remove the robo part it works fine. can anyone tell me what i did wrong.

推荐答案

嗯,我发现了什么问题。我使用SDK V17 +,并在该版本外部库的需要TE被放置在一个库文件夹,并只在libs文件夹。因此,所有的我发现,他们只是把它的资产文件夹中的教程在哪里错了。

Well i found out what the problem was. i was using SDK v17+ and in that version external library's need te be placed in a "libs" folder and only in the libs folder. so all the tutorial's i found where they just put it in the assets folder where wrong.

链接到那里我得到了我一直在寻找的答案:<一href="http://groups.google.com/group/roboguice/browse_thread/thread/474116b052050ae2">http://groups.google.com/group/roboguice/browse_thread/thread/474116b052050ae2

Link to where i got the answer i was looking for: http://groups.google.com/group/roboguice/browse_thread/thread/474116b052050ae2

这篇关于简单的Andr​​oid应用程序roboguice抛出异常的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆