question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

bug: Android app is restarting every time we access a plugin (share/camera/ library etc)

See original GitHub issue

Bug Report

Capacitor Version

  Capacitor Doctor

Latest Dependencies:

  @capacitor/cli: 2.4.6
  @capacitor/core: 2.4.6
  @capacitor/android: 2.4.6
  @capacitor/electron: 2.4.6
  @capacitor/ios: 2.4.6

Installed Dependencies:

  @capacitor/cli 2.4.6
  @capacitor/core 2.4.0
  @capacitor/android 2.4.5
  @capacitor/ios 2.4.5
  @capacitor/electron not installed

[success] Android looking great! 👌
[error] Xcode is not installed

Platform(s)

Android

Current Behavior

Every time we access to a capacitor plugin the app restarts, Share, Camera or Library, all of them facing same issue.

Expected Behavior

The app should not restart once we access a plugin

Code Reproduction

Video: After we share, the app is restarting:

https://user-images.githubusercontent.com/48879345/106285575-91496c00-623c-11eb-9846-f83af236f35f.mp4

Other Technical Details

npm --version output: 6.13.4

node --version output: v12.14.0

pod --version output (iOS issues only):

Additional Context

LOG Cat from Android Studio:

`2021-01-29 14:17:12.294 2503-2503/com.flowrobe.app D/ViewRootImpl@4d8758f[MainActivity]: ViewPostIme pointer 0 2021-01-29 14:17:12.308 2503-2503/com.flowrobe.app D/ViewRootImpl@4d8758f[MainActivity]: ViewPostIme pointer 1 2021-01-29 14:17:12.338 2503-2569/com.flowrobe.app D/Capacitor: Handling local request: http://localhost/assets/fonts/Barlow-SemiBold.ttf 2021-01-29 14:17:12.346 2503-2503/com.flowrobe.app D/InputMethodManager: HSIFW - flag : 0 Pid : 2503 2021-01-29 14:17:13.767 2503-2503/com.flowrobe.app D/ViewRootImpl@4d8758f[MainActivity]: ViewPostIme pointer 0 2021-01-29 14:17:13.810 2503-2503/com.flowrobe.app D/ViewRootImpl@4d8758f[MainActivity]: ViewPostIme pointer 1 2021-01-29 14:17:13.830 2503-2715/com.flowrobe.app V/Capacitor/Plugin: To native (Capacitor plugin): callbackId: 36488273, pluginId: Share, methodName: share 2021-01-29 14:17:13.831 2503-2715/com.flowrobe.app V/Capacitor: callback: 36488273, pluginId: Share, methodName: share, methodData: {“title”:“Share your FlowRobe love 🔥❤”,“text”:"Check out FlowRobe where you can swipe nice clothes, upload easier than ever, and give preloved new lives! 🙈👟♻ \n 👉🏽 ",“url”:“http://flowrobe.com/app”,“dialogTitle”:“Share your FlowRobe love 🔥❤”} 2021-01-29 14:17:13.846 2503-2503/com.flowrobe.app D/InputMethodManager: HSIFW - flag : 0 Pid : 2503 2021-01-29 14:17:13.865 2503-2503/com.flowrobe.app D/Capacitor: App paused 2021-01-29 14:17:13.880 2503-2503/com.flowrobe.app I/Capacitor/Console: File: http://localhost/main-es2015.js - Line 855 - Msg: Successful share [object Object] 2021-01-29 14:17:13.982 2503-2503/com.flowrobe.app D/ViewRootImpl@4d8758f[MainActivity]: MSG_WINDOW_FOCUS_CHANGED 0 1 2021-01-29 14:17:13.982 2503-2503/com.flowrobe.app D/InputMethodManager: prepareNavigationBarInfo() DecorView@30c61b[MainActivity] 2021-01-29 14:17:13.983 2503-2503/com.flowrobe.app D/InputMethodManager: getNavigationBarColor() -855310 2021-01-29 14:17:14.149 2503-2503/com.flowrobe.app D/InputMethodManager: HSIFW - flag : 0 Pid : 2503 2021-01-29 14:17:14.881 2503-2503/com.flowrobe.app D/InputTransport: Input channel destroyed: ‘ClientS’, fd=173 2021-01-29 14:17:16.336 2503-2503/com.flowrobe.app D/ViewRootImpl@4d8758f[MainActivity]: stopped(false) old=false 2021-01-29 14:17:16.337 2503-2503/com.flowrobe.app D/Capacitor/App: Firing change: true 2021-01-29 14:17:16.338 2503-2503/com.flowrobe.app V/Capacitor/App: Notifying listeners for event appStateChange 2021-01-29 14:17:16.338 2503-2503/com.flowrobe.app D/Capacitor/App: No listeners found for event appStateChange 2021-01-29 14:17:16.367 2503-2503/com.flowrobe.app D/Capacitor: App resumed 2021-01-29 14:17:16.370 2503-2503/com.flowrobe.app D/ViewRootImpl@4d8758f[MainActivity]: MSG_WINDOW_FOCUS_CHANGED 1 1 2021-01-29 14:17:16.370 2503-2503/com.flowrobe.app D/InputMethodManager: prepareNavigationBarInfo() DecorView@30c61b[MainActivity] 2021-01-29 14:17:16.370 2503-2503/com.flowrobe.app D/InputMethodManager: getNavigationBarColor() -855310 2021-01-29 14:17:16.379 2503-2503/com.flowrobe.app D/InputMethodManager: prepareNavigationBarInfo() DecorView@30c61b[MainActivity] 2021-01-29 14:17:16.380 2503-2503/com.flowrobe.app D/InputMethodManager: getNavigationBarColor() -855310 2021-01-29 14:17:16.380 2503-2503/com.flowrobe.app V/InputMethodManager: Starting input: tba=com.flowrobe.app ic=null mNaviBarColor -855310 mIsGetNaviBarColorSuccess true , NavVisible : true , NavTrans : false 2021-01-29 14:17:16.380 2503-2503/com.flowrobe.app D/InputMethodManager: startInputInner - Id : 0 2021-01-29 14:17:16.381 2503-2503/com.flowrobe.app I/InputMethodManager: startInputInner - mService.startInputOrWindowGainedFocus 2021-01-29 14:17:16.387 2503-2503/com.flowrobe.app V/Capacitor/Network: Notifying listeners for event networkStatusChange 2021-01-29 14:17:16.405 2503-2569/com.flowrobe.app D/Capacitor: Handling local request: http://localhost/home 2021-01-29 14:17:16.519 2503-2569/com.flowrobe.app D/Capacitor: Handling local request: http://localhost/polyfills-es2015.js 2021-01-29 14:17:16.521 2503-2576/com.flowrobe.app D/Capacitor: Handling local request: http://localhost/styles-es2015.js 2021-01-29 14:17:16.521 2503-2569/com.flowrobe.app D/Capacitor: Handling local request: http://localhost/vendor-es2015.js 2021-01-29 14:17:16.521 2503-2578/com.flowrobe.app D/Capacitor: Handling local request: http://localhost/runtime-es2015.js 2021-01-29 14:17:16.524 2503-2570/com.flowrobe.app D/Capacitor: Handling local request: http://localhost/main-es2015.js 2021-01-29 14:17:16.552 2503-2503/com.flowrobe.app I/Capacitor/Console: File: capacitor-runtime.js - Line 2398 - Msg: onscript loading complete 2021-01-29 14:17:17.205 2503-2503/com.flowrobe.app W/Capacitor/Console: File: http://localhost/vendor-es2015.js - Line 168790 - Msg: It looks like you’re using the development build of the Firebase JS SDK. When deploying Firebase apps to production, it is advisable to only import the individual SDK components you intend to use.

For the module builds, these are available in the following manner
(replace <PACKAGE> with the name of a component - i.e. auth, database, etc):

CommonJS Modules:
const firebase = require('firebase/app');
require('firebase/<PACKAGE>');

ES Modules:
import firebase from 'firebase/app';
import 'firebase/<PACKAGE>';

Typescript:
import * as firebase from 'firebase/app';
import 'firebase/<PACKAGE>';

2021-01-29 14:17:17.325 2503-2503/com.flowrobe.app W/Capacitor/Console: File: http://localhost/vendor-es2015.js - Line 39262 - Msg: DEPRECATED: DI is instantiating a token “CustomHammerConfig” that inherits its @Injectable decorator but does not provide one itself. This will become an error in v10. Please add @Injectable() to the “CustomHammerConfig” class. 2021-01-29 14:17:17.377 2503-2576/com.flowrobe.app D/Capacitor: Handling local request: http://localhost/firebase-auth-es2015.js 2021-01-29 14:17:17.379 2503-2715/com.flowrobe.app V/Capacitor/Plugin: To native (Capacitor plugin): callbackId: 119405112, pluginId: Storage, methodName: get 2021-01-29 14:17:17.379 2503-2715/com.flowrobe.app V/Capacitor: callback: 119405112, pluginId: Storage, methodName: get, methodData: {“key”:“user”} 2021-01-29 14:17:17.466 2503-2715/com.flowrobe.app V/Capacitor/Plugin: To native (Capacitor plugin): callbackId: 119405113, pluginId: Network, methodName: getStatus 2021-01-29 14:17:17.466 2503-2715/com.flowrobe.app V/Capacitor: callback: 119405113, pluginId: Network, methodName: getStatus, methodData: {} 2021-01-29 14:17:17.488 2503-2503/com.flowrobe.app I/Capacitor/Console: File: http://localhost/vendor-es2015.js - Line 75107 - Msg: Angular is running in the development mode. Call enableProdMode() to enable the production mode. 2021-01-29 14:17:17.504 2503-2570/com.flowrobe.app D/Capacitor: Handling local request: http://localhost/common-es2015.js 2021-01-29 14:17:17.518 2503-2575/com.flowrobe.app D/Capacitor: Handling local request: http://localhost/2-es2015.js 2021-01-29 14:17:17.522 2503-2849/com.flowrobe.app D/Capacitor: Handling local request: http://localhost/6-es2015.js 2021-01-29 14:17:17.534 2503-2575/com.flowrobe.app D/Capacitor: Handling local request: http://localhost/17-es2015.js 2021-01-29 14:17:17.548 2503-2576/com.flowrobe.app D/Capacitor: Handling local request: http://localhost/default~pages-home-home-module~product-product-module~trades-trades-module~wardrobe-wardrobe-module~~fddc403d-es2015.js 2021-01-29 14:17:17.548 2503-2578/com.flowrobe.app D/Capacitor: Handling local request: http://localhost/19-es2015.js 2021-01-29 14:17:17.552 2503-2849/com.flowrobe.app D/Capacitor: Handling local request: http://localhost/pages-home-home-module-es2015.js 2021-01-29 14:17:17.558 2503-2715/com.flowrobe.app V/Capacitor/Plugin: To native (Capacitor plugin): callbackId: 119405114, pluginId: Network, methodName: addListener 2021-01-29 14:17:17.559 2503-2715/com.flowrobe.app V/Capacitor: callback: 119405114, pluginId: Network, methodName: addListener, methodData: {“eventName”:“networkStatusChange”} 2021-01-29 14:17:17.573 2503-2715/com.flowrobe.app V/Capacitor/Plugin: To native (Cordova plugin): callbackId: AppRate577142635, service: AppRate, action: getAppTitle, actionArgs: [] 2021-01-29 14:17:17.592 2503-2715/com.flowrobe.app V/Capacitor/Plugin: To native (Cordova plugin): callbackId: AppRate577142636, service: AppRate, action: isNativePromptAvailable, actionArgs: [] 2021-01-29 14:17:17.595 2503-2715/com.flowrobe.app V/Capacitor/Plugin: To native (Cordova plugin): callbackId: NativeStorage577142637, service: NativeStorage, action: getItem, actionArgs: [“counter”] 2021-01-29 14:17:17.598 2503-2503/com.flowrobe.app I/Capacitor/Console: File: http://localhost/vendor-es2015.js - Line 156716 - Msg: Ionic Native: deviceready event fired after 431 ms 2021-01-29 14:17:17.601 2503-2715/com.flowrobe.app V/Capacitor/Plugin: To native (Capacitor plugin): callbackId: 119405115, pluginId: App, methodName: addListener 2021-01-29 14:17:17.601 2503-2715/com.flowrobe.app V/Capacitor: callback: 119405115, pluginId: App, methodName: addListener, methodData: {“eventName”:“appUrlOpen”} 2021-01-29 14:17:17.609 2503-2715/com.flowrobe.app V/Capacitor/Plugin: To native (Capacitor plugin): callbackId: 119405116, pluginId: SplashScreen, methodName: hide 2021-01-29 14:17:17.610 2503-2715/com.flowrobe.app V/Capacitor: callback: 119405116, pluginId: SplashScreen, methodName: hide, methodData: {} 2021-01-29 14:17:17.622 2503-2715/com.flowrobe.app V/Capacitor/Plugin: To native (Cordova plugin): callbackId: AppRate577142638, service: AppRate, action: getAppVersion, actionArgs: [] 2021-01-29 14:17:17.678 2503-2849/com.flowrobe.app D/Capacitor: Handling local request: http://localhost/svg/close-sharp.svg 2021-01-29 14:17:17.686 2503-2575/com.flowrobe.app D/Capacitor: Handling local request: http://localhost/swipe-back-2154c9a7-js-es2015.js 2021-01-29 14:17:17.713 2503-2575/com.flowrobe.app D/Capacitor: Handling local request: http://localhost/5-es2015.js 2021-01-29 14:17:17.718 2503-2578/com.flowrobe.app D/Capacitor: Handling local request: http://localhost/28-es2015.js`

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Comments:14 (1 by maintainers)

