Media Recorder getActiveMicrophones() fail in real device - java

I'm trying to set media devices for webRTC conference and when I test from my Android emulator it runs fine but when I use getActiveMicrophones() method running a real phone it crashes with the following log:
D/AppRTCAudioManager: --- updateAudioDeviceState: wired headset=true, BT state=HEADSET_UNAVAILABLE
D/AppRTCAudioManager: Device status: available=[], selected=NONE, user selected=NONE
setAudioDeviceInternal(device=WIRED_HEADSET)
D/AppRTCAudioManager: New device status: available=[WIRED_HEADSET], selected=WIRED_HEADSET
D/ConferenceManager: onAudioManagerDevicesChanged: [WIRED_HEADSET], selected: WIRED_HEADSET
E/MediaRecorderJNI: MediaRecorder::getActiveMicrophones error -19
E/MediaRecorder: getActiveMicrophones failed:-5
I/MediaRecorder: getActiveMicrophones failed, fallback on routed device info
D/AndroidRuntime: Shutting down VM
E/AndroidRuntime: FATAL EXCEPTION: main
Process: com.example.talentumtraining, PID: 18457
java.lang.RuntimeException: getRoutedDeviceId failed.
at android.media.MediaRecorder.native_getRoutedDeviceId(Native Method)
at android.media.MediaRecorder.getRoutedDevice(MediaRecorder.java:1354)
at android.media.MediaRecorder.getActiveMicrophones(MediaRecorder.java:1452)
at com.example.talentumtraining.fragment.FragmentClinicConfigurations$SoundMeter.getDevices(FragmentClinicConfigurations.java:522)
at com.example.talentumtraining.fragment.FragmentClinicConfigurations.onAudioManagerDevicesChanged(FragmentClinicConfigurations.java:405)
at com.example.talentumtraining.fragment.FragmentClinicConfigurations.access$000(FragmentClinicConfigurations.java:59)
at com.example.talentumtraining.fragment.FragmentClinicConfigurations$1.onAudioDeviceChanged(FragmentClinicConfigurations.java:228)
at io.antmedia.webrtcandroidframework.apprtc.CustomAppRTCAudioManager.updateAudioDeviceState(CustomAppRTCAudioManager.java:581)
at io.antmedia.webrtcandroidframework.apprtc.CustomAppRTCAudioManager.start(CustomAppRTCAudioManager.java:278)
at com.example.talentumtraining.fragment.FragmentClinicConfigurations.onStart(FragmentClinicConfigurations.java:224)
at androidx.fragment.app.Fragment.performStart(Fragment.java:2730)
at androidx.fragment.app.FragmentStateManager.start(FragmentStateManager.java:365)
at androidx.fragment.app.FragmentManager.moveToState(FragmentManager.java:1194)
at androidx.fragment.app.FragmentManager.moveToState(FragmentManager.java:1356)
at androidx.fragment.app.FragmentManager.moveFragmentToExpectedState(FragmentManager.java:1434)
at androidx.fragment.app.FragmentManager.moveToState(FragmentManager.java:1497)
at androidx.fragment.app.BackStackRecord.executeOps(BackStackRecord.java:447)
at androidx.fragment.app.FragmentManager.executeOps(FragmentManager.java:2169)
at androidx.fragment.app.FragmentManager.executeOpsTogether(FragmentManager.java:1992)
at androidx.fragment.app.FragmentManager.removeRedundantOperationsAndExecute(FragmentManager.java:1947)
at androidx.fragment.app.FragmentManager.execPendingActions(FragmentManager.java:1849)
at androidx.fragment.app.FragmentManager$4.run(FragmentManager.java:413)
at android.os.Handler.handleCallback(Handler.java:873)
at android.os.Handler.dispatchMessage(Handler.java:99)
at android.os.Looper.loop(Looper.java:192)
at android.app.ActivityThread.main(ActivityThread.java:7049)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:493)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:913)
I don't see why it is failing. Any idea?
Thanks in advance.

Related

