Open vincent091 opened 9 years ago
The drawOval method used for this demo was added in API level 21 (Lollipop), so most likely the issue is that you are running on an older version of the OS. If want to run on an older OS, you can change the demo code to use drawRect instead of drawOval.
Yes but in your manifest they are this line
<uses-sdk android:minSdkVersion="9" android:targetSdkVersion="23" />
If the min SDK was 9 : why you use method only available in the 21, could you target the method for the good API, and another method for the older one.
Thanks for your answering, and sorry for my poor english
I modify the code with this. I don't know about the quality of this :
if (android.os.Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP){ // Do something for Lollipop and above versions canvas.drawOval(left, top, right, bottom, mBoxPaint); } else{ // do something for phones running an SDK before Lollipop RectF mRectF = new RectF(left,top,right,bottom); canvas.drawOval(mRectF, mBoxPaint); }
E/AndroidRuntime﹕ FATAL EXCEPTION: main Process: com.google.android.gms.samples.vision.face.multitracker, PID: 10285 java.lang.NoSuchMethodError: android.graphics.Canvas.drawOval at com.google.android.gms.samples.vision.face.multitracker.FaceGraphic.draw(FaceTrackerFactory.java:120) at com.google.android.gms.samples.vision.face.multitracker.ui.camera.GraphicOverlay.onDraw(GraphicOverlay.java:182) at android.view.View.draw(View.java:14465) at android.view.View.getDisplayList(View.java:13362) at android.view.View.getDisplayList(View.java:13404) at android.view.ViewGroup.dispatchGetDisplayList(ViewGroup.java:3077) at android.view.View.getDisplayList(View.java:13300) at android.view.View.getDisplayList(View.java:13404) at android.view.ViewGroup.dispatchGetDisplayList(ViewGroup.java:3077) at android.view.View.getDisplayList(View.java:13300) at android.view.View.getDisplayList(View.java:13404) at android.view.ViewGroup.dispatchGetDisplayList(ViewGroup.java:3077) at android.view.View.getDisplayList(View.java:13300) at android.view.View.getDisplayList(View.java:13404) at android.view.ViewGroup.dispatchGetDisplayList(ViewGroup.java:3077) at android.view.View.getDisplayList(View.java:13300) at android.view.View.getDisplayList(View.java:13404) at android.view.ViewGroup.dispatchGetDisplayList(ViewGroup.java:3077) at android.view.View.getDisplayList(View.java:13300) at android.view.View.getDisplayList(View.java:13404) at android.view.ViewGroup.dispatchGetDisplayList(ViewGroup.java:3077) at android.view.View.getDisplayList(View.java:13300) at android.view.View.getDisplayList(View.java:13404) at android.view.ViewGroup.dispatchGetDisplayList(ViewGroup.java:3077) at android.view.View.getDisplayList(View.java:13300) at android.view.View.getDisplayList(View.java:13404) at android.view.HardwareRenderer$GlRenderer.buildDisplayList(HardwareRenderer.java:1570) at android.view.HardwareRenderer$GlRenderer.draw(HardwareRenderer.java:1449) at android.view.ViewRootImpl.draw(ViewRootImpl.java:2377) at android.view.ViewRootImpl.performDraw(ViewRootImpl.java:2249) at android.view.ViewRootImpl.performTraversals(ViewRootImpl.java:1879) at android.view.ViewRootImpl.doTraversal(ViewRootImpl.java:996) at android.view.ViewRootImpl$TraversalRunnable.run(ViewRootImpl.java:5600) at android.view.Choreographer$CallbackRecord.run(Choreographer.java:761) at android.view.Choreographer.doCallbacks(Choreographer.java:574) at android.view.Choreographer.doFrame(Choreographer.java:544) at android.view.Choreographer$FrameDisplayEventReceiver.run(Choreographer.java:747) at android.os.Handler.handleCallback(Handler.java:733) at android.os.Handler.dispatchMessage(Handler.java:95) at android.os.Looper.loop(Looper.java:136) at android.app.ActivityThread.main(ActivityThread.java:5034) 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:1270) at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1086) at dalvik.system.NativeStart.main(Native Method)