Problems reading gyroscope - android

I´m developing an app that reads the gyroscope and generates a graph with its values. I already did it using the accelerometer (Sensor.TYPE_ACCELEROMETER) and it did fine, but when I use the gyroscope(Sensor.TYPE_GYROSCOPE), the app closes.
I´m using SDK 16, and looking into the class the type_gyroscope is marked as deprecated, but I tried the SDK 21 and continued having the same problem. Does someone know what is happening?
LogCat:
10-05 02:10:58.117 3934-3934/com.smartapps.accel E/SensorManager: sensor or listener is null
10-05 02:11:00.700 3934-3934/com.smartapps.accel D/AndroidRuntime: Shutting down VM --------- beginning of crash
10-05 02:11:00.703 3934-3934/com.smartapps.accel E/AndroidRuntime: FATAL EXCEPTION: main
Process: com.smartapps.accel, PID: 3934
java.lang.IndexOutOfBoundsException: Index: 0, Size: 0
at java.util.ArrayList.get(ArrayList.java:437)
at com.smartapps.accel.MainActivity.openChart(MainActivity.java:114)
at com.smartapps.accel.MainActivity.onClick(MainActivity.java:103)
at android.view.View.performClick(View.java:6256)
at android.view.View$PerformClick.run(View.java:24697)
at android.os.Handler.handleCallback(Handler.java:789)
at android.os.Handler.dispatchMessage(Handler.java:98)
at android.os.Looper.loop(Looper.java:164)
at android.app.ActivityThread.main(ActivityThread.java:6541)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.Zygote$MethodAndArgsCaller.run(Zygote.java:240)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:767)

Related

My app closes on physical device as soon as startup

