java.lang.NoSuchMethodError

There are no available Samebug tips for this exception. Do you have an idea how to solve this issue? A short tip would help users who saw this issue last week.

  • 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}
    via by Ashraf Abu,
  • 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}
    via by Ashraf Abu,
  • {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.
    via by Michael G,
    • java.lang.NoSuchMethodError: android.app.Activity.checkSelfPermission at ti.modules.titanium.media.MediaModule.hasPermissions(MediaModule.java:288) at ti.modules.titanium.media.MediaModule.showCamera(MediaModule.java:300) at org.appcelerator.kroll.runtime.v8.V8Runtime.nativeRunModule(Native Method) at org.appcelerator.kroll.runtime.v8.V8Runtime.doRunModule(V8Runtime.java:177) at org.appcelerator.kroll.KrollRuntime.handleMessage(KrollRuntime.java:299) at org.appcelerator.kroll.runtime.v8.V8Runtime.handleMessage(V8Runtime.java:203) at android.os.Handler.dispatchMessage(Handler.java:98) at android.os.Looper.loop(Looper.java:136) at org.appcelerator.kroll.KrollRuntime$KrollRuntimeThread.run(KrollRuntime.java:112)
    No Bugmate found.