2016-03-22 9 views
1
MediaProjectionManager manager = 
     (MediaProjectionManager) activity.getSystemService(MEDIA_PROJECTION_SERVICE); 
    Intent intent = manager.createScreenCaptureIntent(); 
    activity.startActivityForResult(intent, CREATE_SCREEN_CAPTURE); 

dies mein Code und ich erhalte die folgenden Fehlerjava.lang.NoClassDefFoundError: android.media.projection.MediaProjectionManager

03-22 07:52:02.271 14831-14831/? E/dalvikvm: Could not find class 'android.media.projection.MediaProjectionManager', referenced from method com.zennaxx.marshmallowscreenrecorder.CaptureHelper.fireScreenCaptureIntent 
03-22 07:52:02.371 14831-14831/? E/AndroidRuntime: FATAL EXCEPTION: main 
03-22 07:52:02.371 14831-14831/? E/AndroidRuntime: Process: com.zennaxx.marshmallowscreenrecorder, PID: 14831 
03-22 07:52:02.371 14831-14831/? E/AndroidRuntime: java.lang.NoClassDefFoundError: android.media.projection.MediaProjectionManager 
03-22 07:52:02.371 14831-14831/? E/AndroidRuntime:  at com.zennaxx.marshmallowscreenrecorder.CaptureHelper.fireScreenCaptureIntent(CaptureHelper.java:22) 
03-22 07:52:02.371 14831-14831/? E/AndroidRuntime:  at com.zennaxx.marshmallowscreenrecorder.ScreenRecorderActivity.onLaunchClicked(ScreenRecorderActivity.java:136) 
03-22 07:52:02.371 14831-14831/? E/AndroidRuntime:  at com.zennaxx.marshmallowscreenrecorder.ScreenRecorderActivity$$ViewBinder$6.doClick(ScreenRecorderActivity$$ViewBinder.java:80) 
03-22 07:52:02.371 14831-14831/? E/AndroidRuntime:  at butterknife.internal.DebouncingOnClickListener.onClick(DebouncingOnClickListener.java:22) 
03-22 07:52:02.371 14831-14831/? E/AndroidRuntime:  at android.view.View.performClick(View.java:4569) 
03-22 07:52:02.371 14831-14831/? E/AndroidRuntime:  at android.view.View$PerformClick.run(View.java:18570) 
03-22 07:52:02.371 14831-14831/? E/AndroidRuntime:  at android.os.Handler.handleCallback(Handler.java:733) 
03-22 07:52:02.371 14831-14831/? E/AndroidRuntime:  at android.os.Handler.dispatchMessage(Handler.java:95) 
03-22 07:52:02.371 14831-14831/? E/AndroidRuntime:  at android.os.Looper.loop(Looper.java:212) 
03-22 07:52:02.371 14831-14831/? E/AndroidRuntime:  at android.app.ActivityThread.main(ActivityThread.java:5135) 
03-22 07:52:02.371 14831-14831/? E/AndroidRuntime:  at java.lang.reflect.Method.invokeNative(Native Method) 
03-22 07:52:02.371 14831-14831/? E/AndroidRuntime:  at java.lang.reflect.Method.invoke(Method.java:515) 
03-22 07:52:02.371 14831-14831/? E/AndroidRuntime:  at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:878) 
03-22 07:52:02.371 14831-14831/? E/AndroidRuntime:  at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:694) 
03-22 07:52:02.371 14831-14831/? E/AndroidRuntime:  at dalvik.system.NativeStart.main(Native Method) 
+0

ich benutze Android Studio 1.4 bitte wenn mir jemand helfen kann danke im voraus – Shailesh

Antwort

3

Diese Ausnahme ist typisch (dh häufiger Fehler Programmierung), wenn Sie Starten Sie die App auf einem Gerät mit einem zu niedrigen API-Level. Die Klasse benötigt API Level 21, also sollten Sie min API Level auf 21 in Ihrem build.gradle setzen oder eine Ausnahme behandeln/abzweigen

+0

danke Antwort, aber es funktioniert immer noch nicht. Ich habe das gleiche Problem.dieses Problem trat nur in Sony Mobile Android-Version ist 4.4.4 sonst mobile Arbeit richtig wie in Marshmallow Android OS – Shailesh

+0

Nun, natürlich wird es nicht mit 4.4.4 arbeiten, da es API-Ebene 19, Marshmallow ist ist 23. Das könnte in Zukunft nützlich sein: [Android Codenames] (https://source.android.com/source/build-numbers.html) – RafToTheK

+0

danke für Ihre Antwort – Shailesh

Verwandte Themen