Cannot resolve android.media.MediaFile
I have android sdk 2.1 and it cannot resolve android.media.MediaFile package.
Why is it so? How can I solve this problem? To which version does android.media.MediaFile belong? Has 开发者_开发问答it been deprecated?
In case anyone else is seeing this issue...
After a lot of searching I discovered that this package is in recent Android builds (did not look back too far) but that Eclipse will still give this error if you try to import it into your project.
This appears to be because the class definition is 'hidden' using {@hide} tags in the source code (extract from platform_frameworks_base / media / java / android / media / MediaFile.java):
import java.util.HashMap;
import java.util.List;
import java.util.Locale;
/**
* MediaScanner helper class.
*
* {@hide}
*/
public class MediaFile {
// Audio file types
public static final int FILE_TYPE_MP3 = 1;
public static final int FILE_TYPE_M4A = 2;
public static final int FILE_TYPE_WAV = 3;
These tags appear to mean that Eclipse will not allow you use this class - the logic presumably being that it is a hidden API so you should not be using it anyway.
Some more information on the {@hide} tags is available at:
https://stackoverflow.com/a/17056643/334402
There is no such library as I can see: http://developer.android.com/reference/android/media/package-summary.html
精彩评论