github_iconTop GitHub Comments

2reactions
joaolnprcommented, Aug 31, 2021

I found out the issue, on Network state change which is triggered on android app when calling capacitor plugin on resuming the app we had a reload of location… Thanks for the help

0reactions
ionitron-bot[bot]commented, Nov 10, 2022

Thanks for the issue! This issue is being locked to prevent comments that are not relevant to the original issue. If this is still an issue with the latest version of Capacitor, please create a new issue and ensure the template is fully filled out.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Fix an Android device that's restarting or crashing
Try the following steps if your phone has any of these problems: Randomly reboots or restarts; Shuts down without restarting; Restarts constantly: Go...
Read more >
Known issues with Android Studio and Android Gradle Plugin
This page tracks known issues with Android Studio Dolphin | 2021.3.1 and Android Gradle plugin 7.3.1. If you experience an issue not already...
Read more >
[Camera Plugin] Application crashes and restarts when taking ...
When capturing an image with the Camera plugin it crashes everytime I take a picture and the app restarts. This only happens on...
Read more >
OS keeps rebooting when lots of apps are moved to SDcard ...
I had an SGS2 a year ago, it came with android 2.3.4, installed lots of apps, internal storage got full, so naturally, moved...
Read more >
Android Studio missing essential plugin org.jetbrains.android
So I just removed the Kotlin package line from the file. There's no need to delete the whole file - many people disable...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found