I am testing a demo of an integration, it is an ionic application (with cordova)
I created the android platform and when I run it on emulators with API 26, 30 or 31, it works correctly; but I find that when testing on a physical device (API 31) as soon as I open it, it loads the splash and then closes.
I add the code that shows the terminal, I have searched in several forums and none of the solutions seem to fit my problem
I/chromium: [INFO:CONSOLE(100770)] "Ionic Native: deviceready event fired after 2039 ms", source: http://localhost/vendor-es2015.js (100770)
W/KeyStore: KeyStore exception
android.os.ServiceSpecificException: (code 7)
at android.os.Parcel.createExceptionOrNull(Parcel.java:2387)
at android.os.Parcel.createException(Parcel.java:2357)
at android.os.Parcel.readException(Parcel.java:2340)
at android.os.Parcel.readException(Parcel.java:2282)
at android.security.keystore.IKeystoreService$Stub$Proxy.get(IKeystoreService.java:988)
at android.security.KeyStore.get(KeyStore.java:233)
at android.security.KeyStore.get(KeyStore.java:222)
at android.security.keystore.AndroidKeyStoreSpi.engineGetCertificate(AndroidKeyStoreSpi.java:160)
at java.security.KeyStore.getCertificate(KeyStore.java:1120)
at com.crypho.plugins.RSA.loadKey(RSA.java:71)
at com.crypho.plugins.RSA.isEntryAvailable(RSA.java:51)
at com.crypho.plugins.SecureStorage.execute(SecureStorage.java:105)
at org.apache.cordova.CordovaPlugin.execute(CordovaPlugin.java:117)
at org.apache.cordova.CordovaPlugin.execute(CordovaPlugin.java:98)
at org.apache.cordova.PluginManager.exec(PluginManager.java:132)
at org.apache.cordova.CordovaBridge.jsExec(CordovaBridge.java:59)
at org.apache.cordova.engine.SystemExposedJsApi.exec(SystemExposedJsApi.java:41)
at android.os.MessageQueue.nativePollOnce(Native Method)
at android.os.MessageQueue.next(MessageQueue.java:342)
at android.os.Looper.loop(Looper.java:197)
at android.os.HandlerThread.run(HandlerThread.java:67)
W/KeyStore: KeyStore exception
android.os.ServiceSpecificException: (code 7)
at android.os.Parcel.createExceptionOrNull(Parcel.java:2387)
at android.os.Parcel.createException(Parcel.java:2357)
at android.os.Parcel.readException(Parcel.java:2340)
at android.os.Parcel.readException(Parcel.java:2282)
at android.security.keystore.IKeystoreService$Stub$Proxy.get(IKeystoreService.java:988)
at android.security.KeyStore.get(KeyStore.java:233)
at android.security.KeyStore.get(KeyStore.java:222)
at android.security.keystore.AndroidKeyStoreSpi.engineGetCertificate(AndroidKeyStoreSpi.java:165)
at java.security.KeyStore.getCertificate(KeyStore.java:1120)
at com.crypho.plugins.RSA.loadKey(RSA.java:71)
at com.crypho.plugins.RSA.isEntryAvailable(RSA.java:51)
at com.crypho.plugins.SecureStorage.execute(SecureStorage.java:105)
at org.apache.cordova.CordovaPlugin.execute(CordovaPlugin.java:117)
at org.apache.cordova.CordovaPlugin.execute(CordovaPlugin.java:98)
at org.apache.cordova.PluginManager.exec(PluginManager.java:132)
at org.apache.cordova.CordovaBridge.jsExec(CordovaBridge.java:59)
at org.apache.cordova.engine.SystemExposedJsApi.exec(SystemExposedJsApi.java:41)
at android.os.MessageQueue.nativePollOnce(Native Method)
at android.os.MessageQueue.next(MessageQueue.java:342)
at android.os.Looper.loop(Looper.java:197)
at android.os.HandlerThread.run(HandlerThread.java:67)
W/PluginManager: THREAD WARNING: exec() call to SecureStorage.init blocked the main thread for 42ms. Plugin should use CordovaInterface.getThreadPool().
D/AndroidRuntime: Shutting down VM
E/AndroidRuntime: FATAL EXCEPTION: main
Process: com.ionicframework.suacimobile257509, PID: 22032
android.content.ActivityNotFoundException: No Activity found to handle Intent { act=com.android.credentials.UNLOCK }
at android.app.Instrumentation.checkStartActivityResult(Instrumentation.java:2067)
at android.app.Instrumentation.execStartActivity(Instrumentation.java:1727)
at android.app.Activity.startActivityForResult(Activity.java:5412)
at org.apache.cordova.CordovaActivity.startActivityForResult(CordovaActivity.java:345)
at android.app.Activity.startActivityForResult(Activity.java:5370)
at android.app.Activity.startActivity(Activity.java:5760)
at android.app.Activity.startActivity(Activity.java:5713)
at com.crypho.plugins.SecureStorage.startActivity(SecureStorage.java:240)
at com.crypho.plugins.SecureStorage.access$700(SecureStorage.java:21)
at com.crypho.plugins.SecureStorage$4.run(SecureStorage.java:217)
at android.os.Handler.handleCallback(Handler.java:938)
at android.os.Handler.dispatchMessage(Handler.java:99)
at android.os.Looper.loop(Looper.java:250)
at android.app.ActivityThread.main(ActivityThread.java:7803)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:592)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:958)
D/SERVER: Handling local request: http://localhost/7-es2015.js
I/Process: Sending signal. PID: 22032 SIG: 9
I managed to solve the problem by focusing on this line
android.content.ActivityNotFoundException: No Activity found to handle Intent { act=com.android.credentials.UNLOCK }
It turns out that it is a matter of one of the dependencies that fails in some cases yes and others no from API 28, I add the link from where I was guided
https://github.com/Crypho/cordova-plugin-secure-storage/issues/169#issuecomment-509734410

Cause of a OutOfMemoryError with React native Android

I'm developping an app with React native and my last version in release mode crashes after 20-30 seconds with the following generated logcat:
02-19 23:52:10.777 32717-32717/? E/AndroidRuntime: FATAL EXCEPTION: main
Process: my.app, PID: 32717
java.lang.OutOfMemoryError: std::bad_alloc
at com.facebook.react.bridge.WritableNativeArray.pushInt(Native Method)
at com.facebook.react.modules.core.Timing$TimerFrameCallback.doFrame(Timing.java:89)
at com.facebook.react.modules.core.ReactChoreographer$ReactChoreographerDispatcher.doFrame(ReactChoreographer.java:134)
at com.facebook.react.modules.core.ChoreographerCompat$FrameCallback$1.doFrame(ChoreographerCompat.java:105)
at android.view.Choreographer$CallbackRecord.run(Choreographer.java:909)
at android.view.Choreographer.doCallbacks(Choreographer.java:723)
at android.view.Choreographer.doFrame(Choreographer.java:655)
at android.view.Choreographer$FrameDisplayEventReceiver.run(Choreographer.java:897)
at android.os.Handler.handleCallback(Handler.java:789)
at android.os.Handler.dispatchMessage(Handler.java:98)
at android.os.Looper.loop(Looper.java:164)
at android.app.ActivityThread.main(ActivityThread.java:6938)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.Zygote$MethodAndArgsCaller.run(Zygote.java:327)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1374)
The app never crashes in dev mode.
How can I know what causes this? Is there a leak somewhere? What steps are to be followed to know more about it?
android/app/src/main/AndroidManifest.xml
<application
android:largeHeap="true"
Adding largeHeap seems fix it
Please refer this git issue