app crashes when try to get text from clipboard (Android 12)

I want to get the primary text on my clipboard and would like to know how to do that in newer android versions.
This code works perfectly when I tested it in an emulator running Android Pie, but the app crashes when I use it on my Phone running android 12.1.
please help me with this.
clipboard = (ClipboardManager) getSystemService(Context.CLIPBOARD_SERVICE);
if (clipboard.hasPrimaryClip())
clipItem = clipboard.getPrimaryClip().getItemAt(0);
clipText = clipItem.getText().toString();
Details.setText(clipItem.getText().toString());
Here's the Error I got from Logcat
2022-10-01 19:23:27.595 1349-5125 ClipboardService pid-1349 E Denying clipboard access to com.jery.tachisyrpc, the application is not in focus nor is it a system service for user 0
2022-10-01 19:23:27.595 8222-8222 AndroidRuntime com.jery.tachisyrpc D Shutting down VM
2022-10-01 19:23:27.596 8222-8222 AndroidRuntime com.jery.tachisyrpc E FATAL EXCEPTION: main
Process: com.jery.tachisyrpc, PID: 8222
java.lang.RuntimeException: Unable to start activity ComponentInfo{com.jery.tachisyrpc/com.jery.tachisyrpc.MainActivity}: java.lang.NullPointerException: Attempt to invoke virtual method 'java.lang.CharSequence android.content.ClipData$Item.getText()' on a null object reference at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:4111) at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:4277) at android.app.servertransaction.LaunchActivityItem.execute(LaunchActivityItem.java:103)at android.app.servertransaction.TransactionExecutor.executeCallbacks(TransactionExecutor.java:135) at android.app.servertransaction.TransactionExecutor.execute(TransactionExecutor.java:95) at android.app.ActivityThread$H.handleMessage(ActivityThread.java:2443) at android.os.Handler.dispatchMessage(Handler.java:106) at android.os.Looper.loopOnce(Looper.java:226) at android.os.Looper.loop(Looper.java:313)
at android.app.ActivityThread.main(ActivityThread.java:8751)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:571)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1135)
Caused by: java.lang.NullPointerException: Attempt to invoke virtual method 'java.lang.CharSequence android.content.ClipData$Item.getText()' on a null object reference
at com.jery.tachisyrpc.MainActivity.onCreate(MainActivity.java:55)
at android.app.Activity.performCreate(Activity.java:8290)
at android.app.Activity.performCreate(Activity.java:8270)
at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1329)
at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:4085)
at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:4277) 
at android.app.servertransaction.LaunchActivityItem.execute(LaunchActivityItem.java:103) 
at android.app.servertransaction.TransactionExecutor.executeCallbacks(TransactionExecutor.java:135) 
at android.app.servertransaction.TransactionExecutor.execute(TransactionExecutor.java:95) 
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:2443) 
at android.os.Handler.dispatchMessage(Handler.java:106) 
at android.os.Looper.loopOnce(Looper.java:226) 
at android.os.Looper.loop(Looper.java:313) 
at android.app.ActivityThread.main(ActivityThread.java:8751) 
at java.lang.reflect.Method.invoke(Native Method) 
at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:571) 
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1135)

Can't send and receive SMS with LineageOS 14.1

