java.lang.NoSuchMethodError: android.app.Activity.checkSelfPermission

Appcelerator JIRA | Ashraf Abu | 1 year ago
  1. 0

    Running code: {code} Titanium.Media.showCamera({ success:function(event) { // called when media returned from the camera Ti.API.debug('Our type was: '+event.mediaType); if(event.mediaType == Ti.Media.MEDIA_TYPE_PHOTO) { var imageView = Ti.UI.createImageView({ width:win.width, height:win.height, image:event.media }); win.add(imageView); } else { alert("got the wrong type back ="+event.mediaType); } }, cancel:function() { // called when user cancels taking a picture }, error:function(error) { // called when there's an error var a = Titanium.UI.createAlertDialog({title:'Camera'}); a.setMessage(JSON.stringify(error)); a.show(); }, saveToPhotoGallery:true }); {code} Gives rise to log error: {code} 10-01 13:07:22.718: E/TiExceptionHandler(27510): (main) [51,51] ----- Titanium Javascript Runtime Error ----- 10-01 13:07:22.718: E/TiExceptionHandler(27510): (main) [0,51] - In app.js:1,16 10-01 13:07:22.718: E/TiExceptionHandler(27510): (main) [1,52] - Message: Uncaught Error: android.app.Activity.checkSelfPermission 10-01 13:07:22.718: E/TiExceptionHandler(27510): (main) [0,52] - Source: Titanium.Media.showCamera({ {code} Due to https://github.com/appcelerator/titanium_mobile/blob/32600b01047b4654c92b341c6f0b61d38fa702b1/android/modules/media/src/java/ti/modules/titanium/media/MediaModule.java#L288 http://developer.android.com/reference/android/content/Context.html#checkSelfPermission(java.lang.String) Being only available in API Level 23 and above. More logs: {code} 10-01 13:07:22.628: W/System.err(27510): java.lang.NoSuchMethodError: android.app.Activity.checkSelfPermission 10-01 13:07:22.628: W/System.err(27510): at ti.modules.titanium.media.MediaModule.hasPermissions(MediaModule.java:288) 10-01 13:07:22.628: W/System.err(27510): at ti.modules.titanium.media.MediaModule.showCamera(MediaModule.java:300) 10-01 13:07:22.628: W/System.err(27510): at org.appcelerator.kroll.runtime.v8.V8Runtime.nativeRunModule(Native Method) 10-01 13:07:22.628: W/System.err(27510): at org.appcelerator.kroll.runtime.v8.V8Runtime.doRunModule(V8Runtime.java:177) 10-01 13:07:22.628: W/System.err(27510): at org.appcelerator.kroll.KrollRuntime.handleMessage(KrollRuntime.java:299) 10-01 13:07:22.628: W/System.err(27510): at org.appcelerator.kroll.runtime.v8.V8Runtime.handleMessage(V8Runtime.java:203) 10-01 13:07:22.628: W/System.err(27510): at android.os.Handler.dispatchMessage(Handler.java:98) 10-01 13:07:22.628: W/System.err(27510): at android.os.Looper.loop(Looper.java:136) 10-01 13:07:22.628: W/System.err(27510): at org.appcelerator.kroll.KrollRuntime$KrollRuntimeThread.run(KrollRuntime.java:112) {code}

    Appcelerator JIRA | 1 year ago | Ashraf Abu
    java.lang.NoSuchMethodError: android.app.Activity.checkSelfPermission
  2. 0

    Running code: {code} Titanium.Media.showCamera({ success:function(event) { // called when media returned from the camera Ti.API.debug('Our type was: '+event.mediaType); if(event.mediaType == Ti.Media.MEDIA_TYPE_PHOTO) { var imageView = Ti.UI.createImageView({ width:win.width, height:win.height, image:event.media }); win.add(imageView); } else { alert("got the wrong type back ="+event.mediaType); } }, cancel:function() { // called when user cancels taking a picture }, error:function(error) { // called when there's an error var a = Titanium.UI.createAlertDialog({title:'Camera'}); a.setMessage(JSON.stringify(error)); a.show(); }, saveToPhotoGallery:true }); {code} Gives rise to log error: {code} 10-01 13:07:22.718: E/TiExceptionHandler(27510): (main) [51,51] ----- Titanium Javascript Runtime Error ----- 10-01 13:07:22.718: E/TiExceptionHandler(27510): (main) [0,51] - In app.js:1,16 10-01 13:07:22.718: E/TiExceptionHandler(27510): (main) [1,52] - Message: Uncaught Error: android.app.Activity.checkSelfPermission 10-01 13:07:22.718: E/TiExceptionHandler(27510): (main) [0,52] - Source: Titanium.Media.showCamera({ {code} Due to https://github.com/appcelerator/titanium_mobile/blob/32600b01047b4654c92b341c6f0b61d38fa702b1/android/modules/media/src/java/ti/modules/titanium/media/MediaModule.java#L288 http://developer.android.com/reference/android/content/Context.html#checkSelfPermission(java.lang.String) Being only available in API Level 23 and above. More logs: {code} 10-01 13:07:22.628: W/System.err(27510): java.lang.NoSuchMethodError: android.app.Activity.checkSelfPermission 10-01 13:07:22.628: W/System.err(27510): at ti.modules.titanium.media.MediaModule.hasPermissions(MediaModule.java:288) 10-01 13:07:22.628: W/System.err(27510): at ti.modules.titanium.media.MediaModule.showCamera(MediaModule.java:300) 10-01 13:07:22.628: W/System.err(27510): at org.appcelerator.kroll.runtime.v8.V8Runtime.nativeRunModule(Native Method) 10-01 13:07:22.628: W/System.err(27510): at org.appcelerator.kroll.runtime.v8.V8Runtime.doRunModule(V8Runtime.java:177) 10-01 13:07:22.628: W/System.err(27510): at org.appcelerator.kroll.KrollRuntime.handleMessage(KrollRuntime.java:299) 10-01 13:07:22.628: W/System.err(27510): at org.appcelerator.kroll.runtime.v8.V8Runtime.handleMessage(V8Runtime.java:203) 10-01 13:07:22.628: W/System.err(27510): at android.os.Handler.dispatchMessage(Handler.java:98) 10-01 13:07:22.628: W/System.err(27510): at android.os.Looper.loop(Looper.java:136) 10-01 13:07:22.628: W/System.err(27510): at org.appcelerator.kroll.KrollRuntime$KrollRuntimeThread.run(KrollRuntime.java:112) {code}

    Appcelerator JIRA | 1 year ago | Ashraf Abu
    java.lang.NoSuchMethodError: android.app.Activity.checkSelfPermission
  3. 0

    {code:java} var cameraOverlay = Titanium.UI.createView({}); var cameraOverlayButton = Titanium.UI.createView({ bottom: 10, width: 100, height: 100, backgroundColor: "#f00" }); cameraOverlay.add(cameraOverlayButton); cameraOverlayButton.addEventListener('click', function(e) { Ti.Media.takePicture(); }); function onOpen(argument) { Titanium.Media.showCamera({ overlay: cameraOverlay, showControls: false, success: function(e) { Ti.API.info('# SUCCESS : ' + JSON.stringify(e)); }, cancel: function(e) { Ti.API.info('# CANCEL : ' + e.error); }, error: function(e) { Ti.API.info('# ERROR : ' + e.code + ' : ' + e.error); }, mediaTypes: Ti.Media.MEDIA_TYPE_PHOTO, }); } $.index.addEventListener("open", onOpen); $.index.open(); {code} When using the latest SDK from the git (checkout 15th Sept.) and opening a camera with Ti.Media.showCamera() the app is crashing with {code} WARN] W/System.err: java.lang.NoSuchMethodError: No virtual method checkSelfPermission(Ljava/lang/String;)I in class Landroid/app/Activity; or its super classes (declaration of 'android.app.Activity' appears in /system/framework/framework.jar) [WARN] W/System.err: at ti.modules.titanium.media.MediaModule.hasPermissions(MediaModule.java:288) [WARN] W/System.err: at ti.modules.titanium.media.MediaModule.showCamera(MediaModule.java:300) [WARN] W/System.err: at org.appcelerator.kroll.runtime.v8.V8Runtime.nativeRunModule(Native Method) [WARN] W/System.err: at org.appcelerator.kroll.runtime.v8.V8Runtime.doRunModule(V8Runtime.java:177) [WARN] W/System.err: at org.appcelerator.kroll.KrollRuntime.handleMessage(KrollRuntime.java:299) [WARN] W/System.err: at org.appcelerator.kroll.runtime.v8.V8Runtime.handleMessage(V8Runtime.java:203) [WARN] W/System.err: at android.os.Handler.dispatchMessage(Handler.java:98) [WARN] W/System.err: at android.os.Looper.loop(Looper.java:135) [WARN] W/System.err: at org.appcelerator.kroll.KrollRuntime$KrollRuntimeThread.run(KrollRuntime.java:112) [DEBUG] OpenGLRenderer: Use EGL_SWAP_BEHAVIOR_PRESERVED: true [DEBUG] Atlas: Validating map... [ERROR] TiExceptionHandler: (main) [618,618] ----- Titanium Javascript Runtime Error ----- [ERROR] TiExceptionHandler: (main) [1,619] - In alloy/controllers/index.js:42,20 [ERROR] TiExceptionHandler: (main) [0,619] - Message: Uncaught Error: No virtual method checkSelfPermission(Ljava/lang/String;)I in class Landroid/app/Activity; or its super classes (declaration of 'android.app.Activity' appears in /system/framework/framework.jar) [ERROR] TiExceptionHandler: (main) [0,619] - Source: Titanium.Media.showCamera({ [ERROR] V8Exception: Exception occurred at alloy/controllers/index.js:42: Uncaught Error: No virtual method checkSelfPermission(Ljava/lang/String;)I in class Landroid/app/Activity; or its super classes (declaration of 'android.app.Activity' appears in /system/framework/framework.jar) {code} On my phone I'm running 5.1.1 not beta 6 (marshmallow) *Workaround* Removing the checkSelfPermission() from hasPermissions() (MediaModule.java) will remove the error but probably won't be useful for Marshmallow.

    Appcelerator JIRA | 1 year ago | Michael G
    java.lang.NoSuchMethodError: No virtual method checkSelfPermission(Ljava/lang/String;)I in class Landroid/app/Activity; or its super classes (declaration of 'android.app.Activity' appears in /system/framework/framework.jar)
  4. Speed up your debug routine!

    Automated exception search integrated into your IDE

  5. 0
    I was using the library hibernate-entitymanager:4.3.5.Final with java persistence API 2.0 instead of using it with hibernate-entitymanager:4.2.8.Final.

    Not finding the right solution?
    Take a tour to get the most out of Samebug.

    Tired of useless tips?

    Automated exception search integrated into your IDE

    Root Cause Analysis

    1. java.lang.NoSuchMethodError

      android.app.Activity.checkSelfPermission

      at ti.modules.titanium.media.MediaModule.hasPermissions()
    2. ti.modules.titanium
      MediaModule.showCamera
      1. ti.modules.titanium.media.MediaModule.hasPermissions(MediaModule.java:288)
      2. ti.modules.titanium.media.MediaModule.showCamera(MediaModule.java:300)
      2 frames
    3. org.appcelerator.kroll
      V8Runtime.handleMessage
      1. org.appcelerator.kroll.runtime.v8.V8Runtime.nativeRunModule(Native Method)
      2. org.appcelerator.kroll.runtime.v8.V8Runtime.doRunModule(V8Runtime.java:177)
      3. org.appcelerator.kroll.KrollRuntime.handleMessage(KrollRuntime.java:299)
      4. org.appcelerator.kroll.runtime.v8.V8Runtime.handleMessage(V8Runtime.java:203)
      4 frames
    4. Android Platform
      Looper.loop
      1. android.os.Handler.dispatchMessage(Handler.java:98)
      2. android.os.Looper.loop(Looper.java:136)
      2 frames
    5. org.appcelerator.kroll
      KrollRuntime$KrollRuntimeThread.run
      1. org.appcelerator.kroll.KrollRuntime$KrollRuntimeThread.run(KrollRuntime.java:112)
      1 frame