java.lang.NoClassDefFoundError: in javax.sound.samples dependent library Android Studio
<p>I am developing an android based app which process speech. My app references a .jar dependency and I have successfully added that jar as a library in my project but as I run the project it gives me <strong>java.lang.NoClassDefFoundError: for an class file which is there in jar file</strong>
Basically the class file which throwing the above error imports javax.sound.sampled packages in the code.</p>

<p>I am working on this part since last couple of months now but didn't found any way out of this.
I have tried copying the source code of jar library into android studio and then referencing javax.sound.sampled jar to it even tried copying javax.sound.sampled source code into android and then attaching them as per flow but still no luck.</p>

<p>It would be nice if I get alternatives for below imports, as it will solve the issue</p>

<ol>
<li>import javax.sound.sampled.AudioFileFormat;</li>
<li>import javax.sound.sampled.AudioFormat;</li>
<li>import javax.sound.sampled.AudioFileFormat.Type;</li>
<li>import javax.sound.sampled.AudioFormat.Encoding;</li>
<li>import javax.sound.sampled.AudioInputStream;</li>
<li>import javax.sound.sampled.AudioSystem;</li>
<li>import javax.sound.sampled.UnsupportedAudioFileException;</li>
</ol>

<p>Edit: 
    I am facing problem here</p>

<pre><code>String strFullName = "com/example/packagename/AudioFileReader.class";
Enumeration&lt;?&gt; configs = null;   
    try {
                    configs =  Service.class.getClassLoader().getSystemResources("strFullName");
    } catch (Throwable e) {

    }
if (configs != null) {
        while (configs.hasMoreElements()) {
URL configFileUrl = (URL) configs.nextElement();

            InputStream input = null;
            try {
                input = configFileUrl.openStream();
            } catch (Throwable e2) {


            }
            if (input != null) {
                BufferedReader reader = new BufferedReader(new InputStreamReader(input));
                try {
                    for (String strLine = reader.readLine(); strLine != null; strLine = reader.readLine()) {
                        strLine = strLine.trim();
                        int nPos = strLine.indexOf(35);
                        if (nPos &gt;= 0) {
                            strLine = strLine.substring(0, nPos);
                        }
                        if (strLine.length() &gt; 0) {
                            providers.add(strLine);
                        }
                    }
                } catch (Throwable e22) {

                }
            }
        }
    }
    Iterator&lt;String&gt; iterator = providers.iterator();

    return iterator;
}
</code></pre>

<p>It gives me TwoEnumerationsInOne and configs.hasMoreElements() gives false so not able to go into while loop.
AudioFileReader.java is included in the package</p>

<p>Thanks in advance.</p>