I have got a problem with sending and receiving SMS from my mobile (Samsung Galaxy S3) which runs LineageOS 14.1-20170405-NIGHTLY-i9300.
Since a few weeks I can't either send or receive messages with the normal android messaging application and also with SMS applications from the Google Play Store.
I really don't know what to do and it seems like nobody else has got this problem...
The logcat says the following after I tried to send a message:
04-08 13:58:50.229 24428-24428/com.android.messaging I/MessagingApp: UI initiated message sending in conversation 3
04-08 13:58:50.365 24428-24635/com.android.messaging I/MessagingAppDataModel: InsertNewMessageAction: inserting new message
04-08 13:58:50.525 24428-24635/com.android.messaging E/MessagingApp: Uncaught exception in background thread Thread[IntentService[ActionService],5,main]
04-08 13:58:50.526 24428-24635/com.android.messaging E/MessagingApp: java.lang.NullPointerException: Uri must not be null
at android.os.Parcel.readException(Parcel.java:1690)
at android.database.DatabaseUtils.readExceptionFromParcel(DatabaseUtils.java:183)
at android.database.DatabaseUtils.readExceptionFromParcel(DatabaseUtils.java:135)
at android.content.ContentProviderProxy.insert(ContentProviderNative.java:476)
at android.content.ContentResolver.insert(ContentResolver.java:1279)
at com.android.messaging.sms.i.ahJ(SourceFile:879)
at com.android.messaging.sms.i.ahz(SourceFile:888)
at com.android.messaging.datamodel.action.InsertNewMessageAction.KA(SourceFile:378)
at com.android.messaging.datamodel.action.InsertNewMessageAction.IV(SourceFile:171)
at com.android.messaging.datamodel.action.ActionServiceImpl.Ji(SourceFile:305)
at com.android.messaging.datamodel.action.ActionServiceImpl.onHandleIntent(SourceFile:267)
at android.app.IntentService$ServiceHandler.handleMessage(IntentService.java:68)
at android.os.Handler.dispatchMessage(Handler.java:102)
at android.os.Looper.loop(Looper.java:154)
at android.os.HandlerThread.run(HandlerThread.java:61)
04-08 13:58:50.545 24428-24428/com.android.messaging E/AndroidRuntime: FATAL EXCEPTION: IntentService[ActionService]
Process: com.android.messaging, PID: 24428
java.lang.NullPointerException: Uri must not be null
at android.os.Parcel.readException(Parcel.java:1690)
at android.database.DatabaseUtils.readExceptionFromParcel(DatabaseUtils.java:183)
at android.database.DatabaseUtils.readExceptionFromParcel(DatabaseUtils.java:135)
at android.content.ContentProviderProxy.insert(ContentProviderNative.java:476)
at android.content.ContentResolver.insert(ContentResolver.java:1279)
at com.android.messaging.sms.i.ahJ(SourceFile:879)
at com.android.messaging.sms.i.ahz(SourceFile:888)
at com.android.messaging.datamodel.action.InsertNewMessageAction.KA(SourceFile:378)
at com.android.messaging.datamodel.action.InsertNewMessageAction.IV(SourceFile:171)
at com.android.messaging.datamodel.action.ActionServiceImpl.Ji(SourceFile:305)
at com.android.messaging.datamodel.action.ActionServiceImpl.onHandleIntent(SourceFile:267)
at android.app.IntentService$ServiceHandler.handleMessage(IntentService.java:68)
at android.os.Handler.dispatchMessage(Handler.java:102)
at android.os.Looper.loop(Looper.java:154)
at android.os.HandlerThread.run(HandlerThread.java:61)
Does anybody know what I have to do now?
I really have no idea...
Thank you in advance!

TransactionTooLargeException when appying wallpaper

