Android:活动未在清单中注册

ott*_*uit 5 android runtimeexception android-activity

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

<application
    android:description="@string/app_description"
    android:icon="@drawable/icon"
    android:label="@string/app_name"
    android:theme="@android:style/Theme.Light" >
    <activity
        android:name="com.xyz.Main.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>
Run Code Online (Sandbox Code Playgroud)

Lint 工具告诉我我的活动没有在清单中注册,如果我尝试运行它,LogCat 会告诉我:

java.lang.RuntimeException: Unable to instantiate activity ComponentInfo{com.name/com.xyz.Main.MainActivity}: java.lang.ClassNotFoundException: com.xyz.Main.MainActivity

这让我抓狂,我重新安装了 Eclipse 并将 SDK 和其他东西更新到 API 级别 17,现在我似乎无法执行我自己的应用程序。我完全不知道这里到底出了什么问题,显然该活动在 manifest.xml 中完全注册。

提前致谢。

ott*_*uit 3

我已经找到解决办法了 今天,我感到有足够的动力再次参与这个项目,并尝试将该项目移植到 Linux 发行版(这使我得出结论,Linux 对于 Android 开发人员来说是一个痛苦的事情),并将其集成到“行”中。 by line”到一个新的 Android 项目。

我曾经使用某些常量和值(例如 0x00 表示“可见”)来实现字符串和整数接口。不幸的是,Android 似乎在接口和活动类方面存在问题。删除接口并对常量进行静态引用使模拟器解决了这个问题。

public class MyActivity extends Activity implements Options // [...]
Btn.setVisibility(VISIBLE); // bad idea

public class MyActivity extends Activity // [...]
Btn.setVisibility(Options.VISIBLE); // good idea
Run Code Online (Sandbox Code Playgroud)

希望这至少能帮助寻找这个问题的人。