Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

problem with permission with targetSdkVersion 27 #102

Open
umeshsarkar opened this issue Aug 13, 2018 · 1 comment
Open

problem with permission with targetSdkVersion 27 #102

umeshsarkar opened this issue Aug 13, 2018 · 1 comment

Comments

@umeshsarkar
Copy link

umeshsarkar commented Aug 13, 2018

I did change with targestSdkVersion 27 and some other changes.
After that while, I m click on record button application gets crashed.

Error Log

--------- beginning of crash
08-13 16:24:26.409 15009-15009/com.topgamesandapps.audiorecorder E/AndroidRuntime: FATAL EXCEPTION: main
Process: com.topgamesandapps.audiorecorder, PID: 15009
java.lang.RuntimeException: Unable to start service com.topgamesandapps.audiorecorder.RecordingService@1cedefa with Intent { cmp=com.topgamesandapps.audiorecorder/.RecordingService }: java.lang.RuntimeException: setAudioSource failed.
at android.app.ActivityThread.handleServiceArgs(ActivityThread.java:3491)
at android.app.ActivityThread.-wrap20(Unknown Source:0)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1692)
at android.os.Handler.dispatchMessage(Handler.java:106)
at android.os.Looper.loop(Looper.java:164)
at android.app.ActivityThread.main(ActivityThread.java:6494)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:438)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:807)
Caused by: java.lang.RuntimeException: setAudioSource failed.
at android.media.MediaRecorder.setAudioSource(Native Method)
at com.topgamesandapps.audiorecorder.RecordingService.startRecording(RecordingService.java:93)
at com.topgamesandapps.audiorecorder.RecordingService.onStartCommand(RecordingService.java:77)

at android.app.ActivityThread.handleServiceArgs(ActivityThread.java:3474)
at android.app.ActivityThread.-wrap20(Unknown Source:0) 
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1692) 
at android.os.Handler.dispatchMessage(Handler.java:106) 
at android.os.Looper.loop(Looper.java:164) 
at android.app.ActivityThread.main(ActivityThread.java:6494) 
at java.lang.reflect.Method.invoke(Native Method) 
at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:438) 
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:807) 

RecordingService.java
line no.

75 @OverRide
76 public int onStartCommand(Intent intent, int flags, int startId) {
77 startRecording();
78 return START_STICKY;
79 }
.
.
.
.
92 mRecorder = new MediaRecorder();
93 mRecorder.setAudioSource(MediaRecorder.AudioSource.MIC);
94 mRecorder.setOutputFormat(MediaRecorder.OutputFormat.MPEG_4);
.

@naXa777
Copy link

naXa777 commented Aug 25, 2018

Pay attention to these lines, this is the cause of your error:

java.lang.RuntimeException: Unable to start service com.topgamesandapps.audiorecorder.RecordingService@1cedefa with Intent { cmp=com.topgamesandapps.audiorecorder/.RecordingService }: java.lang.RuntimeException: setAudioSource failed.
Caused by: java.lang.RuntimeException: setAudioSource failed.
at android.media.MediaRecorder.setAudioSource(Native Method)
at com.topgamesandapps.audiorecorder.RecordingService.startRecording(RecordingService.java:93)

Investigate the stack trace carefully, it usually contains enough information to pinpoint an exception cause.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants