javaandroidjaudiotagger

Can't get track ID3 tags using jaudiotagger


I'm trying to read ID3 tags from a .m4a file using the jaudiotagger Library with the following code

try {
        File file = new File(TrackPath);
        AudioFile f = AudioFileIO.read(file);
        Tag tag = f.getTag();

        audioAlbum.setText(tag.getFirst(FieldKey.ARTIST));
    }catch(Exception e) {
        e.printStackTrace();
    };

But this returns the same error:

java.lang.NoSuchMethodError: No virtual method toPath()Ljava/nio/file/Path; in class Ljava/io/File;

The string TrackPath contains the "MediaStore.Audio.Media.DATA" of the .m4a file

I have never worked with exceptions before, so I think the problem is somewhere in there.


Solution

  • I found the problem, the original Library is not working for Android due to some java versions problems. So ended up using this library instead https://github.com/hexise/jaudiotagger-android