Problem with tag editing in android

Issue #143 resolved
Aritra Bhattacharyya created an issue
TagOptionSingleton.getInstance().setAndroid(true);
final AudioFile f = AudioFileIO.read(test);
final Tag newTag = f.getTagOrCreateAndSetDefault();

The second line throws the following exception

IllegalArgumentException: NoSuchMethodException: Error finding constructor to create copy:b.a.c.c.g
       at org.jaudiotagger.tag.id3.ID3Tags.copyObject(ID3Tags.java:323)
       at org.jaudiotagger.tag.id3.AbstractTagFrameBody.(AbstractTagFrameBody.java)
       at org.jaudiotagger.tag.id3.framebody.AbstractID3v2FrameBody.(AbstractID3v2FrameBody.java)
       at org.jaudiotagger.tag.id3.framebody.FrameBodyUnsupported.(FrameBodyUnsupported.java)
       at org.jaudiotagger.tag.id3.ID3v24Frame.createV24FrameFromV23Frame(ID3v24Frame.java:133)
       at org.jaudiotagger.tag.id3.ID3v24Frame.(ID3v24Frame.java)
       at org.jaudiotagger.tag.id3.ID3v24Tag.addFrame(ID3v24Tag.java:348)
       at org.jaudiotagger.tag.id3.AbstractID3v2Tag.copyFrames(AbstractID3v2Tag.java:226)
       at org.jaudiotagger.tag.id3.ID3v24Tag.(ID3v24Tag.java)
       at org.jaudiotagger.audio.mp3.MP3File.setID3v2Tag(MP3File.java:813)
       at org.jaudiotagger.audio.mp3.MP3File.readV2Tag(MP3File.java:232)
       at org.jaudiotagger.audio.mp3.MP3File.(MP3File.java)
       at org.jaudiotagger.audio.mp3.MP3FileReader.read(MP3FileReader.java:39)
       at org.jaudiotagger.audio.AudioFileIO.readFile(AudioFileIO.java:355)
       at org.jaudiotagger.audio.AudioFileIO.read(AudioFileIO.java:198)

This problem is arising in API 21 and above. I am using jaudiotagger 2.2.5

Comments (13)

  1. Aritra Bhattacharyya reporter

    Actually I don't have API21+ on my test devices. This problem arises with users not on my device. On my Kitkat, it works fine. Shouldn't I use setAndroid() if i am working with Android?

  2. IJabz repo owner

    Yes, but saeem,s unlikley this is the issue, i think the error is specific with the mp3 being modified, i need a copy of the problematic mp3.

  3. Aritra Bhattacharyya reporter

    I don't think its a problem with mp3 file. I asked my friend to send me the mp3 file and it worked on my device(Api 19). But none of the files are working on his device (Api 22). Do you want me to give you the full code snippet?

    Here is my code for Lyrics editing :

    final File test = new File(reference.location);
                    if(test.exists()) {
                        //TagOptionSingleton.getInstance().setAndroid(true);
                        final AudioFile f = AudioFileIO.read(test);
                        //if(reference.location.endsWith(".mp3") || reference.location.endsWith(".MP3"))
                            //f.setTag(new ID3v23Tag());
    
    
                        final Tag newTag = f.getTagOrCreateAndSetDefault();
                        final String lyrics = newTag.getFirst(FieldKey.LYRICS);
    
                        editText.setText(lyrics, TextView.BufferType.EDITABLE);
                        fab.setOnClickListener(new View.OnClickListener() {
                            @Override
                            public void onClick(View view) {
                                try {
                                    String edited = editText.getText().toString();
                                    if (!edited.isEmpty()) {
                                        newTag.setField(FieldKey.LYRICS, edited);
                                    }
                                    AudioFileIO.write(f);
                                } catch (Exception e) {
                                    Crashlytics.logException(e);
    
  4. Aritra Bhattacharyya reporter

    Can you please ask some of your regular users/contributers to share some sample code if they have implemented jaudiotagger in Android? Its really difficult to work without any wiki or support.

  5. IJabz repo owner

    I dont have any regular android contributors you are one as much as anyone else, but form the stacktrace I cant see why the problem would only occur on Android 21, it doesnt seem to be android specific I suggest you update your environment to APi22 and try it out, also email paultaylor@jthink.net an mp3 file that you know fails as it does seem related to the mp3 file to me.

  6. Aritra Bhattacharyya reporter

    Its not a specific mp3. Its same for all files. But like I said, I had already tested the same mp3 file on my device and it worked perfectly. Here's my app

    https://play.google.com/store/apps/details?id=com.optimus.music.player.onix

    If you or one of your testers have time, you may try this feature on your device and see if it works. Actually I am just an individual with limited means. I don't have a lot of devices at my disposal. I rely upon personal reports and analytics from my users.

  7. IJabz repo owner

    Im also an individual of limited means I don't have a team of testers ! To be brutally honest I dont really care if your application doesnt work, if you can reliably reproduce the issue outside of your application then I will fix it, if you cannot theres little I can do

  8. Aritra Bhattacharyya reporter

    "if you can reliably reproduce the issue outside of your application then I will fix it" - I have no idea what you mean by that. I need the tagger to work in my app, how and where else shall I replicate it? And what use would that be to me?

    Do you think I should switch to an earlier version? I am also facing problem with earlier APIs for something called StandardCharset. Since lots of other apps like MusixMatch, BlackPlayer etc are using Jaudiotagger and working pretty well, I'm guessing there must be some way out.

  9. IJabz repo owner

    I think you need to understand how opensrc works, you want to use the jaudiotagger library for free, but you seem unwilling to contribute anything back. If you can create a standalone test that doesnt involve your application then I can fix the problem, if you can only get the problem to occur within your application then the problem may well be with a problem of how you are using the library, and this would be a problem you need to resolve yourself or pay somebody to fix it for you.

  10. Aritra Bhattacharyya reporter

    I have no idea what standalone test means in this case. I can't claim to be familiar with cross platform development process. The best I can do is give you the entire source code of my implementation of Jaudiotagger. Since you have developed it I am guessing you know what is the best way to implement it in different platforms including Android.

    Especially considering the fact that so many android music players and editing apps use your library, I fail to understand why are you reluctant to consider my case.

    Should you agree I am willing to mail you the files where I have implemented jaudiotagger.

  11. IJabz repo owner

    Because you dont seem to have a clue what you are doing and I dont have time to start babysitting you, and no I have done no Android devlopment.

  12. Log in to comment