gpt4 book ai didi

Android:无法实例化 Activity ComponentInfo

转载 作者:行者123 更新时间:2023-11-29 00:29:22 28 4
gpt4 key购买 nike

我在开发 Android 应用程序时遇到问题。我首先对我的错误进行了研究,然后发现还有其他人和我有同样的问题。我阅读了所有评论并尝试了所有方法,但我仍然遇到同样的错误。

这里是我的错误

05-29 12:39:36.701: E/AndroidRuntime(823): java.lang.RuntimeException: Unable to instantiate activity ComponentInfo{com.georgepanayi.mixfmcyprus.radio/com.georgepanayi.mixfmcyprus.radio.Main_Activity}: java.lang.ClassNotFoundException: Didn't find class "com.georgepanayi.mixfmcyprus.radio.Main_Activity" on path: /data/app/com.georgepanayi.mixfmcyprus.radio-1.apk
05-29 12:39:36.701: E/AndroidRuntime(823): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2106)
05-29 12:39:36.701: E/AndroidRuntime(823): at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2230)
05-29 12:39:36.701: E/AndroidRuntime(823): at android.app.ActivityThread.access$600(ActivityThread.java:141)
05-29 12:39:36.701: E/AndroidRuntime(823): at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1234)
05-29 12:39:36.701: E/AndroidRuntime(823): at android.os.Handler.dispatchMessage(Handler.java:99)
05-29 12:39:36.701: E/AndroidRuntime(823): at android.os.Looper.loop(Looper.java:137)
05-29 12:39:36.701: E/AndroidRuntime(823): at android.app.ActivityThread.main(ActivityThread.java:5041)
05-29 12:39:36.701: E/AndroidRuntime(823): at java.lang.reflect.Method.invokeNative(Native Method)
05-29 12:39:36.701: E/AndroidRuntime(823): at java.lang.reflect.Method.invoke(Method.java:511)
05-29 12:39:36.701: E/AndroidRuntime(823): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:793)
05-29 12:39:36.701: E/AndroidRuntime(823): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:560)
05-29 12:39:36.701: E/AndroidRuntime(823): at dalvik.system.NativeStart.main(Native Method)
05-29 12:39:36.701: E/AndroidRuntime(823): Caused by: java.lang.ClassNotFoundException: Didn't find class "com.georgepanayi.mixfmcyprus.radio.Main_Activity" on path: /data/app/com.georgepanayi.mixfmcyprus.radio-1.apk
05-29 12:39:36.701: E/AndroidRuntime(823): at dalvik.system.BaseDexClassLoader.findClass(BaseDexClassLoader.java:65)
05-29 12:39:36.701: E/AndroidRuntime(823): at java.lang.ClassLoader.loadClass(ClassLoader.java:501)
05-29 12:39:36.701: E/AndroidRuntime(823): at java.lang.ClassLoader.loadClass(ClassLoader.java:461)
05-29 12:39:36.701: E/AndroidRuntime(823): at android.app.Instrumentation.newActivity(Instrumentation.java:1054)
05-29 12:39:36.701: E/AndroidRuntime(823): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2097)
05-29 12:39:36.701: E/AndroidRuntime(823): ... 11 more

我读到问题出在 list 上的 Activity ,这是我的类(class)和 list 类

package com.georgepanayi.mixfmcyprus.radio;

import org.holoeverywhere.app.Activity;

import android.os.Bundle;

public class Main_Activity extends Activity {

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

}

list

<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.georgepanayi.mixfmcyprus.radio"
android:versionCode="1"
android:versionName="1.0" >

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

<application
android:allowBackup="true"
android:icon="@drawable/ic_launcher"
android:label="@string/app_name"
android:theme="@style/Theme.Mixfmradio" >
<activity
android:name=".Main_Activity"
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>

此外,我还在使用 Holoeverywhere、SherlockActionBar 4.3.1 和 ViewPagerIndicator 2.4.1 等库

谁能找到问题所在?

谢谢

最佳答案

问题出在 Holoeverywhere。为了解决这个问题,我所做的是转到我的项目的属性 -> Java 构建路径 -> 排序和导出,然后选择选项 android private libraries。然后我在 list 中的标签内添加了 android:name="org.holoeverywhere.app.Application"。

关于Android:无法实例化 Activity ComponentInfo,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/16810628/

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