APP crashed when I installed the RN update

I integrate react-native-code-push to my RN project. But when I installed the update, the APP was crashed. Here is the source code.
2018-10-30 11:26:52.274 14122-14122/com.example.jason.rnandroid E/AndroidRuntime: FATAL EXCEPTION: main
Process: com.example.jason.rnandroid, PID: 14122
java.lang.AssertionError: recreateReactContextInBackground should only be called after the initial createReactContextInBackground call.
at com.facebook.infer.annotation.Assertions.assertCondition(Assertions.java:72)
at com.facebook.react.ReactInstanceManager.recreateReactContextInBackground(ReactInstanceManager.java:339)
at com.microsoft.codepush.react.CodePushNativeModule$2.run(CodePushNativeModule.java:151)
at android.os.Handler.handleCallback(Handler.java:789)
at android.os.Handler.dispatchMessage(Handler.java:98)
at android.os.Looper.loop(Looper.java:164)
at android.app.ActivityThread.main(ActivityThread.java:6541)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.Zygote$MethodAndArgsCaller.run(Zygote.java:240)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:767)
I don't know how to solve this problem, can anyone help?

FATAL EXCEPTION: ControllerMessenger

can someone help me to fix these errors. I added my app to the firebase and did test run. and I got these errors. I am new to android app development. I have no clear idea where should I start to fix these errors.
Fatal exception
android.os.FileUriExposedException: file:///storage/emulated/0/QR%20and%20Barcode/text.png exposed beyond app through ClipData.Item.getUri()
FATAL EXCEPTION: ControllerMessenger
Process: one.teqtoapps.barqr, PID: 9659
android.os.FileUriExposedException: file:///storage/emulated/0/QR%20and%20Barcode/text.png exposed beyond app through ClipData.Item.getUri()
at android.os.StrictMode.onFileUriExposed(StrictMode.java:1958)
at android.net.Uri.checkFileUriExposed(Uri.java:2348)
at android.content.ClipData.prepareToLeaveProcess(ClipData.java:941)
at android.content.Intent.prepareToLeaveProcess(Intent.java:9735)
at android.content.Intent.prepareToLeaveProcess(Intent.java:9741)
at android.content.Intent.prepareToLeaveProcess(Intent.java:9720)
at android.app.Instrumentation.execStartActivity(Instrumentation.java:1609)
at androidx.test.runner.MonitoringInstrumentation.execStartActivity(MonitoringInstrumentation.java:152)
at android.app.Activity.startActivityForResult(Activity.java:4472)
at android.support.v4.app.BaseFragmentActivityApi16.startActivityForResult(BaseFragmentActivityApi16.java:54)
at android.support.v4.app.FragmentActivity.startActivityForResult(FragmentActivity.java:68)
at android.app.Activity.startActivityForResult(Activity.java:4430)
at android.support.v4.app.FragmentActivity.startActivityForResult(FragmentActivity.java:751)
at android.app.Activity.startActivity(Activity.java:4791)
at android.app.Activity.startActivity(Activity.java:4759)
at one.teqtoapps.barqr.utility.AppUtils.share(AppUtils.java:83)
at one.teqtoapps.barqr.fragment.GenerateFragment$6.onSaved(GenerateFragment.java:183)
at one.teqtoapps.barqr.utility.SaveImage.onPostExecute(SaveImage.java:41)
at one.teqtoapps.barqr.utility.SaveImage.onPostExecute(SaveImage.java:16)
at android.os.AsyncTask.finish(AsyncTask.java:695)
at android.os.AsyncTask.-wrap1(Unknown Source:0)
at android.os.AsyncTask$InternalHandler.handleMessage(AsyncTask.java:712)
at android.os.Handler.dispatchMessage(Handler.java:105)
at androidx.test.espresso.base.Interrogator.a(Interrogator.java:19)
at androidx.test.espresso.base.UiControllerImpl.a(UiControllerImpl.java:142)
at androidx.test.espresso.base.UiControllerImpl.a(UiControllerImpl.java:96)
at androidx.test.espresso.base.UiControllerImpl.a(UiControllerImpl.java:37)
at androidx.test.espresso.action.MotionEvents.a(MotionEvents.java:74)
at androidx.test.espresso.action.MotionEvents.a(MotionEvents.java:52)
at androidx.test.espresso.action.Tap.c(Tap.java:9)
at androidx.test.espresso.action.Tap.a(Tap.java:19)
at androidx.test.espresso.action.Tap$1.b(Tap.java:2)
at androidx.test.espresso.action.GeneralClickAction.perform(GeneralClickAction.java:22)
at androidx.test.espresso.ViewInteraction$SingleExecutionViewAction.perform(ViewInteraction.java:9)
at androidx.test.espresso.ViewInteraction.a(ViewInteraction.java:78)
at androidx.test.espresso.ViewInteraction.a(ViewInteraction.java:94)
at androidx.test.espresso.ViewInteraction$1.call(ViewInteraction.java:3)
at java.util.concurrent.FutureTask.run(FutureTask.java:266)
at android.os.Handler.handleCallback(Handler.java:789)
at android.os.Handler.dispatchMessage(Handler.java:98)
at android.os.Looper.loop(Looper.java:164)
at android.app.ActivityThread.main(ActivityThread.java:6541)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.Zygote$MethodAndArgsCaller.run(Zygote.java:240)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:767)
I got the same Crashes on some devices during Google Play test
I thought this will help you :
https://issuetracker.google.com/issues/113164874
In my case, it show in log
Failed to take screenshot: takeScreenshot returned null
copied 4 bytes
01-29 06:27:43.544: I/Robo(11035): --------- beginning of crash
01-29 06:27:43.545: E/AndroidRuntime(11035): FATAL EXCEPTION: ControllerMessenger
01-29 06:27:43.545: E/AndroidRuntime(11035): Process: PID: 11035
01-29 06:27:43.545: E/AndroidRuntime(11035): java.lang.NullPointerException: Attempt to invoke virtual method 'void android.graphics.Bitmap.recycle()' on a null object reference
because my screen has secure flag to take screen-shot and testing framework trying to take screen-shot that will return null and throwing NullPointerException on recycle.
For more help you can reply me here.

