I get an exception using java on android (java.lang.NoClassDefFoundError), why?

后端 未结 3 1003
自闭症患者
自闭症患者 2021-01-28 06:02

This is the line I run:

AudioInputStream clip1 = AudioSystem.getAudioInputStream(new File(wavFile1));

This is the exception I get (From LogCat)

相关标签:
3条回答
  • 2021-01-28 06:36

    AudioSystem is part of JavaSound, and JavaSound is part of the desktop JVM/SDK. JavaSound is NOT present in the Android JVM/SDK, so your old code will not compile on any current Android SDK.

    See http://developer.android.com/guide/topics/media/index.html for the Android audio functionality outline: you will need to port your old code to use the Android SDK classes.

    0 讨论(0)
  • 2021-01-28 06:55

    It clearly means class AudioSystem is not present in your project. May be you were referencing some libraries which may be missing now.

    0 讨论(0)
  • 2021-01-28 07:03

    The problem is that the classpath isn't set correctly. See this question for some solutions.

    0 讨论(0)
提交回复
热议问题