I know that TransactionTooLargeException occurs when there is a large amount of data being transferred between services in the system. Usually, I would have some kind of control if I were to transfer large amount of data, but in this case, when I'm appying a wallpaper, I don't have that amount of control.
I'm applying a wallpaper by first cropping it with android-image-cropper, and then applying it by
WallpaperManager.setBitmap(bitmap);
...in a separate thread, to avoid overloading the UI thread. Now, when I press "apply wallpaper", and wait for some time, and then return to the homescreen, it works flawlessly, but when I apply the wallpaper and then immediately return to the homescreen, I get the alert that the app has crashed, along with this log:
07-31 18:50:41.611 32720-32720/elementary.elementarywallpapers E/JavaBinder: !!! FAILED BINDER TRANSACTION !!! (parcel size = 16385936)
07-31 18:50:41.614 32720-32720/elementary.elementarywallpapers D/AndroidRuntime: Shutting down VM
07-31 18:50:41.621 32720-32720/elementary.elementarywallpapers E/AndroidRuntime: FATAL EXCEPTION: main
Process: elementary.elementarywallpapers, PID: 32720
java.lang.RuntimeException: android.os.TransactionTooLargeException: data parcel size 16385936 bytes
at android.app.ActivityThread$StopInfo.run(ActivityThread.java:3752)
at android.os.Handler.handleCallback(Handler.java:751)
at android.os.Handler.dispatchMessage(Handler.java:95)
at android.os.Looper.loop(Looper.java:154)
at android.app.ActivityThread.main(ActivityThread.java:6077)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:865)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:755)
Caused by: android.os.TransactionTooLargeException: data parcel size 16385936 bytes
at android.os.BinderProxy.transactNative(Native Method)
at android.os.BinderProxy.transact(Binder.java:615)
at android.app.ActivityManagerProxy.activityStopped(ActivityManagerNative.java:3606)
at android.app.ActivityThread$StopInfo.run(ActivityThread.java:3744)
at android.os.Handler.handleCallback(Handler.java:751) 
at android.os.Handler.dispatchMessage(Handler.java:95) 
at android.os.Looper.loop(Looper.java:154) 
at android.app.ActivityThread.main(ActivityThread.java:6077) 
at java.lang.reflect.Method.invoke(Native Method) 
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:865) 
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:755) 
How can I fix this?

App crashes when restoring from background

I have static values that are deleted after my application is a long time in the background or after opening many different apps, causing that my app crashes.
I think that Android OS is removing data from my app or "killing" it.
Is there any way to keep my app's data to avoid this problem?
NOTE: I can't save this values on SharedPreferences or in a database because there are many HashMaps and ArrayLists, is too much information.
It is necessary that these values are static because I need them available in many classes o my app in any time.
E/AndroidRuntime: FATAL EXCEPTION: main
java.lang.RuntimeException: Unable to start activity ComponentInfo{com.proyect/com.proyect.gui.ActivityMenu}: java.lang.NullPointerException: println needs a message
at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2266)
at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2316)
at android.app.ActivityThread.access$600(ActivityThread.java:150)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1298)
at android.os.Handler.dispatchMessage(Handler.java:99)
at android.os.Looper.loop(Looper.java:213)
at android.app.ActivityThread.main(ActivityThread.java:5225)
at java.lang.reflect.Method.invokeNative(Native Method)
at java.lang.reflect.Method.invoke(Method.java:525)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:741)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:557)
at dalvik.system.NativeStart.main(Native Method)
Caused by: java.lang.NullPointerException: println needs a message
at android.util.Log.println_native(Native Method)
at android.util.Log.v(Log.java:117)
at com.proyect.gui.FragmentMenu.onActivityCreated(FragmentMenu.java:145)
at android.support.v4.app.Fragment.performActivityCreated(Fragment.java:1983)
at android.support.v4.app.FragmentManagerImpl.moveToState(FragmentManager.java:1092)
at android.support.v4.app.FragmentManagerImpl.moveToState(FragmentManager.java:1252)
at android.support.v4.app.FragmentManagerImpl.moveToState(FragmentManager.java:1234)
at android.support.v4.app.FragmentManagerImpl.dispatchActivityCreated(FragmentManager.java:2046)
at android.support.v4.app.FragmentController.dispatchActivityCreated(FragmentController.java:174)
at android.support.v4.app.FragmentActivity.onStart(FragmentActivity.java:597)
at android.app.Instrumentation.callActivityOnStart(Instrumentation.java:1171)
at android.app.Activity.performStart(Activity.java:5143)
at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2239)
at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2316) 
at android.app.ActivityThread.access$600(ActivityThread.java:150) 
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1298) 
at android.os.Handler.dispatchMessage(Handler.java:99) 
at android.os.Looper.loop(Looper.java:213) 
at android.app.ActivityThread.main(ActivityThread.java:5225) 
at java.lang.reflect.Method.invokeNative(Native Method) 
at java.lang.reflect.Method.invoke(Method.java:525) 
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:741) 
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:557) 
at dalvik.system.NativeStart.main(Native Method) 
Change this:
Log.v("errorTag", e.getMessage());
To this:
String error = e.getMessage();
if(error == null)
error = "It's crashed here";
Log.v("errorTag", error );
OR SIMPLER
Log.v("errorTag", e );
The point is that e.getMessage() is null. So, always check if e.getMessage() is not null before print it

