我已经在Eclipse中创建了示例androID项目,但在执行命令时却遇到错误:活动类{com.example.best/com.example.best.MainActivity}不存在.
但是项目中存在MainActivity类
package com.example.best;import androID.os.Bundle;import androID.app.Activity;import androID.vIEw.Menu;public class MainActivity extends Activity { @OverrIDe protected voID onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentVIEw(R.layout.activity_main); } @OverrIDe public boolean onCreateOptionsMenu(Menu menu) { // Inflate the menu; this adds items to the action bar if it is present. getMenuInflater().inflate(R.menu.main, menu); return true; }}
以下是控制台上打印的错误消息
[2015-03-01 22:01:58 - best] Starting activity com.example.best.MainActivity on device EAAZCY30C637[2015-03-01 22:01:59 - best] New package not yet registered with the system. Waiting 3 seconds before next attempt.[2015-03-01 22:02:02 - best] Starting activity com.example.best.MainActivity on device EAAZCY30C637[2015-03-01 22:02:02 - best] New package not yet registered with the system. Waiting 3 seconds before next attempt.[2015-03-01 22:02:05 - best] Starting activity com.example.best.MainActivity on device EAAZCY30C637[2015-03-01 22:02:05 - best] New package not yet registered with the system. Waiting 3 seconds before next attempt.[2015-03-01 22:02:08 - best] Starting activity com.example.best.MainActivity on device EAAZCY30C637[2015-03-01 22:02:08 - best] New package not yet registered with the system. Waiting 3 seconds before next attempt.[2015-03-01 22:02:11 - best] Starting activity com.example.best.MainActivity on device EAAZCY30C637[2015-03-01 22:02:12 - best] ActivityManager: Starting: Intent { act=androID.intent.action.MAIN cat=[androID.intent.category.LAUNCHER] cmp=com.example.best/.MainActivity }[2015-03-01 22:02:12 - best] ActivityManager: Error type 3[2015-03-01 22:02:12 - best] ActivityManager: Error: Activity class {com.example.best/com.example.best.MainActivity} does not exist.
这是我的清单文件的内容
<?xml version="1.0" enCoding="utf-8"?><manifest xmlns:androID="http://schemas.androID.com/apk/res/androID" package="com.example.best" androID:versionCode="1" androID:versionname="1.0" > <uses-sdk androID:minSdkVersion="8" androID:targetSdkVersion="18" /> <application androID:allowBackup="true" androID:icon="@drawable/ic_launcher" androID:label="@string/app_name" androID:theme="@style/Apptheme" > <activity androID:name="com.example.best.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>
我应该怎么做才能解决这个问题
解决方法:
您的样本中没有错误.我已经在我的机器上对其进行了测试,并且工作正常.
请尝试以下步骤.
项目->清洁
如果不起作用,请尝试创建新的工作区.
总结以上是内存溢出为你收集整理的执行Android项目“活动类不存在”时出错.全部内容,希望文章能够帮你解决执行Android项目“活动类不存在”时出错.所遇到的程序开发问题。
如果觉得内存溢出网站内容还不错,欢迎将内存溢出网站推荐给程序员好友。
欢迎分享,转载请注明来源:内存溢出
评论列表(0条)