비슷한 게시물을 본 적이 있지만 아무도 나를 도와 줄 수 없습니다. 나는 안드로이드를 하나의 음성 채팅 앱으로 만들고있다. 그러나 그 점점 멈췄다. 또한 매니페스트의 모든 권한을 설정합니다. 다음은 매니페스트 코드입니다.불행히도 응용 프로그램이 에뮬레이터에서 중지되었습니다
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.bridgecall"
android:versionCode="1"
android:versionName="1.0" >
<uses-sdk
android:minSdkVersion="8"
android:targetSdkVersion="18" />
<uses-feature android:name="android.hardware.wifi" android:required="true" />
<uses-feature android:name="android.hardware.microphone" android:required="true" />
<uses-permission android:name="android.permission.USE_SIP" />
<uses-permission android:name="android.permission.INTERNET" />
<application
android:allowBackup="true"
android:icon="@drawable/ic_launcher"
android:label="@string/app_name"
android:theme="@style/AppTheme" >
<activity
android:name="com.bridgecall.CallActivity"
android:label="@string/app_name" >
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
<activity
android:name="com.bridgecall.sender" >
</activity>
</application>
</manifest>
이 문제에 도움이 될까요?
04-05 17:43:52.427: E/dalvikvm(1415): Could not find class 'javax.sound.sampled.AudioFormat', referenced from method com.bridgecall.CallActivity.getAudioFormat
04-05 17:43:52.427: W/dalvikvm(1415): VFY: unable to resolve new-instance 824 (Ljavax/sound/sampled/AudioFormat;) in Lcom/bridgecall/CallActivity;
04-05 17:43:52.427: D/dalvikvm(1415): VFY: replacing opcode 0x22 at 0x0007
04-05 17:43:52.537: I/dalvikvm(1415): Could not find method javax.sound.sampled.AudioSystem.getMixerInfo, referenced from method com.bridgecall.CallActivity.callStart
04-05 17:43:52.537: W/dalvikvm(1415): VFY: unable to resolve static method 5343: Ljavax/sound/sampled/AudioSystem;.getMixerInfo()[Ljavax/sound/sampled/Mixer$Info;
04-05 17:43:52.537: D/dalvikvm(1415): VFY: replacing opcode 0x71 at 0x0025
04-05 17:43:52.607: D/dalvikvm(1415): DexOpt: unable to opt direct call 0x14dc at 0x09 in Lcom/bridgecall/CallActivity;.getAudioFormat
04-05 17:43:52.717: D/dalvikvm(1415): DexOpt: unable to opt direct call 0x14e0 at 0x35 in Lcom/bridgecall/CallActivity;.callStart
04-05 17:43:52.717: D/dalvikvm(1415): DexOpt: unable to opt direct call 0x14e0 at 0x61 in Lcom/bridgecall/CallActivity;.callStart
04-05 17:43:53.607: W/dalvikvm(1415): VFY: unable to resolve exception class 831 (Ljavax/sound/sampled/LineUnavailableException;)
04-05 17:43:53.607: W/dalvikvm(1415): VFY: unable to find exception handler at addr 0x10
04-05 17:43:53.617: W/dalvikvm(1415): VFY: rejected Lcom/bridgecall/sender;.<init>()V
04-05 17:43:53.617: W/dalvikvm(1415): VFY: rejecting opcode 0x0d at 0x0010
04-05 17:43:53.617: W/dalvikvm(1415): VFY: rejected Lcom/bridgecall/sender;.<init>()V
04-05 17:43:53.637: W/dalvikvm(1415): Verifier rejected class Lcom/bridgecall/sender;
04-05 17:43:53.637: W/dalvikvm(1415): Class init failed in newInstance call (Lcom/bridgecall/sender;)
04-05 17:43:53.637: D/AndroidRuntime(1415): Shutting down VM
04-05 17:43:53.637: W/dalvikvm(1415): threadid=1: thread exiting with uncaught exception (group=0xb3a66ba8)
04-05 17:43:53.677: E/AndroidRuntime(1415): FATAL EXCEPTION: main
04-05 17:43:53.677: E/AndroidRuntime(1415): Process: com.bridgecall, PID: 1415
04-05 17:43:53.677: E/AndroidRuntime(1415): java.lang.VerifyError: com/bridgecall/sender
04-05 17:43:53.677: E/AndroidRuntime(1415): at java.lang.Class.newInstanceImpl(Native Method)
04-05 17:43:53.677: E/AndroidRuntime(1415): at java.lang.Class.newInstance(Class.java:1208)
04-05 17:43:53.677: E/AndroidRuntime(1415): at android.app.Instrumentation.newActivity(Instrumentation.java:1061)
04-05 17:43:53.677: E/AndroidRuntime(1415): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2112)
04-05 17:43:53.677: E/AndroidRuntime(1415): at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2245)
04-05 17:43:53.677: E/AndroidRuntime(1415): at android.app.ActivityThread.access$800(ActivityThread.java:135)
04-05 17:43:53.677: E/AndroidRuntime(1415): at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1196)
04-05 17:43:53.677: E/AndroidRuntime(1415): at android.os.Handler.dispatchMessage(Handler.java:102)
04-05 17:43:53.677: E/AndroidRuntime(1415): at android.os.Looper.loop(Looper.java:136)
04-05 17:43:53.677: E/AndroidRuntime(1415): at android.app.ActivityThread.main(ActivityThread.java:5017)
04-05 17:43:53.677: E/AndroidRuntime(1415): at java.lang.reflect.Method.invokeNative(Native Method)
04-05 17:43:53.677: E/AndroidRuntime(1415): at java.lang.reflect.Method.invoke(Method.java:515)
04-05 17:43:53.677: E/AndroidRuntime(1415): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:779)
04-05 17:43:53.677: E/AndroidRuntime(1415): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:595)
04-05 17:43:53.677: E/AndroidRuntime(1415): at dalvik.system.NativeStart.main(Native Method)
04-05 17:43:57.027: I/Process(1415): Sending signal. PID: 1415 SIG: 9
내 CallActivity 클래스
package com.bridgecall;
import java.io.BufferedInputStream;
import java.io.BufferedOutputStream;
import java.io.ByteArrayOutputStream;
import java.net.Socket;
import javax.sound.sampled.AudioFormat;
import javax.sound.sampled.AudioInputStream;
import javax.sound.sampled.AudioSystem;
import javax.sound.sampled.DataLine;
import javax.sound.sampled.Mixer;
import javax.sound.sampled.SourceDataLine;
import javax.sound.sampled.TargetDataLine;
import android.os.Bundle;
import android.app.Activity;
import android.content.Intent;
import android.view.Menu;
public class CallActivity extends Activity {
boolean stopCapture = false;
ByteArrayOutputStream byteArrayOutputStream;
AudioFormat audioFormat;
TargetDataLine targetDataLine;
AudioInputStream audioInputStream;
BufferedOutputStream out = null;
BufferedInputStream in = null;
Socket sock = null;
SourceDataLine sourceDataLine;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_call);
Intent intent = new Intent(this, sender.class);
startActivity(intent);
}
@Override
public boolean onCreateOptionsMenu(Menu menu) {
// Inflate the menu; this adds items to the action bar if it is present.
getMenuInflater().inflate(R.menu.call, menu);
return true;
}
public void callStart()
{
try {
int port = 6039;
String host= "192.168.1.120";
sock = new Socket(host, port);
out = new BufferedOutputStream(sock.getOutputStream());
in = new BufferedInputStream(sock.getInputStream());
Mixer.Info[] mixerInfo = AudioSystem.getMixerInfo();
audioFormat = getAudioFormat();
DataLine.Info dataLineInfo = new DataLine.Info(
TargetDataLine.class, audioFormat);
Mixer mixer = AudioSystem.getMixer(mixerInfo[3]);
targetDataLine = (TargetDataLine) mixer.getLine(dataLineInfo);
targetDataLine.open(audioFormat);
targetDataLine.start();
Thread captureThread = new CaptureThread();
captureThread.start();
DataLine.Info dataLineInfo1 = new DataLine.Info(
SourceDataLine.class, audioFormat);
sourceDataLine = (SourceDataLine) AudioSystem
.getLine(dataLineInfo1);
sourceDataLine.open(audioFormat);
sourceDataLine.start();
} catch (Exception e) {
}
}
class CaptureThread extends Thread {
byte tempBuffer[] = new byte[1000];
public void run() {
byteArrayOutputStream = new ByteArrayOutputStream();
stopCapture = false;
try {
while (!stopCapture) {
int cnt = targetDataLine.read(tempBuffer, 0,
tempBuffer.length);
out.write(tempBuffer);
if (cnt > 0) {
byteArrayOutputStream.write(tempBuffer, 0, cnt);
}
}
byteArrayOutputStream.close();
} catch (Exception e) {
}
}
}
private AudioFormat getAudioFormat() {
float sampleRate = 8000.0F;
int sampleSizeInBits = 8;
int channels = 1;
boolean signed = true;
boolean bigEndian = false;
return new AudioFormat(sampleRate, sampleSizeInBits, channels, signed,
bigEndian);
}
}
및 보낸 사람 클래스 : 여기
로그 고양이package com.bridgecall;
import java.io.BufferedInputStream;
import java.io.BufferedOutputStream;
import java.io.ByteArrayOutputStream;
import java.io.IOException;
import java.net.ServerSocket;
import java.net.Socket;
import javax.sound.sampled.AudioFormat;
import javax.sound.sampled.AudioSystem;
import javax.sound.sampled.DataLine;
import javax.sound.sampled.LineUnavailableException;
import javax.sound.sampled.Mixer;
import javax.sound.sampled.SourceDataLine;
import javax.sound.sampled.TargetDataLine;
public class sender {
ServerSocket MyService;
Socket clientSocket = null;
BufferedInputStream input;
TargetDataLine targetDataLine;
BufferedOutputStream out;
ByteArrayOutputStream byteArrayOutputStream;
AudioFormat audioFormat;
SourceDataLine sourceDataLine;
byte tempBuffer[] = new byte[1000];
public sender() {
try
{
mysender();
}
catch(LineUnavailableException e)
{
}
}
public void mysender() throws LineUnavailableException {
try {
audioFormat = getAudioFormat();
DataLine.Info dataLineInfo = new DataLine.Info(SourceDataLine.class,audioFormat);
sourceDataLine = (SourceDataLine)
AudioSystem.getLine(dataLineInfo);
sourceDataLine.open(audioFormat);
sourceDataLine.start();
int port= 6039;
MyService = new ServerSocket(port);
clientSocket = MyService.accept();
captureAudio();
input = new BufferedInputStream(clientSocket.getInputStream());
out = new BufferedOutputStream(clientSocket.getOutputStream());
while(input.read(tempBuffer)!=-1){
sourceDataLine.write(tempBuffer,0,1000);
}
} catch (IOException e) {
}
}
private AudioFormat getAudioFormat(){
float sampleRate = 8000.0F;
int sampleSizeInBits = 8;
int channels = 1;
boolean signed = true;
boolean bigEndian = false;
return new AudioFormat(
sampleRate,
sampleSizeInBits,
channels,
signed,
bigEndian);
}
private void captureAudio() {
try {
Mixer.Info[] mixerInfo = AudioSystem.getMixerInfo();
audioFormat = getAudioFormat();
DataLine.Info dataLineInfo = new DataLine.Info(
TargetDataLine.class, audioFormat);
Mixer mixer = AudioSystem.getMixer(mixerInfo[3]);
targetDataLine = (TargetDataLine) mixer.getLine(dataLineInfo);
targetDataLine.open(audioFormat);
targetDataLine.start();
Thread captureThread = new CaptureThread();
captureThread.start();
} catch (Exception e) {
}
}
class CaptureThread extends Thread {
byte tempBuffer[] = new byte[1000];
public void run() {
try {
while (true) {
int cnt = targetDataLine.read(tempBuffer, 0,
tempBuffer.length);
out.write(tempBuffer);
}
} catch (Exception e) {
}
}
}
public static void main(String args[]) {
new sender();
}
}
봐 시작됩니다 클래스 및 응용 프로그램을 포함를 찾을 수 없습니다. 이것은 대개 잘못된 것을 말해줍니다. 그래도 문제가 해결되지 않으면 여기에 스택 추적을 게시하십시오. – nhaarman
예외를 일으키는 코드와 예외를 표시해야합니다. – joao2fast4u
로그 고양이를 게시했습니다 .. 그러나 도움이되지 않는다면 src 코드를 넣을 것입니다. – user3502063