嘗試使用CamcorderProfile.hasProfile(xyz)時出現運行時NoSuchMethodError。 在我的應用程序的清單正確的API指定android CamcorderProfile.hasProfile NoSuchMethodError
<uses-sdk android:minSdkVersion="8" android:targetSdkVersion="8" />
,這是塊我想用
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);
}
我不明白在Eclipse中的任何錯誤書寫時/建築,甚至代碼完成工作正常。 編輯在這一點上我運行在一些設備上的代碼(銀河,令人難以置信和慾望)。
堆棧跟蹤誤差
E/AndroidRuntime(12499): FATAL EXCEPTION: main
E/AndroidRuntime(12499): java.lang.NoSuchMethodError: Android.media.CamcorderProfile.hasProfile
任何暗示爲什麼出現這種情況?謝謝。
嘿布魯諾,感謝您的回覆,並抱歉不提及它的問題。我正在幾款手機上測試它(三星Galaxy,HTC Desire和Incredible)。 – ticofab
QUALITY_QVGA來自API級別15,也許這是問題:http://developer.android.com/reference/android/media/CamcorderProfile.html#QUALITY_QVGA –