No Activity found to handle Intent { act=android.m

2019-02-24 10:01发布

问题:

I received the following crash report in my Android application when trying to call the ACTION_IMAGE_CAPTURE intent. This code has been running in my app for months with no issues. I am guessing this is something specific to a certain type of phone but unfortunately Google does not provide me with any additional information outside the stack trace. Any ideas what could have caused this crash report?

Stack Trace

android.content.ActivityNotFoundException: No Activity found to handle Intent { act=android.media.action.IMAGE_CAPTURE }
    at android.app.Instrumentation.checkStartActivityResult(Instrumentation.java:1409)
    at android.app.Instrumentation.execStartActivity(Instrumentation.java:1379)
    at android.app.Activity.startActivityFromChild(Activity.java:3067)
    at android.app.Activity.startActivityForResult(Activity.java:2847)

Producing Code

Intent cameraIntent = new Intent(android.provider.MediaStore.ACTION_IMAGE_CAPTURE);
startActivityForResult(cameraIntent, MY_CAMERA_ACTIVITY_REQUEST_CODE);

Manifest Entries

<uses-sdk android:minSdkVersion="7" />
<uses-feature android:name="android.hardware.camera" />

回答1:

A few things come to mind 1.Could be a tablet, the kindle fire does not have a camera. 2. A phone that does not have a camera 3. No SD card installed

I agree you would think it would be a safe operation to call the image capture intent but with so many devices running Android it's impossible to know what device your app is running on.