相机在教程课程中在Nexus 7上崩溃

时间:2014-03-18 00:09:07

标签: camera crash android-camera

开始玩相机,我遇到了这个教程http://www.tutorialspoint.com/android/android_camera.htm

我只是复制并粘贴了第一个教程中的代码,并试图在我的Nexus 7(KitKat)和HTC欲望S上运行它。

在两个系统上它立即崩溃....

因为我是Android的新手,我不明白这是什么问题。

我发布了LogCat。

抱歉它太大了。

    03-18 00:43:27.378: D/AndroidRuntime(397): Shutting down VM
    03-18 00:43:27.378: W/dalvikvm(397): threadid=1: thread exiting with uncaught     exception (group=0x41585ba8)
    03-18 00:43:27.378: E/AndroidRuntime(397): FATAL EXCEPTION: main
    03-18 00:43:27.378: E/AndroidRuntime(397): Process: com.example.cameratest, PID: 397
    03-18 00:43:27.378: E/AndroidRuntime(397): java.lang.RuntimeException: Unable to  instantiate activity    ComponentInfo{com.example.cameratest/com.example.camera.MainActivity}:  java.lang.ClassNotFoundException: Didn't find class "com.example.camera.MainActivity" on path: DexPathList[[zip file "/data/app/com.example.cameratest-2.apk"],nativeLibraryDirectories=[/data/app-lib/com.example.cameratest-2, /vendor/lib, /system/lib]]
    03-18 00:43:27.378: E/AndroidRuntime(397):  at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2121)
   03-18 00:43:27.378: E/AndroidRuntime(397):   at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2245)
   03-18 00:43:27.378: E/AndroidRuntime(397):   at android.app.ActivityThread.access$800(ActivityThread.java:135)
   03-18 00:43:27.378: E/AndroidRuntime(397):   at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1196)
   03-18 00:43:27.378: E/AndroidRuntime(397):   at android.os.Handler.dispatchMessage(Handler.java:102)
       03-18 00:43:27.378: E/AndroidRuntime(397):   at android.os.Looper.loop(Looper.java:136)
   03-18 00:43:27.378: E/AndroidRuntime(397):   at android.app.ActivityThread.main(ActivityThread.java:5017)
   03-18 00:43:27.378: E/AndroidRuntime(397):   at java.lang.reflect.Method.invokeNative(Native Method)
  03-18 00:43:27.378: E/AndroidRuntime(397):    at java.lang.reflect.Method.invoke(Method.java:515)
   03-18 00:43:27.378: E/AndroidRuntime(397):   at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:779)
    03-18 00:43:27.378: E/AndroidRuntime(397):  at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:595)
     03-18 00:43:27.378: E/AndroidRuntime(397):     at dalvik.system.NativeStart.main(Native Method)
    03-18 00:43:27.378: E/AndroidRuntime(397): Caused by: java.lang.ClassNotFoundException: Didn't find class "com.example.camera.MainActivity" on path: DexPathList[[zip file "/data/app/com.example.cameratest-2.apk"],nativeLibraryDirectories=[/data/app-lib/com.example.cameratest-2, /vendor/lib, /system/lib]]
   03-18 00:43:27.378: E/AndroidRuntime(397):   at dalvik.system.BaseDexClassLoader.findClass(BaseDexClassLoader.java:56)
    03-18 00:43:27.378: E/AndroidRuntime(397):  at java.lang.ClassLoader.loadClass(ClassLoader.java:497)
   03-18 00:43:27.378: E/AndroidRuntime(397):   at java.lang.ClassLoader.loadClass(ClassLoader.java:457)
  03-18 00:43:27.378: E/AndroidRuntime(397):    at android.app.Instrumentation.newActivity(Instrumentation.java:1061)
      03-18 00:43:27.378: E/AndroidRuntime(397):    at  03-18 00:43:27.378: E/AndroidRuntime(397):  ... 11 more
    03-18 00:44:16.516: I/Process(397): Sending signal. PID: 397 SIG: 9
      03-18 00:48:29.342: D/AndroidRuntime(775): Shutting down VM
  03-18 00:48:29.342: W/dalvikvm(775): threadid=1: thread exiting with uncaught exception (group=0x41585ba8)
   03-18 00:48:29.342: E/AndroidRuntime(775): FATAL EXCEPTION: main
   03-18 00:48:29.342: E/AndroidRuntime(775): Process: com.example.cameratest, PID: 775
    03-18 00:48:29.342: E/AndroidRuntime(775): java.lang.RuntimeException: Unable to instantiate activity ComponentInfo{com.example.cameratest/com.example.camera.MainActivity}: java.lang.ClassNotFoundException: Didn't find class "com.example.camera.MainActivity" on path: DexPathList[[zip file "/data/app/com.example.cameratest-1.apk"],nativeLibraryDirectories=[/data/app-lib/com.example.cameratest-1, /vendor/lib, /system/lib]]
    03-18 00:48:29.342: E/AndroidRuntime(775):  at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2121)
   03-18 00:48:29.342: E/AndroidRuntime(775):   at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2245)
   03-18 00:48:29.342: E/AndroidRuntime(775):   at android.app.ActivityThread.access$800(ActivityThread.java:135)
     03-18 00:48:29.342: E/AndroidRuntime(775):     at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1196)
     03-18 00:48:29.342: E/AndroidRuntime(775):     at android.os.Handler.dispatchMessage(Handler.java:102)
     03-18 00:48:29.342: E/AndroidRuntime(775):     at android.os.Looper.loop(Looper.java:136)
     03-18 00:48:29.342: E/AndroidRuntime(775):     at android.app.ActivityThread.main(ActivityThread.java:5017)
     03-18 00:48:29.342: E/AndroidRuntime(775):     at java.lang.reflect.Method.invokeNative(Native Method)
     03-18 00:48:29.342: E/AndroidRuntime(775):     at java.lang.reflect.Method.invoke(Method.java:515)
     03-18 00:48:29.342: E/AndroidRuntime(775):     at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:779)
     03-18 00:48:29.342: E/AndroidRuntime(775):     at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:595)
     03-18 00:48:29.342: E/AndroidRuntime(775):     at dalvik.system.NativeStart.main(Native Method)
     03-18 00:48:29.342: E/AndroidRuntime(775): Caused by: java.lang.ClassNotFoundException: Didn't find class "com.example.camera.MainActivity" on path: DexPathList[[zip file "/data/app/com.example.cameratest-1.apk"],nativeLibraryDirectories=[/data/app-lib/com.example.cameratest-1, /vendor/lib, /system/lib]]
     03-18 00:48:29.342: E/AndroidRuntime(775):     at dalvik.system.BaseDexClassLoader.findClass(BaseDexClassLoader.java:56)
     03-18 00:48:29.342: E/AndroidRuntime(775):     at java.lang.ClassLoader.loadClass(ClassLoader.java:497)
     03-18 00:48:29.342: E/AndroidRuntime(775):     at java.lang.ClassLoader.loadClass(ClassLoader.java:457)
     03-18 00:48:29.342: E/AndroidRuntime(775):     at android.app.Instrumentation.newActivity(Instrumentation.java:1061)
     03-18 00:48:29.342: E/AndroidRuntime(775):     at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2112)
     03-18 00:48:29.342: E/AndroidRuntime(775):     ... 11 more
     03-18 00:55:12.846: D/AndroidRuntime(1050): Shutting down VM
     03-18 00:55:12.846: W/dalvikvm(1050): threadid=1: thread exiting with uncaught exception (group=0x41585ba8)
     03-18 00:55:12.856: E/AndroidRuntime(1050): FATAL EXCEPTION: main
     03-18 00:55:12.856: E/AndroidRuntime(1050): Process: com.example.cameratest, PID: 1050
     03-18 00:55:12.856: E/AndroidRuntime(1050): java.lang.RuntimeException: Unable to instantiate activity ComponentInfo{com.example.cameratest/com.example.camera.MainActivity}: java.lang.ClassNotFoundException: Didn't find class "com.example.camera.MainActivity" on path: DexPathList[[zip file "/data/app/com.example.cameratest-1.apk"],nativeLibraryDirectories=[/data/app-lib/com.example.cameratest-1, /vendor/lib, /system/lib]]
     03-18 00:55:12.856: E/AndroidRuntime(1050):    at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2121)
     03-18 00:55:12.856: E/AndroidRuntime(1050):    at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2245)
     03-18 00:55:12.856: E/AndroidRuntime(1050):    at android.app.ActivityThread.access$800(ActivityThread.java:135)
     03-18 00:55:12.856: E/AndroidRuntime(1050):    at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1196)
     03-18 00:55:12.856: E/AndroidRuntime(1050):    at android.os.Handler.dispatchMessage(Handler.java:102)
     03-18 00:55:12.856: E/AndroidRuntime(1050):    at android.os.Looper.loop(Looper.java:136)
     03-18 00:55:12.856: E/AndroidRuntime(1050):    at android.app.ActivityThread.main(ActivityThread.java:5017)
     03-18 00:55:12.856: E/AndroidRuntime(1050):    at java.lang.reflect.Method.invokeNative(Native Method)
     03-18 00:55:12.856: E/AndroidRuntime(1050):    at java.lang.reflect.Method.invoke(Method.java:515)
     03-18 00:55:12.856: E/AndroidRuntime(1050):    at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:779)
     03-18 00:55:12.856: E/AndroidRuntime(1050):    at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:595)
     03-18 00:55:12.856: E/AndroidRuntime(1050):    at dalvik.system.NativeStart.main(Native Method)
     03-18 00:55:12.856: E/AndroidRuntime(1050): Caused by: java.lang.ClassNotFoundException: Didn't find class "com.example.camera.MainActivity" on path: DexPathList[[zip file "/data/app/com.example.cameratest-1.apk"],nativeLibraryDirectories=[/data/app-lib/com.example.cameratest-1, /vendor/lib, /system/lib]]
     03-18 00:55:12.856: E/AndroidRuntime(1050):    at dalvik.system.BaseDexClassLoader.findClass(BaseDexClassLoader.java:56)
     03-18 00:55:12.856: E/AndroidRuntime(1050):    at java.lang.ClassLoader.loadClass(ClassLoader.java:497)
     03-18 00:55:12.856: E/AndroidRuntime(1050):    at java.lang.ClassLoader.loadClass(ClassLoader.java:457)
     03-18 00:55:12.856: E/AndroidRuntime(1050):    at android.app.Instrumentation.newActivity(Instrumentation.java:1061)
     03-18 00:55:12.856: E/AndroidRuntime(1050):    at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2112)
     03-18 00:55:12.856: E/AndroidRuntime(1050):    ... 11 more
     03-18 00:55:52.625: D/AndroidRuntime(1145): Shutting down VM
     03-18 00:55:52.625: W/dalvikvm(1145): threadid=1: thread exiting with uncaught exception (group=0x41585ba8)
     03-18 00:55:52.625: E/AndroidRuntime(1145): FATAL EXCEPTION: main
     03-18 00:55:52.625: E/AndroidRuntime(1145): Process: com.example.cameratest, PID: 1145
     03-18 00:55:52.625: E/AndroidRuntime(1145): java.lang.RuntimeException: Unable to instantiate activity ComponentInfo{com.example.cameratest/com.example.camera.MainActivity}: java.lang.ClassNotFoundException: Didn't find class "com.example.camera.MainActivity" on path: DexPathList[[zip file "/data/app/com.example.cameratest-1.apk"],nativeLibraryDirectories=[/data/app-lib/com.example.cameratest-1, /vendor/lib, /system/lib]]
     03-18 00:55:52.625: E/AndroidRuntime(1145):    at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2121)
     03-18 00:55:52.625: E/AndroidRuntime(1145):    at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2245)
     03-18 00:55:52.625: E/AndroidRuntime(1145):    at android.app.ActivityThread.access$800(ActivityThread.java:135)
     03-18 00:55:52.625: E/AndroidRuntime(1145):    at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1196)
     03-18 00:55:52.625: E/AndroidRuntime(1145):    at android.os.Handler.dispatchMessage(Handler.java:102)
     03-18 00:55:52.625: E/AndroidRuntime(1145):    at android.os.Looper.loop(Looper.java:136)
     03-18 00:55:52.625: E/AndroidRuntime(1145):    at android.app.ActivityThread.main(ActivityThread.java:5017)
     03-18 00:55:52.625: E/AndroidRuntime(1145):    at java.lang.reflect.Method.invokeNative(Native Method)
     03-18 00:55:52.625: E/AndroidRuntime(1145):    at java.lang.reflect.Method.invoke(Method.java:515)
     03-18 00:55:52.625: E/AndroidRuntime(1145):    at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:779)
     03-18 00:55:52.625: E/AndroidRuntime(1145):    at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:595)
     03-18 00:55:52.625: E/AndroidRuntime(1145):    at dalvik.system.NativeStart.main(Native Method)
     03-18 00:55:52.625: E/AndroidRuntime(1145): Caused by: java.lang.ClassNotFoundException: Didn't find class "com.example.camera.MainActivity" on path: DexPathList[[zip file "/data/app/com.example.cameratest-1.apk"],nativeLibraryDirectories=[/data/app-lib/com.example.cameratest-1, /vendor/lib, /system/lib]]
     03-18 00:55:52.625: E/AndroidRuntime(1145):    at dalvik.system.BaseDexClassLoader.findClass(BaseDexClassLoader.java:56)
     03-18 00:55:52.625: E/AndroidRuntime(1145):    at java.lang.ClassLoader.loadClass(ClassLoader.java:497)
     03-18 00:55:52.625: E/AndroidRuntime(1145):    at java.lang.ClassLoader.loadClass(ClassLoader.java:457)
     03-18 00:55:52.625: E/AndroidRuntime(1145):    at android.app.Instrumentation.newActivity(Instrumentation.java:1061)
     03-18 00:55:52.625: E/AndroidRuntime(1145):    at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2112)
     03-18 00:55:52.625: E/AndroidRuntime(1145):    ... 11 more
     03-18 00:56:14.486: D/AndroidRuntime(1216): Shutting down VM
     03-18 00:56:14.486: W/dalvikvm(1216): threadid=1: thread exiting with uncaught exception (group=0x41585ba8)
     03-18 00:56:14.486: E/AndroidRuntime(1216): FATAL EXCEPTION: main
     03-18 00:56:14.486: E/AndroidRuntime(1216): Process: com.example.cameratest, PID: 1216
     03-18 00:56:14.486: E/AndroidRuntime(1216): java.lang.RuntimeException: Unable to instantiate activity ComponentInfo{com.example.cameratest/com.example.camera.MainActivity}: java.lang.ClassNotFoundException: Didn't find class "com.example.camera.MainActivity" on path: DexPathList[[zip file "/data/app/com.example.cameratest-1.apk"],nativeLibraryDirectories=[/data/app-lib/com.example.cameratest-1, /vendor/lib, /system/lib]]
     03-18 00:56:14.486: E/AndroidRuntime(1216):    at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2121)
     03-18 00:56:14.486: E/AndroidRuntime(1216):    at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2245)
     03-18 00:56:14.486: E/AndroidRuntime(1216):    at android.app.ActivityThread.access$800(ActivityThread.java:135)
     03-18 00:56:14.486: E/AndroidRuntime(1216):    at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1196)
     03-18 00:56:14.486: E/AndroidRuntime(1216):    at          android.os.Handler.dispatchMessage(Handler.java:102)
     03-18 00:56:14.486: E/AndroidRuntime(1216):    at android.os.Looper.loop(Looper.java:136)
     03-18 00:56:14.486: E/AndroidRuntime(1216):    at android.app.ActivityThread.main(ActivityThread.java:5017)
     03-18 00:56:14.486: E/AndroidRuntime(1216):    at java.lang.reflect.Method.invokeNative(Native Method)
     03-18 00:56:14.486: E/AndroidRuntime(1216):    at java.lang.reflect.Method.invoke(Method.java:515)
     03-18 00:56:14.486: E/AndroidRuntime(1216):    at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:779)
     03-18 00:56:14.486: E/AndroidRuntime(1216):    at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:595)
     03-18 00:56:14.486: E/AndroidRuntime(1216):    at dalvik.system.NativeStart.main(Native Method)
     03-18 00:56:14.486: E/AndroidRuntime(1216): Caused by: java.lang.ClassNotFoundException: Didn't find class "com.example.camera.MainActivity" on path: DexPathList[[zip file "/data/app/com.example.cameratest-1.apk"],nativeLibraryDirectories=[/data/app-lib/com.example.cameratest-1, /vendor/lib, /system/lib]]
     03-18 00:56:14.486: E/AndroidRuntime(1216):    at dalvik.system.BaseDexClassLoader.findClass(BaseDexClassLoader.java:56)
     03-18 00:56:14.486: E/AndroidRuntime(1216):    at java.lang.ClassLoader.loadClass(ClassLoader.java:497)
     03-18 00:56:14.486: E/AndroidRuntime(1216):    at java.lang.ClassLoader.loadClass(ClassLoader.java:457)
     03-18 00:56:14.486: E/AndroidRuntime(1216):    at android.app.Instrumentation.newActivity(Instrumentation.java:1061)
     03-18 00:56:14.486: E/AndroidRuntime(1216):    at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2112)
     03-18 00:56:14.486: E/AndroidRuntime(1216):    ... 11 more

还为Manifest添加了权限....

0 个答案:

没有答案