您的位置:首页 > 编程语言 > Java开发

eclipse with android : Didn't find class "com.xx.xx.MainActivity" on path: DexPathList

2017-05-06 23:25 691 查看
近几天为

java.lang.RuntimeException: 

Unable to instantiate activity ComponentInfo{com.flocash.nfcpay/com.xx.xx.MainActivity}: java.lang.ClassNotFoundException:

Didn't find class "com.xx.xx.MainActivity" on path: DexPathList

的事情烦恼;找了很多资料,比如这哥们的,包括stackoverflow。他们都让查看manifest,检查其正确性:

<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.xx.xx"
android:versionCode="1"
android:versionName="1.0" >
<application
android:allowBackup="true"
android:icon="@drawable/ic_launcher"
android:label="@string/app_name"
android:theme="@style/AppTheme" >
<activity
android:name="com.xx.xx.MainActivity"
android:label="@string/app_name"
android:screenOrientation="portrait" >
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
</application>
</manifest>

查看MainActivity的包名称是否和上的一致:

src\main\java\com\xx\xx\MainActivity.java

package com.xx.xx;

public class MainActivity extends Activity

但是实际上没解决;后来在ask.csdn 上找到了答案,虽然题主没采纳:

Properties>Java Build Path>Order and export 中的android-support-v4.jar选中



拷贝apache-maven-3.3.3\repository\android\android\4.4.2_r4\android-4.4.2_r4.jar

到项目根目录的libs下面(如果没有libs,新建立个)

通过项目属性->Java Build Path->Libraries->Add External JARS

导入项目,然后在Order and export 中勾选即可
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签:  class MainActivity o
相关文章推荐