Android O Preview 1 can't open Setting, "Setting has stop"

I use the Nexus 6P, and system is Android O Preview 1.
I have been used the preview system for two month, and it's normal.
Today I want to update system, I find I can't open the system app "Setting". it's will show that 'Setting has stop'.
Then I watch the Logcat in Android Studio, has Error log below:
07-25 17:16:31.515 21875-21875/? E/AndroidRuntime: FATAL EXCEPTION: main
Process: com.android.settings, PID: 21875
java.lang.IllegalArgumentException: Receiver not registered: com.android.settings.dashboard.conditional.CellularDataCondition$Receiver#1d9a5b0
at android.app.LoadedApk.forgetReceiverDispatcher(LoadedApk.java:1152)
at android.app.ContextImpl.unregisterReceiver(ContextImpl.java:1422)
at android.content.ContextWrapper.unregisterReceiver(ContextWrapper.java:639)
at com.android.settings.dashboard.conditional.Condition.onSilenceChanged(Condition.java:115)
at com.android.settings.dashboard.conditional.Condition.setActive(Condition.java:90)
at com.android.settings.dashboard.conditional.CellularDataCondition.refreshState(CellularDataCondition.java:47)
at com.android.settings.dashboard.conditional.ConditionManager.refreshAll(ConditionManager.java:77)
at com.android.settings.dashboard.conditional.ConditionManager$ConditionLoader.onPostExecute(ConditionManager.java:266)
at com.android.settings.dashboard.conditional.ConditionManager$ConditionLoader.onPostExecute(ConditionManager.java:261)
at android.os.AsyncTask.finish(AsyncTask.java:667)
at android.os.AsyncTask.-wrap1(Unknown Source:0)
at android.os.AsyncTask$InternalHandler.handleMessage(AsyncTask.java:684)
at android.os.Handler.dispatchMessage(Handler.java:105)
at android.os.Looper.loop(Looper.java:164)
at android.app.ActivityThread.main(ActivityThread.java:6535)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.Zygote$MethodAndArgsCaller.run(Zygote.java:240)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:767)
07-25 17:16:31.519 789-2848/? W/ActivityManager: Force finishing activity com.android.settings/.Settings
I can't update now, and Setting can't open. What should I do?
How about doing factory reset?
Go to fastboot mode and use "fastboot -w"

Categories

Resources