Unable to set path in jaudiotagger

697 views Asked by At

I'm trying to edit tags of audio files and for that I'm using JaudioTagger. But a problem exists and I can't figure it out.

I'm getting this error:

java.lang.NoSuchMethodError: No virtual method toPath()Ljava/nio/file/Path; in class Ljava/io/File; or its super classes (declaration of 'java.io.File' appears in /system/framework/core-oj.jar)

And my code for getting tags of audio files :

            File path = new File(songInfoModel.getData());
            Log.e("Path: ", path.toString());
            try {
                AudioFile f = AudioFileIO.read(path);
                Tag tag = f.getTag();
                String artist = tag.getFirst(FieldKey.ARTIST);
                tag.getFirst(FieldKey.ALBUM);
                tag.getFirst(FieldKey.TITLE);
                tag.getFirst(FieldKey.COMMENT);
                tag.getFirst(FieldKey.YEAR);
                tag.getFirst(FieldKey.TRACK);
                tag.getFirst(FieldKey.DISC_NO);
                tag.getFirst(FieldKey.COMPOSER);
                tag.getFirst(FieldKey.ARTIST_SORT);

                Log.e("Artist: ",artist);
            } catch (CannotReadException e) {
                e.printStackTrace();
            } catch (IOException e) {
                e.printStackTrace();
            } catch (TagException e) {
                e.printStackTrace();
            } catch (ReadOnlyFileException e) {
                e.printStackTrace();
            } catch (InvalidAudioFrameException e) {
                e.printStackTrace();
            }
0

There are 0 answers