启动app后ClassNotFoundException

时间:2015-09-22 15:16:40

标签: android eclipse classnotfoundexception runtimeexception appcompat-v7-r21

启动我的应用程序时,我得到这个LogCat:

func generate(length: Int, allowedChars: [String]) -> [String] {
    if length == 1 {
        return allowedChars
    }
    else {
        let subStrings = generate(length - 1, allowedChars: allowedChars)

        var arr = [String]()
        for c in allowedChars {
            for sub in subStrings {
                arr.append(c + sub)
            }
        }

        return arr
    }
}

println(generate(3, allowedChars: ["a", "b", "c"]))

我不会发布代码,因为我知道代码没有发生。

有什么想法吗?

P.S: 我在扩展09-22 18:07:04.487: E/AndroidRuntime(16352): FATAL EXCEPTION: main 09-22 18:07:04.487: E/AndroidRuntime(16352): Process: com.ip.whatsmyip.dl, PID: 16352 09-22 18:07:04.487: E/AndroidRuntime(16352): java.lang.RuntimeException: Unable to instantiate activity ComponentInfo{com.ip.whatsmyip.dl/com.ip.whatsmyip.dl.MainActivity}: java.lang.ClassNotFoundException: Didn't find class "com.ip.whatsmyip.dl.MainActivity" on path: DexPathList[[zip file "/data/app/com.ip.whatsmyip.dl-2/base.apk"],nativeLibraryDirectories=[/vendor/lib, /system/lib]] 09-22 18:07:04.487: E/AndroidRuntime(16352): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2216) 09-22 18:07:04.487: E/AndroidRuntime(16352): at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2367) 09-22 18:07:04.487: E/AndroidRuntime(16352): at android.app.ActivityThread.access$800(ActivityThread.java:148) 09-22 18:07:04.487: E/AndroidRuntime(16352): at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1283) 09-22 18:07:04.487: E/AndroidRuntime(16352): at android.os.Handler.dispatchMessage(Handler.java:102) 09-22 18:07:04.487: E/AndroidRuntime(16352): at android.os.Looper.loop(Looper.java:135) 09-22 18:07:04.487: E/AndroidRuntime(16352): at android.app.ActivityThread.main(ActivityThread.java:5274) 09-22 18:07:04.487: E/AndroidRuntime(16352): at java.lang.reflect.Method.invoke(Native Method) 09-22 18:07:04.487: E/AndroidRuntime(16352): at java.lang.reflect.Method.invoke(Method.java:372) 09-22 18:07:04.487: E/AndroidRuntime(16352): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:909) 09-22 18:07:04.487: E/AndroidRuntime(16352): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:704) 09-22 18:07:04.487: E/AndroidRuntime(16352): Caused by: java.lang.ClassNotFoundException: Didn't find class "com.ip.whatsmyip.dl.MainActivity" on path: DexPathList[[zip file "/data/app/com.ip.whatsmyip.dl-2/base.apk"],nativeLibraryDirectories=[/vendor/lib, /system/lib]] 09-22 18:07:04.487: E/AndroidRuntime(16352): at dalvik.system.BaseDexClassLoader.findClass(BaseDexClassLoader.java:56) 09-22 18:07:04.487: E/AndroidRuntime(16352): at java.lang.ClassLoader.loadClass(ClassLoader.java:511) 09-22 18:07:04.487: E/AndroidRuntime(16352): at java.lang.ClassLoader.loadClass(ClassLoader.java:469) 09-22 18:07:04.487: E/AndroidRuntime(16352): at android.app.Instrumentation.newActivity(Instrumentation.java:1065) 09-22 18:07:04.487: E/AndroidRuntime(16352): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2206) 09-22 18:07:04.487: E/AndroidRuntime(16352): ... 10 more 09-22 18:07:04.487: E/AndroidRuntime(16352): Suppressed: java.lang.NoClassDefFoundError: com.ip.whatsmyip.dl.MainActivity 09-22 18:07:04.487: E/AndroidRuntime(16352): at dalvik.system.DexFile.defineClassNative(Native Method) 09-22 18:07:04.487: E/AndroidRuntime(16352): at dalvik.system.DexFile.defineClass(DexFile.java:226) 09-22 18:07:04.487: E/AndroidRuntime(16352): at dalvik.system.DexFile.loadClassBinaryName(DexFile.java:219) 09-22 18:07:04.487: E/AndroidRuntime(16352): at dalvik.system.DexPathList.findClass(DexPathList.java:321) 09-22 18:07:04.487: E/AndroidRuntime(16352): at dalvik.system.BaseDexClassLoader.findClass(BaseDexClassLoader.java:54) 09-22 18:07:04.487: E/AndroidRuntime(16352): ... 14 more 09-22 18:07:04.487: E/AndroidRuntime(16352): Suppressed: java.lang.ClassNotFoundException: com.ip.whatsmyip.dl.MainActivity 方面遇到了一些问题,这使得我通过File - Import on eclipse对应用程序进行了一些导入。

修改 的AndroidManifest.xml:

AppCompatActivity

1 个答案:

答案 0 :(得分:1)

经过MD和Aakash的大量努力,我们决定从eclipse中删除此应用程序并复制粘贴代码。 它有所帮助。

谢谢你们。