Android Array Out of Bound Exception

I have built a Android App thats has a WebView to show a mobile website within the app.
I have started to get this exception on one device particularly
This issue is not seen on other devices.
I went through the source code and it looks like an issue with Android. Can any one help me understand that if we can do anything else in the app to suppress this exception
Note: In the stack trace, there is nothing related to the app code
AndroidAppCrashDump {"brand":"samsung","model":"GT-S6312","sdk":16,"android":"4.1.2","appVersion":"1.1.15","manufacturer":"samsung"}----java.lang.ArrayIndexOutOfBoundsException: length=1; index=1109619192 at
java.util.Arrays.fill(Arrays.java:855) at
android.support.v4.widget.ViewDragHelper.clearMotionHistory(ViewDragHelper.java:773) at
android.support.v4.widget.ViewDragHelper.cancel(ViewDragHelper.java:499) at
android.support.v4.widget.ViewDragHelper.shouldInterceptTouchEvent(ViewDragHelper.java:1031) at
android.support.v4.widget.DrawerLayout.onInterceptTouchEvent(DrawerLayout.java:868) at
android.view.ViewGroup.dispatchTouchEvent(ViewGroup.java:1877) at
android.view.ViewGroup.dispatchTransformedTouchEvent(ViewGroup.java:2237) at
an droid.view.ViewGroup.dispatchTouchEvent(ViewGroup.java:1979) at
android.view.ViewGroup.dispatchTransformedTouchEvent(ViewGroup.java:2237) at
android.view.ViewGroup.dispatchTouchEvent(ViewGroup.java:1979) at
android.view.ViewGroup.dispatchTransformedTouchEvent(ViewGroup.java:2237) at
android.view.ViewGroup.dispatchTouchEvent(ViewGroup.java:1979) at
com.android.internal.policy.impl.PhoneWindow$DecorView.superDispatchTouchEvent(PhoneWindow.java:2177) at
com.android.internal.policy.impl.PhoneWindow.superDispatchTouchEvent(PhoneWindow.java:1482) at
android.app.Activity.dispatchTouchEvent(Activity.java:2469) at
android.support.v7.app.ActionBarActivityDelegateICS$WindowCallbackWrapper.dispatchTouchEvent(ActionBarActivityDelegateICS.java:260) at
com.android.internal.policy.impl.PhoneWindow$DecorView.dispatchTouchEvent(PhoneWindow.java:2125) at
android.view.View.dispatchPointerEvent(View.java:7414) at
android.view.ViewRootImpl.deliverPointerEvent(ViewRootImpl.java:3523) at
android.vi ew.ViewRootImpl.deliverInputEvent(ViewRootImpl.java:3455) at
android.view.ViewRootImpl.doProcessInputEvents(ViewRootImpl.java:4565) at
android.view.ViewRootImpl.enqueueInputEvent(ViewRootImpl.java:4543) at
android.view.ViewRootImpl$WindowInputEventReceiver.onInputEvent(ViewRootImpl.java:4647) at
android.view.InputEventReceiver.dispatchInputEvent(InputEventReceiver.java:171) at
android.os.MessageQueue.nativePollOnce(Native Method) at
android.os.MessageQueue.next(MessageQueue.java:125) at
android.os.Looper.loop(Looper.java:124) at
android.app.ActivityThread.main(ActivityThread.java:4963) at
java.lang.reflect.Method.invokeNative(Native Method) at
java.lang.reflect.Method.invoke(Method.java:511) at
com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:1038) at
com.android.internal.os.ZygoteInit.main(ZygoteInit.java:805) at
dalvik.system.NativeStart.main(Native Method)

Categories

Resources