我尝试使用以下代码编辑带有MyId3库的音乐标签:
Intent intent = getIntent();
path = intent.getStringExtra("path");
Log.d("path",path);
name = (EditText) findViewById(R.id.song_name);
album = (EditText) findViewById(R.id.song_album);
artist = (EditText) findViewById(R.id.song_artist);
File src = new File(path);
MusicMetadataSet src_set = null;
try {
src_set = new MyID3().read(src);
} catch (IOException e) {
e.printStackTrace();
} catch (ID3ReadException e) {
e.printStackTrace();
}
if (src_set != null) {
try {
IMusicMetadata metadata = src_set.getSimplified();
artist.setText(metadata.getArtist());
album.setText(metadata.getAlbum());
name.setText(metadata.getSongTitle());
} catch (Exception e) {
e.printStackTrace();
}
}
但我收到此错误并且申请强制关闭:
java.lang.NoClassDefFoundError: Failed resolution of: Lorg/apache/regexp/RE
字符串路径为/storage/15D5-14F7/Musics/Music/Dream On.mp3
。我该如何解决这个问题?
答案 0 :(得分:1)
我改变了我的图书馆并解决了问题。似乎android不支持某些类JAudioTagger
和MyId3
库