无法实例化活动+引起:java.lang.ClassNotFoundException:+ Suppressed:java.io.IOException:无法打开DEX文件

时间:2016-04-06 12:23:27

标签: android ipc

我遇到了ClassNotFound异常的问题,我认为这是一些包名称问题但不知道如何解决它。

java.lang.RuntimeException: Unable to instantiate activity ComponentInfo{com.starxsoft.estimatedusedpower/com.starxsoft.estimatedusedpower.MainBattEstimatedPowerActivity}: java.lang.ClassNotFoundException: Didn't find class "com.starxsoft.estimatedusedpower.MainBattEstimatedPowerActivity" on path: DexPathList[[zip file "/mnt/asec/com.starxsoft.estimatedusedpower-2/pkg.apk"],nativeLibraryDirectories=[/mnt/asec/com.starxsoft.estimatedusedpower-2/lib, /vendor/lib, /system/lib]]
    at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2264)
    at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2390)
    at android.app.ActivityThread.access$800(ActivityThread.java:151)
    at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1321)
    at android.os.Handler.dispatchMessage(Handler.java:110)
    at android.os.Looper.loop(Looper.java:193)
    at android.app.ActivityThread.main(ActivityThread.java:5299)
    at java.lang.reflect.Method.invokeNative(Native Method)
    at java.lang.reflect.Method.invoke(Method.java:515)
    at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:825)
    at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:641)
    at dalvik.system.NativeStart.main(Native Method)
Caused by: java.lang.ClassNotFoundException: Didn't find class "com.starxsoft.estimatedusedpower.MainBattEstimatedPowerActivity" on path: DexPathList[[zip file "/mnt/asec/com.starxsoft.estimatedusedpower-2/pkg.apk"],nativeLibraryDirectories=[/mnt/asec/com.starxsoft.estimatedusedpower-2/lib, /vendor/lib, /system/lib]]
    at dalvik.system.BaseDexClassLoader.findClass(BaseDexClassLoader.java:56)
    at java.lang.ClassLoader.loadClass(ClassLoader.java:497)
    at java.lang.ClassLoader.loadClass(ClassLoader.java:457)
    at android.app.Instrumentation.newActivity(Instrumentation.java:1061)
    at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2255)
    at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2390) 
    at android.app.ActivityThread.access$800(ActivityThread.java:151) 
    at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1321) 
    at android.os.Handler.dispatchMessage(Handler.java:110) 
    at android.os.Looper.loop(Looper.java:193) 
    at android.app.ActivityThread.main(ActivityThread.java:5299) 
    at java.lang.reflect.Method.invokeNative(Native Method) 
    at java.lang.reflect.Method.invoke(Method.java:515) 
    at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:825) 
    at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:641) 
    at dalvik.system.NativeStart.main(Native Method) 
Suppressed: java.io.IOException: unable to open DEX file
    at dalvik.system.DexFile.openDexFileNative(Native Method)

我已经清理过&重建项目和清单文件如下,包名称在mainfest和class中定义:

<?xml version="1.0" encoding="utf-8"?>
    <manifest package="com.starxsoft.estimatedusedpower"
        xmlns:android="http://schemas.android.com/apk/res/android">
        <uses-permission android:name="android.permission.ACCESS_FINE_LOCATION"/>
        <uses-permission android:name="android.permission.ACCESS_WIFI_STATE"/>
        <application
            android:allowBackup="true"
            android:icon="@mipmap/ic_launcher"
            android:label="@string/app_name"
            android:supportsRtl="true"
            android:theme="@style/AppTheme">
            <activity
                android:name=".MainBattEstimatedPowerActivity"
                android:label="@string/app_name"
                android:theme="@style/AppTheme.NoActionBar"
                android:screenOrientation="portrait">
                <intent-filter>
                    <action android:name="android.intent.action.MAIN"/>
                    <category android:name="android.intent.category.LAUNCHER"/>
                </intent-filter>
            </activity>

0 个答案:

没有答案