机器人无法实例活动

机器人无法实例活动

本文介绍了机器人无法实例活动:没有找到路径类的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我已经导入项目到Eclipse,当我尝试运行它,那么这将引发异常:

I've imported project into eclipse and when I try to run it, then this exception is thrown:

了java.lang.RuntimeException:无法实例活动ComponentInfo {com.polygraf / com.polygraf.activity.Dashboard}:抛出java.lang.ClassNotFoundException:没有找到类com.polygraf。 activity.Dashboard的路径:/data/app/com.polygraf-1.apk

我试图清理的项目,然后检查是否所有的类名和表现都OK,但仍无法找到为什么发生这种情况。你能帮我一点好吗?

I've tried to clean the project, then check if all class names and manifest are ok, but still can't find why this happens. Can you help me a little please?

Dashbard类:

Dashbard class:

public class Dashboard extends FragmentActivity {

private static final String WELCOME_TYPE = "WELCOME_TYPE";
private static final String HELP_TYPE = "HELP_TYPE";

public static final String ADRESS_CONTENT = "ADRESS_CONTENT";
public static final String DOC_NAME = "DOC_NAME";

private Transcript mContent;
private ISettableContent mListOfDocument;

private String mAddress;

private String mDocName;

public Dashboard() {
}

/** Called with the activity is first created. */
@Override
public void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.dashboard);

    boolean content = false;
    // View gc = (NoSaveStateFrameLayout)
    // findViewById(R.id.content_fragment);
    //

    Fragment frContent = getSupportFragmentManager().findFragmentById(R.id.content_fragment);
    mContent = ((IGetContent) frContent).getContent();
    TranscriptSetting cc = Polygraf.getInstance().getContentSetting();

    Fragment frDocumentsList = getSupportFragmentManager().findFragmentById(R.id.documents);
    mListOfDocument = (ISettableContent) frDocumentsList;
    cc.registerContent(mListOfDocument);

    if (getIntent().hasExtra(ADRESS_CONTENT)) {
        mAddress = getIntent().getStringExtra(ADRESS_CONTENT);
        mDocName = getIntent().getStringExtra(DOC_NAME);
        mContent.setAddress(mAddress, mDocName);
        content = true;
    } else if (getIntent().hasExtra(WELCOME_TYPE)) {
        content = true;
        prepareVisibilityBtnTranscript();
    } else if (getIntent().hasExtra(HELP_TYPE)) {
        content = true;
        mContent.showHelp();

    }

    if (content) {
        FragmentTransaction ft = getSupportFragmentManager().beginTransaction();
        ft.hide(frDocumentsList);
        ft.commit();

        // because on diferent layouts for small and large device
        // some views missing, so the test is inportant
        View contentLayout = findViewById(R.id.contentLayout);
        if (contentLayout != null) {
            contentLayout.setVisibility(View.VISIBLE);
        }
        prepareVisibilityBtnWelcome();
        // cp.setContent(mContent);
    }

    cc.registerContent(mContent);
    // cp.setListener(cc);

}
    .
    .
    .
}

和清单文件:

<uses-permission android:name="android.permission.INTERNET" />
<uses-permission android:name="android.permission.CHANGE_WIFI_MULTICAST_STATE" />
<uses-permission android:name="android.permission.ACCESS_WIFI_STATE" />

<uses-sdk
    android:minSdkVersion="7"
    android:targetSdkVersion="17" />

<application
    android:name=".Polygraf"
    android:allowBackup="true"
    android:hardwareAccelerated="true"
    android:icon="@drawable/icon"
    android:label="@string/skeleton_app"
    android:theme="@android:style/Theme.Black.NoTitleBar" >
    <activity
        android:name="com.polygraf.activity.Dashboard"
        android:configChanges="orientation|keyboard" >
        <intent-filter>
            <action android:name="android.intent.action.MAIN" />

            <!-- This places this activity into the main app list. -->
            <category android:name="android.intent.category.LAUNCHER" />
        </intent-filter>
    </activity>
    <activity
        android:name="com.polygraf.activity.SettingActivity"
        android:label="@string/skeleton_app" />
    <activity
        android:name="com.polygraf.activity.ContentActivity"
        android:label="@string/skeleton_app" >
    </activity>
    <activity
        android:name="com.polygraf.activity.PlayVideo"
        android:configChanges="orientation|keyboard"
        android:label="@string/skeleton_app" />
</application>

推荐答案

我想你是使用Eclipse。你的活动是有好的,但是Eclipse没有包括的支持包中的APK ......如果你看看上面的堆栈跟踪你的错误,你会发现你的问题的根源:找不到FragmentActivity 。或者你可以解开APK,其水下爆炸,你会看到不包括兼容包中的类。

I suppose you're using Eclipse. Your activity is there alright, but Eclipse didn't include the support package in the APK ... If you look above your error in stacktrace you will notice the root of your problem: "Unable to find FragmentActivity". Or you can unpack the apk, undex it and you will see the compatibility package classes were not included.

要解决此问题,用鼠标右键单击您的项目,属性,构建路径,去出口标签。有确保 Android的私人图书馆进行检查。干净,重建应该把你的轨道上......

To fix this, right-click your project, properties, build path and go to export tab. There make sure "Android private libraries" are checked. A clean and rebuild should put you on track ...

这篇关于机器人无法实例活动:没有找到路径类的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

08-20 14:07