private voID checkCameraPermissions() { if(checkCameraHarDWare(this)) { if (checkSelfPermission(Manifest.permission_group.camera) != PackageManager.PERMISSION_GRANTED) { Crashlytics.log("Requesting camera permission"); // Should we show an explanation? if (shouldShowRequestPermissionRationale( Manifest.permission_group.camera)) { // Explain to the user why we need to use the camera showRationaleForCameraUse(); } requestPermissions(new String[]{Manifest.permission_group.camera},Constants.MY_PERMISSIONS_REQUEST_CAMERA_GROUP); // MY_PERMISSIONS_REQUEST_CAMERA_GROUP is an // app-defined int constant } else { startApp(); } }else{ showNoCameraAvailableAlert(); } }@OverrIDe public voID onRequestPermissionsResult(int requestCode,String permissions[],int[] grantResults) { switch (requestCode) { case Constants.MY_PERMISSIONS_REQUEST_CAMERA_GROUP: { if (grantResults[0] == PackageManager.PERMISSION_GRANTED) { // permission was granted,yay! // start the app startApp(); } else { // permission denIEd,boo! // leav the app! showNoCameraAvailableAlert(); } return; } // other 'switch' lines to check for other // permissions this app might request } }
并得到以下错误:
java.lang.NoSuchMethodError: No virtual method checkSelfPermission(Ljava/lang/String;)I in class lim/emu/app/emu/app/vIEw/splash/SplashActivity; or its super classes (declaration of 'im.emu.app.emu.app.vIEw.splash.SplashActivity' appears in /data/app/im.emu.app.emu.test-1/base.apk) at im.emu.app.emu.app.vIEw.splash.SplashActivity.checkCameraPermissions(SplashActivity.java:74) at im.emu.app.emu.app.vIEw.splash.SplashActivity.onCreate(SplashActivity.java:52) at androID.app.Activity.performCreate(Activity.java:5977) at androID.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1105) at androID.app.ActivityThread.performlaunchActivity(ActivityThread.java:2258) at androID.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2367) at androID.app.ActivityThread.access0(ActivityThread.java:148) at androID.app.ActivityThread$H.handleMessage(ActivityThread.java:1283) at androID.os.Handler.dispatchMessage(Handler.java:102) at androID.os.Looper.loop(Looper.java:135) at androID.app.ActivityThread.main(ActivityThread.java:5274) at java.lang.reflect.Method.invoke(Native Method) at java.lang.reflect.Method.invoke(Method.java:372) at com.androID.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:909) at com.androID.internal.os.ZygoteInit.main(ZygoteInit.java:704)08-30 16:34:10.801 17087-17357/im.emu.app.emu.test I/Fabric﹕ Crashlytics report upload complete: 55E30629033A-0001-42BF-296ED8AC703A.cls
任何想法如何解决这个问题?
附:如果需要更多的信息请问
以上是内存溢出为你收集整理的试图为android M实现摄像机权限获得没有虚拟方法checkSelfPermission全部内容,希望文章能够帮你解决试图为android M实现摄像机权限获得没有虚拟方法checkSelfPermission所遇到的程序开发问题。
如果觉得内存溢出网站内容还不错,欢迎将内存溢出网站推荐给程序员好友。
欢迎分享,转载请注明来源:内存溢出
评论列表(0条)