这是一个简单的应用程序,带有一个Activity类,用于显示可能的SVG。它已经在真实设备(NEXUS 4)上进行了测试。在周五。较小的变化不会影响主要类别的显示。

现在我花了几个小时获取:ClassNotFoundException
我检查了结果APK和DEX文件-包括此类。

任何建议和提示将不胜感激。

08-04 16:10:52.957: E/AndroidRuntime(352): java.lang.RuntimeException: Unable to instantiate activity ComponentInfo{com.example.svgdisplaypinchtest/com.example.svgdisplaypinchtest.SVGDisplayPinchActivity}: java.lang.ClassNotFoundException: Didn't find class "com.example.svgdisplaypinchtest.SVGDisplayPinchActivity" on path: DexPathList[[zip file "/data/app/com.example.svgdisplaypinchtest-1.apk"],nativeLibraryDirectories=[/data/app-lib/com.example.svgdisplaypinchtest-1, /vendor/lib, /system/lib]]
08-04 16:10:52.957: E/AndroidRuntime(352):  at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2110)
08-04 16:10:52.957: E/AndroidRuntime(352):  at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2233)
08-04 16:10:52.957: E/AndroidRuntime(352):  at android.app.ActivityThread.access$800(ActivityThread.java:135)
08-04 16:10:52.957: E/AndroidRuntime(352):  at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1196)
08-04 16:10:52.957: E/AndroidRuntime(352):  at android.os.Handler.dispatchMessage(Handler.java:102)
08-04 16:10:52.957: E/AndroidRuntime(352):  at android.os.Looper.loop(Looper.java:136)
08-04 16:10:52.957: E/AndroidRuntime(352):  at android.app.ActivityThread.main(ActivityThread.java:5001)
08-04 16:10:52.957: E/AndroidRuntime(352):  at java.lang.reflect.Method.invokeNative(Native Method)
08-04 16:10:52.957: E/AndroidRuntime(352):  at java.lang.reflect.Method.invoke(Method.java:515)
08-04 16:10:52.957: E/AndroidRuntime(352):  at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:785)
08-04 16:10:52.957: E/AndroidRuntime(352):  at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:601)
08-04 16:10:52.957: E/AndroidRuntime(352):  at dalvik.system.NativeStart.main(Native Method)
08-04 16:10:52.957: E/AndroidRuntime(352): Caused by: java.lang.ClassNotFoundException: Didn't find class "com.example.svgdisplaypinchtest.SVGDisplayPinchActivity" on path: DexPathList[[zip file "/data/app/com.example.svgdisplaypinchtest-1.apk"],nativeLibraryDirectories=[/data/app-lib/com.example.svgdisplaypinchtest-1, /vendor/lib, /system/lib]]
08-04 16:10:52.957: E/AndroidRuntime(352):  at dalvik.system.BaseDexClassLoader.findClass(BaseDexClassLoader.java:56)
08-04 16:10:52.957: E/AndroidRuntime(352):  at java.lang.ClassLoader.loadClass(ClassLoader.java:497)
08-04 16:10:52.957: E/AndroidRuntime(352):  at java.lang.ClassLoader.loadClass(ClassLoader.java:457)
08-04 16:10:52.957: E/AndroidRuntime(352):  at android.app.Instrumentation.newActivity(Instrumentation.java:1061)
08-04 16:10:52.957: E/AndroidRuntime(352):  at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2101)
08-04 16:10:52.957: E/AndroidRuntime(352):  ... 11 more


编辑:感谢您有关清单的问题。关于清洁和重建等。我做了很多次...
这是清单:

<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.example.svgdisplaypinchtest"
android:versionCode="1"
android:versionName="1.0" >

<uses-sdk
    android:minSdkVersion="11"
    android:targetSdkVersion="20" />

<application
    android:allowBackup="true"
    android:icon="@drawable/ic_launcher"
    android:label="@string/app_name"
    android:theme="@style/AppTheme" >
    <activity
        android:name=".SVGDisplayPinchActivity"
        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>

最佳答案

问题用粗鲁的方法解决了。
只需将所有文件复制到安全文件夹即可。
从Eclipse中删除项目(带有文件!)。
将它们作为项目导入(从上述“安全文件夹”)。

07-26 07:27