[英]JAudiotagger java.lang.VerifyError in android
I am trying to create an audio tag editor refering to these 我正在尝试创建一个引用这些内容的音频标签编辑器
http://www.jthink.net/jaudiotagger/ http://www.jthink.net/jaudiotagger/
and 和
JAudioTagger and Android - Change a value in an mp3? JAudioTagger和Android-更改mp3中的值吗?
and 和
Jaudiotagger ID3 TAG for android - can set artwork but cannot set other fields 适用于Android的Jaudiotagger ID3标记-可以设置图稿,但不能设置其他字段
which library is needed to be imported in to the project so that I donot get java.lang.VerifyError
哪个库需要导入到项目中,这样我就不会得到
java.lang.VerifyError
I am trying the code with this library 我正在尝试使用此库的代码
jaudiotagger-2.2.5.jar
which I Found from here 我从这里找到
https://bitbucket.org/ijabz/jaudiotagger/downloads https://bitbucket.org/ijabz/jaudiotagger/downloads
this is the code 这是代码
try {
File file = new File(Data);
TagOptionSingleton.getInstance().setAndroid(true);
AudioFile audioFile = AudioFileIO.read(file);
Tag newTag = audioFile.getTag();
newTag.setField(FieldKey.ALBUM,"October");
newTag.setField(FieldKey.ARTIST,"U2");
audioFile.commit();
} catch (CannotReadException e) {
// TODO Auto-generated catch block
e.printStackTrace();
} catch (IOException e) {
// TODO Auto-generated catch block
e.printStackTrace();
} catch (TagException e) {
// TODO Auto-generated catch block
e.printStackTrace();
} catch (ReadOnlyFileException e) {
// TODO Auto-generated catch block
e.printStackTrace();
} catch (InvalidAudioFrameException e) {
// TODO Auto-generated catch block
e.printStackTrace();
} catch (CannotWriteException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
this is the log cat 这是原木猫
12-07 16:56:10.618: D/dalvikvm(738): GC_FOR_ALLOC freed 137K, 11% free 6210K/6919K, paused 59ms
12-07 16:56:11.358: I/dalvikvm(738): Could not find method org.jaudiotagger.tag.TagOptionSingleton.getInstance, referenced from method com.example.scrlltabs3.songManagerDialog$3.onClick
12-07 16:56:11.358: W/dalvikvm(738): VFY: unable to resolve static method 11628: Lorg/jaudiotagger/tag/TagOptionSingleton;.getInstance ()Lorg/jaudiotagger/tag/TagOptionSingleton;
12-07 16:56:11.368: D/dalvikvm(738): VFY: replacing opcode 0x71 at 0x0009
12-07 16:56:11.368: W/dalvikvm(738): VFY: unable to resolve exception class 1667 (Lorg/jaudiotagger/audio/exceptions/CannotReadException;)
12-07 16:56:11.378: W/dalvikvm(738): VFY: unable to find exception handler at addr 0x2b
12-07 16:56:11.378: W/dalvikvm(738): VFY: rejected Lcom/example/scrlltabs3/songManagerDialog$3;.onClick (Landroid/view/View;)V
12-07 16:56:11.378: W/dalvikvm(738): VFY: rejecting opcode 0x0d at 0x002b
12-07 16:56:11.388: W/dalvikvm(738): VFY: rejected Lcom/example/scrlltabs3/songManagerDialog$3;.onClick (Landroid/view/View;)V
12-07 16:56:11.388: W/dalvikvm(738): Verifier rejected class Lcom/example/scrlltabs3/songManagerDialog$3;
12-07 16:56:11.388: D/AndroidRuntime(738): Shutting down VM
12-07 16:56:11.398: W/dalvikvm(738): threadid=1: thread exiting with uncaught exception (group=0x409961f8)
12-07 16:56:11.428: E/AndroidRuntime(738): FATAL EXCEPTION: main
12-07 16:56:11.428: E/AndroidRuntime(738): java.lang.VerifyError: com/example/scrlltabs3/songManagerDialog$3
12-07 16:56:11.428: E/AndroidRuntime(738): at com.example.scrlltabs3.songManagerDialog.onCreate(songManagerDialog.java:68)
12-07 16:56:11.428: E/AndroidRuntime(738): at android.app.Activity.performCreate(Activity.java:4465)
12-07 16:56:11.428: E/AndroidRuntime(738): at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1049)
12-07 16:56:11.428: E/AndroidRuntime(738): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:1919)
12-07 16:56:11.428: E/AndroidRuntime(738): at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:1980)
12-07 16:56:11.428: E/AndroidRuntime(738): at android.app.ActivityThread.access$600(ActivityThread.java:122)
12-07 16:56:11.428: E/AndroidRuntime(738): at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1146)
12-07 16:56:11.428: E/AndroidRuntime(738): at android.os.Handler.dispatchMessage(Handler.java:99)
12-07 16:56:11.428: E/AndroidRuntime(738): at android.os.Looper.loop(Looper.java:137)
12-07 16:56:11.428: E/AndroidRuntime(738): at android.app.ActivityThread.main(ActivityThread.java:4340)
12-07 16:56:11.428: E/AndroidRuntime(738): at java.lang.reflect.Method.invokeNative(Native Method)
12-07 16:56:11.428: E/AndroidRuntime(738): at java.lang.reflect.Method.invoke(Method.java:511)
12-07 16:56:11.428: E/AndroidRuntime(738): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:784)
12-07 16:56:11.428: E/AndroidRuntime(738): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:551)
12-07 16:56:11.428: E/AndroidRuntime(738): at dalvik.system.NativeStart.main(Native Method)
Reading the error, it is easy to point out that the following line is causing the Verify
error 读取错误后,很容易指出以下行导致了
Verify
错误
TagOptionSingleton.getInstance().setAndroid(true);
Could not find method org.jaudiotagger.tag.TagOptionSingleton.getInstance, referenced from method com.example.scrlltabs3.songManagerDialog$3.onClick
找不到方法com.example.scrlltabs3.songManagerDialog $ 3.onClick引用的方法org.jaudiotagger.tag.TagOptionSingleton.getInstance
Googling the issue I came across the following stackoverflow question/answer that describes the same issue and offers a solution by replacing: 谷歌搜索该问题时,我遇到了以下堆栈溢出问题/答案,该问题/答案描述了同一问题,并通过替换提供了解决方案:
audioFile.commit();
with 同
AudioFileIO.write(audioFile)
See here the question and with above solution. 请参阅此处的问题以及上述解决方案。 If this resolved your issue then don't forget to give the answerer Paul Taylor in that answer an upvote.
如果这解决了您的问题,请不要忘记给回答者保罗·泰勒一个答案。
java.lang.verifyError happens when JVM's bytecode verifier try to verify all the byte code before execution and fail when it finds inconsistencies and these inconsistencies can rise due to many factors such as 当JVM的字节码验证程序尝试在执行之前验证所有字节码时发生java.lang.verifyError,并在发现不一致之处时失败,并且由于许多因素(例如,
A detailed explanation about the VerifyError with examples can be found here . 可以在此处找到有关VerifyError的详细说明和示例。
See the examples in the above link which demonstrate how verify error is thrown by JVM. 请参阅上面链接中的示例,这些示例演示了JVM如何引发验证错误。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.