gpt4 book ai didi

java - Android 无法实例化 Activity : Didn't find class on path

转载 作者:搜寻专家 更新时间:2023-10-30 21:04:48 25 4
gpt4 key购买 nike

我已经将项目导入到 eclipse 中,当我尝试运行它时,抛出了这个异常:

java.lang.RuntimeException: 无法实例化 Activity ComponentInfo{com.polygraf/com.polygraf.activity.Dashboard}: java.lang.ClassNotFoundException: 没有找到类 "com.polygraf.activity.Dashboard "在路径上:/data/app/com.polygraf-1.apk

我已经尝试清理项目,然后检查所有类名和 list 是否正常,但仍然找不到发生这种情况的原因。你能帮我一点吗?

仪表板类:

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);

}
.
.
.
}

和 list 文件:

<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。您的 Activity 没有问题,但 Eclipse 没有在 APK 中包含支持包...如果您查看堆栈跟踪中的错误上方,您会注意到问题的根源:“Unable to find FragmentActivity ”。或者您可以解压 apk,取消索引,您会看到不包含兼容包类。

要解决此问题,请右键单击您的项目、属性、构建路径并转到导出选项卡。确保选中“Android private libraries”。清理和重建应该让你走上正轨......

关于java - Android 无法实例化 Activity : Didn't find class on path,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/17273218/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com