I am getting a runtime NoSuchMethodError when trying to use CamcorderProfile.hasProfile(xyz).
In my app’s manifest the correct API are specified
<uses-sdk android:minSdkVersion="8" android:targetSdkVersion="8" />
and this is the block I would like to use
CamcorderProfile cf = CamcorderProfile.get(CamcorderProfile.QUALITY_LOW);
if (CamcorderProfile.hasProfile(CamcorderProfile.QUALITY_480P)) {
cf = CamcorderProfile.get(CamcorderProfile.QUALITY_480P);
} else if (CamcorderProfile.hasProfile(CamcorderProfile.QUALITY_CIF)) {
cf = CamcorderProfile.get(CamcorderProfile.QUALITY_CIF);
} else if (CamcorderProfile.hasProfile(CamcorderProfile.QUALITY_QVGA)) {
cf = CamcorderProfile.get(CamcorderProfile.QUALITY_QVGA);
}
I don’t get any errors in Eclipse when writing / building, even code completion works fine.
EDIT at this point I run the code on a few devices (Galaxy, Incredible and Desire).
The stacktrace error is
E/AndroidRuntime(12499): FATAL EXCEPTION: main
E/AndroidRuntime(12499): java.lang.NoSuchMethodError: Android.media.CamcorderProfile.hasProfile
Any hint why this happens? Thanks.
I think Bruno was right, it seems like it was a problem of API level.