Running npx cap open android is displaying the "blank" ionic app

I am trying to run my ionic app using npx cap open android,

When I run ionic serve, my app appears.

But when I run npx cap open android, the “blank” ionic app that you start off with is displayed on my phone.

Can someone please tell me why this is? I’m definitely running the same projects also.

You need to run ionic build and npx cap sync android to make sure the Android project uses your latest app code.

1 Like

Hi,

I’m running into a similar issue again.

I’ve ran ionic build, npx cap sync, npx cap open android but the app is not working the same on Android as it is on the desktop.

Some of the expected logs are being printed in Android studio console if that gives you any further info.

Do you have any ideas as to why this is happening?

Did you restart the app from Android Studio?

I closed down android studio & ran

  1. ionic build
  2. npx cap sync
  3. npx cap open android

I made a change to a console.log to verify my latest changes were being pushed across, & that was being logged.

The updated console.log is being logged, but my map is not being displayed.

Here is the console output in android studio if that helps:

03/26 11:57:07: Launching ‘app’ on samsung SM-G965F.
$ adb shell am start -n “io.ionic.starter/io.ionic.starter.MainActivity” -a android.intent.action.MAIN -c android.intent.category.LAUNCHER
Connected to process 27293 on device ‘samsung-sm_g965f-2410169c6d0c7ece’.
Capturing and displaying logcat messages from application. This behavior can be disabled in the “Logcat output” section of the “Debugger” settings page.
E/Zygote: isWhitelistProcess - Process is Whitelisted
E/Zygote: accessInfo : 1
I/SELinux: SELinux: seapp_context_lookup: seinfo=untrusted, level=s0:c130,c258,c512,c768, pkgname=io.ionic.starter
I/o.ionic.starte: Late-enabling -Xcheck:jni
D/ConnectivityManager_URSP: Ursp sIsUrsp=false, sIsCheckUrsp=false, uid=10642
D/Proxy: urspP is null: 10642
W/FirebaseApp: Default FirebaseApp failed to initialize because no default options were found. This usually means that com.google.gms:google-services was not applied to your gradle project.
I/FirebaseInitProvider: FirebaseApp initialization unsuccessful
W/o.ionic.starte: Accessing hidden method Landroid/graphics/drawable/Drawable;->getOpticalInsets()Landroid/graphics/Insets; (light greylist, linking)
Accessing hidden field Landroid/graphics/Insets;->left:I (light greylist, linking)
Accessing hidden field Landroid/graphics/Insets;->right:I (light greylist, linking)
Accessing hidden field Landroid/graphics/Insets;->top:I (light greylist, linking)
Accessing hidden field Landroid/graphics/Insets;->bottom:I (light greylist, linking)
D/libEGL: loaded /vendor/lib64/egl/libGLES_mali.so
E/o.ionic.starte: Invalid ID 0x00000000.
W/o.ionic.starte: Accessing hidden method Landroid/view/View;->getAccessibilityDelegate()Landroid/view/View$AccessibilityDelegate; (light greylist, linking)
W/o.ionic.starte: Accessing hidden method Landroid/view/View;->computeFitSystemWindows(Landroid/graphics/Rect;Landroid/graphics/Rect;)Z (light greylist, reflection)
W/o.ionic.starte: Accessing hidden method Landroid/view/ViewGroup;->makeOptionalFitsSystemWindows()V (light greylist, reflection)
I/WebViewFactory: Loading com.android.chrome version 80.0.3987.149 (code 398714932)
E/o.ionic.starte: Invalid ID 0x00000000.
E/o.ionic.starte: Invalid ID 0x00000000.
I/cr_LibraryLoader: Loaded native library version number “80.0.3987.149”
W/o.ionic.starte: Accessing hidden method Landroid/content/Context;->bindServiceAsUser(Landroid/content/Intent;Landroid/content/ServiceConnection;ILandroid/os/Handler;Landroid/os/UserHandle;)Z (light greylist, reflection)
D/ConnectivityManager: requestNetwork; CallingUid : 10642, CallingPid : 27293
D/ConnectivityManager: requestNetwork; CallingUid : 10642, CallingPid : 27293
D/Capacitor: Starting BridgeActivity
D/Capacitor: Registering plugin: App
D/Capacitor: Registering plugin: Accessibility
D/Capacitor: Registering plugin: BackgroundTask
D/Capacitor: Registering plugin: Browser
D/Capacitor: Registering plugin: Camera
D/Capacitor: Registering plugin: Clipboard
D/Capacitor: Registering plugin: Device
D/Capacitor: Registering plugin: LocalNotifications
D/Capacitor: Registering plugin: Filesystem
D/Capacitor: Registering plugin: Geolocation
D/Capacitor: Registering plugin: Haptics
D/Capacitor: Registering plugin: Keyboard
D/Capacitor: Registering plugin: Modals
D/Capacitor: Registering plugin: Network
D/Capacitor: Registering plugin: Permissions
D/Capacitor: Registering plugin: Photos
D/Capacitor: Registering plugin: PushNotifications
D/Capacitor: Registering plugin: Share
D/Capacitor: Registering plugin: SplashScreen
D/Capacitor: Registering plugin: StatusBar
D/Capacitor: Registering plugin: Storage
D/Capacitor: Registering plugin: Toast
D/Capacitor: Registering plugin: WebView
E/Capacitor: Unable to read file at path public/plugins
D/Capacitor: Loading app at http://localhost
W/o.ionic.starte: Accessing hidden method Landroid/media/AudioManager;->getOutputLatency(I)I (light greylist, reflection)
W/cr_media: Requires BLUETOOTH permission
I/ConfigStore: android::hardware::configstore::V1_0::ISurfaceFlingerConfigs::hasWideColorDisplay retrieved: 0
android::hardware::configstore::V1_0::ISurfaceFlingerConfigs::hasHDRDisplay retrieved: 0
D/Capacitor/Plugin/LN: LocalNotification received: null
Activity started without notification attached
D/Capacitor: App started
D/Capacitor/Plugin/App: Firing change: true
V/Capacitor/Plugin/App: Notifying listeners for event appStateChange
D/Capacitor/Plugin/App: No listeners found for event appStateChange
D/Capacitor: App resumed
D/OpenGLRenderer: Skia GL Pipeline
D/EmergencyMode: [EmergencyManager] android createPackageContext successful
D/InputTransport: Input channel constructed: fd=141
D/ViewRootImpl@edef802[MainActivity]: setView = DecorView@80c6513[MainActivity] TM=true MM=false
D/ConnectivityManager: requestNetwork; CallingUid : 10642, CallingPid : 27293
D/ConnectivityManager: requestNetwork; CallingUid : 10642, CallingPid : 27293
W/AudioCapabilities: Unsupported mime audio/ac4
W/AudioCapabilities: Unsupported mime audio/x-ima
W/AudioCapabilities: Unsupported mime audio/x-ape
W/AudioCapabilities: Unsupported mime audio/eac3-joc
W/AudioCapabilities: Unsupported mime audio/mpeg-L1
Unsupported mime audio/mpeg-L2
W/AudioCapabilities: Unsupported mime audio/x-ms-wma
D/Capacitor: Handling local request: http://localhost/
W/VideoCapabilities: Unrecognized profile 4 for video/hevc
W/VideoCapabilities: Unsupported mime video/mp43
W/VideoCapabilities: Unrecognized profile/level 1/32 for video/mp4v-es
Unrecognized profile/level 32768/2 for video/mp4v-es
Unrecognized profile/level 32768/64 for video/mp4v-es
W/VideoCapabilities: Unsupported mime video/wvc1
W/VideoCapabilities: Unsupported mime video/wvc1
D/ViewRootImpl@edef802[MainActivity]: dispatchAttachedToWindow
W/VideoCapabilities: Unsupported mime video/x-ms-wmv7
W/VideoCapabilities: Unsupported mime video/x-ms-wmv8
D/ViewRootImpl@edef802[MainActivity]: Relayout returned: old=[0,0][1080,2220] new=[0,0][1080,2220] result=0x7 surface={valid=true 493865537536} changed=true
I/OpenGLRenderer: Initialized EGL, version 1.4
D/OpenGLRenderer: Swap behavior 2
D/mali_winsys: EGLint new_window_surface(egl_winsys_display *, void *, EGLSurface, EGLConfig, egl_winsys_surface **, EGLBoolean) returns 0x3000
D/OpenGLRenderer: eglCreateWindowSurface = 0x72f3f9a400, 0x72fcae1010
I/VideoCapabilities: Unsupported profile 4 for video/mp4v-es
D/InputTransport: Input channel constructed: fd=147
D/ViewRootImpl@528b903[MainActivity]: setView = android.widget.ImageView{607e080 V.ED… …ID 0,0-0,0} TM=true MM=false
D/InputTransport: Input channel constructed: fd=148
D/ViewRootImpl@84a84ac[MainActivity]: setView = android.widget.ProgressBar{52f1575 I.ED… …ID 0,0-0,0} TM=true MM=false
V/Capacitor/Plugin/Network: Notifying listeners for event networkStatusChange
D/Capacitor/Plugin/Network: No listeners found for event networkStatusChange
D/ViewRootImpl@edef802[MainActivity]: MSG_RESIZED: frame=Rect(0, 0 - 1080, 2220) ci=Rect(0, 63 - 0, 39) vi=Rect(0, 63 - 0, 39) or=1
D/ViewRootImpl@528b903[MainActivity]: dispatchAttachedToWindow
D/ViewRootImpl@528b903[MainActivity]: Relayout returned: old=[0,0][1080,2220] new=[0,0][1080,2220] result=0x7 surface={valid=true 493743370240} changed=true
D/mali_winsys: EGLint new_window_surface(egl_winsys_display *, void *, EGLSurface, EGLConfig, egl_winsys_surface **, EGLBoolean) returns 0x3000
D/OpenGLRenderer: eglCreateWindowSurface = 0x72f5865480, 0x72f565f010
D/ViewRootImpl@84a84ac[MainActivity]: dispatchAttachedToWindow
D/ViewRootImpl@84a84ac[MainActivity]: Relayout returned: old=[0,0][1080,2220] new=[477,1047][603,1173] result=0x1 surface={valid=false 0} changed=false
D/ViewRootImpl@edef802[MainActivity]: MSG_WINDOW_FOCUS_CHANGED 1 1
D/InputMethodManager: prepareNavigationBarInfo() DecorView@80c6513[MainActivity]
D/InputMethodManager: getNavigationBarColor() -855310
D/InputMethodManager: prepareNavigationBarInfo() DecorView@80c6513[MainActivity]
getNavigationBarColor() -855310
V/InputMethodManager: Starting input: tba=io.ionic.starter ic=null mNaviBarColor -855310 mIsGetNaviBarColorSuccess true , NavVisible : true , NavTrans : false
D/InputMethodManager: startInputInner - Id : 0
I/InputMethodManager: startInputInner - mService.startInputOrWindowGainedFocus
D/ViewRootImpl@528b903[MainActivity]: MSG_WINDOW_FOCUS_CHANGED 1 1
D/InputMethodManager: prepareNavigationBarInfo() android.widget.ImageView{607e080 V.ED… …ID 0,0-1080,2220}
getNavigationBarColor this view is not DecorView or null
getNavigationBarColor() Fail
D/InputMethodManager: prepareNavigationBarInfo() android.widget.ImageView{607e080 V.ED… …ID 0,0-1080,2220}
getNavigationBarColor this view is not DecorView or null
getNavigationBarColor() Fail
V/InputMethodManager: Starting input: tba=io.ionic.starter ic=null mNaviBarColor Fail mIsGetNaviBarColorSuccess false , NavVisible : true , NavTrans : false
D/InputMethodManager: startInputInner - Id : 0
I/InputMethodManager: startInputInner - mService.startInputOrWindowGainedFocus
D/InputTransport: Input channel constructed: fd=161
D/InputTransport: Input channel constructed: fd=162
D/ViewRootImpl@528b903[MainActivity]: MSG_RESIZED: frame=Rect(0, 0 - 1080, 2220) ci=Rect(0, 63 - 0, 39) vi=Rect(0, 63 - 0, 39) or=1
W/InputMethodManager: Ignoring onBind: cur seq=43140, given seq=43139
D/InputTransport: Input channel destroyed: fd=161
D/ViewRootImpl@edef802[MainActivity]: MSG_WINDOW_FOCUS_CHANGED 0 1
D/InputMethodManager: prepareNavigationBarInfo() DecorView@80c6513[MainActivity]
getNavigationBarColor() -855310
D/Capacitor: Handling local request: http://localhost/polyfills-es2015.js
D/Capacitor: Handling local request: http://localhost/styles-es2015.js
D/Capacitor: Handling local request: http://localhost/runtime-es2015.js
D/Capacitor: Handling local request: http://localhost/vendor-es2015.js
D/Capacitor: Handling local request: http://localhost/main-es2015.js
I/Capacitor/Console: File: http://localhost/vendor-es2015.js - Line 69837 - Msg: Angular is running in the development mode. Call enableProdMode() to enable the production mode.
D/Capacitor: Handling local request: http://localhost/common-es2015.js
D/Capacitor: Handling local request: http://localhost/5-es2015.js
D/Capacitor: Handling local request: http://localhost/home-home-module-es2015.js
I/Capacitor/Console: File: http://localhost/vendor-es2015.js - Line 117994 - Msg: Ionic Native: deviceready event fired after 513 ms
W/Capacitor/Console: File: http://localhost/vendor-es2015.js - Line 118299 - Msg: Native: tried calling StatusBar.styleDefault, but the StatusBar plugin is not installed.
W/Capacitor/Console: File: http://localhost/vendor-es2015.js - Line 118311 - Msg: Install the StatusBar plugin: ‘ionic cordova plugin add cordova-plugin-statusbar’
W/Capacitor/Console: File: http://localhost/vendor-es2015.js - Line 118299 - Msg: Native: tried calling SplashScreen.hide, but the SplashScreen plugin is not installed.
W/Capacitor/Console: File: http://localhost/vendor-es2015.js - Line 118311 - Msg: Install the SplashScreen plugin: ‘ionic cordova plugin add cordova-plugin-splashscreen’
D/Capacitor: Handling local request: http://localhost/swipe-back-d2cdbf9a-js-es2015.js
V/Capacitor/Plugin: To native (Capacitor plugin): callbackId: 131202563, pluginId: Geolocation, methodName: getCurrentPosition
V/Capacitor: callback: 131202563, pluginId: Geolocation, methodName: getCurrentPosition, methodData: {}
D/Capacitor: Handling local request: http://localhost/tap-click-606f325e-js-es2015.js
V/Capacitor/Plugin: To native (Capacitor plugin): callbackId: 131202564, pluginId: App, methodName: addListener
V/Capacitor: callback: 131202564, pluginId: App, methodName: addListener, methodData: {“eventName”:“backButton”}
D/Capacitor: Handling local request: http://localhost/status-tap-2ec46489-js-es2015.js
D/Capacitor: Handling local request: http://localhost/focus-visible-70713a0c-js-es2015.js
D/Capacitor: Handling local request: http://localhost/assets/icon/favicon.png
D/TcpOptimizer: TcpOptimizer-ON
D/NetworkSecurityConfig: No Network Security Config specified, using platform default
V/Capacitor/Plugin: To native (Capacitor plugin): callbackId: 131202565, pluginId: Geolocation, methodName: watchPosition
V/Capacitor: callback: 131202565, pluginId: Geolocation, methodName: watchPosition, methodData: {}
D/Capacitor: SplashScreen was automatically hidden after the launch timeout. You should call SplashScreen.hide() as soon as your web app is loaded (or increase the timeout).Read more at Splash Screen Capacitor Plugin API | Capacitor Documentation
W/libEGL: EGLNativeWindowType 0x72f565f010 disconnect failed
D/OpenGLRenderer: eglDestroySurface = 0x72f5865480, 0x72f565f000
D/ViewRootImpl@528b903[MainActivity]: Relayout returned: old=[0,0][1080,2220] new=[0,0][1080,2220] result=0x5 surface={valid=false 0} changed=true
D/ViewRootImpl@528b903[MainActivity]: dispatchDetachedFromWindow
D/ViewRootImpl@528b903[MainActivity]: Surface release. android.view.ViewRootImpl.doDie:7954 android.view.ViewRootImpl$ViewRootHandler.handleMessage:4955 android.os.Handler.dispatchMessage:106 android.os.Looper.loop:214 android.app.ActivityThread.main:6986 java.lang.reflect.Method.invoke:-2 com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run:494 com.android.internal.os.ZygoteInit.main:1445
D/InputTransport: Input channel destroyed: fd=147
D/ViewRootImpl@edef802[MainActivity]: MSG_WINDOW_FOCUS_CHANGED 1 1
D/InputMethodManager: prepareNavigationBarInfo() DecorView@80c6513[MainActivity]
getNavigationBarColor() -855310
D/InputMethodManager: prepareNavigationBarInfo() DecorView@80c6513[MainActivity]
getNavigationBarColor() -855310
V/InputMethodManager: Starting input: tba=io.ionic.starter ic=null mNaviBarColor -855310 mIsGetNaviBarColorSuccess true , NavVisible : true , NavTrans : false
D/InputMethodManager: startInputInner - Id : 0
I/InputMethodManager: startInputInner - mService.startInputOrWindowGainedFocus
D/InputTransport: Input channel constructed: fd=159
Input channel destroyed: fd=162
E/ViewRootImpl: sendUserActionEvent() returned.
I/Capacitor/Console: File: http://localhost/home-home-module-es2015.js - Line 2798 - Msg: new position: 51.9294895-8.513088
I/Capacitor/Console: File: http://localhost/home-home-module-es2015.js - Line 2799 - Msg: here!
I/Capacitor/Console: File: http://localhost/home-home-module-es2015.js - Line 2798 - Msg: new position: 51.9294897-8.5130871
I/Capacitor/Console: File: http://localhost/home-home-module-es2015.js - Line 2799 - Msg: here!
I/Capacitor/Console: File: http://localhost/home-home-module-es2015.js - Line 2798 - Msg: new position: 51.9294892-8.5130869
I/Capacitor/Console: File: http://localhost/home-home-module-es2015.js - Line 2799 - Msg: here!
I/Capacitor/Console: File: http://localhost/home-home-module-es2015.js - Line 2798 - Msg: new position: 51.9294891-8.5130888
I/Capacitor/Console: File: http://localhost/home-home-module-es2015.js - Line 2799 - Msg: here!
I/Capacitor/Console: File: http://localhost/home-home-module-es2015.js - Line 2798 - Msg: new position: 51.9294903-8.5130684
I/Capacitor/Console: File: http://localhost/home-home-module-es2015.js - Line 2799 - Msg: here!
I/Capacitor/Console: File: http://localhost/home-home-module-es2015.js - Line 2798 - Msg: new position: 51.9294892-8.5130864
I/Capacitor/Console: File: http://localhost/home-home-module-es2015.js - Line 2799 - Msg: here!
I/Capacitor/Console: File: http://localhost/home-home-module-es2015.js - Line 2798 - Msg: new position: 51.9294903-8.5130689
I/Capacitor/Console: File: http://localhost/home-home-module-es2015.js - Line 2799 - Msg: here!
I/Capacitor/Console: File: http://localhost/home-home-module-es2015.js - Line 2798 - Msg: new position: 51.9294889-8.5130857
I/Capacitor/Console: File: http://localhost/home-home-module-es2015.js - Line 2799 - Msg: here!
I/Capacitor/Console: File: http://localhost/home-home-module-es2015.js - Line 2798 - Msg: new position: 51.9294902-8.5130694
I/Capacitor/Console: File: http://localhost/home-home-module-es2015.js - Line 2799 - Msg: here!
I/Capacitor/Console: File: http://localhost/home-home-module-es2015.js - Line 2798 - Msg: new position: 51.9294906-8.5130662
I/Capacitor/Console: File: http://localhost/home-home-module-es2015.js - Line 2799 - Msg: here!
D/InputMethodManager: prepareNavigationBarInfo() DecorView@80c6513[MainActivity]
getNavigationBarColor() -855310
V/InputMethodManager: Starting input: tba=io.ionic.starter ic=null mNaviBarColor -855310 mIsGetNaviBarColorSuccess true , NavVisible : true , NavTrans : false
D/InputMethodManager: startInputInner - Id : 0
I/InputMethodManager: startInputInner - mService.startInputOrWindowGainedFocus
D/InputTransport: Input channel constructed: fd=165
Input channel destroyed: fd=159
W/IInputConnectionWrapper: getExtractedText on inactive InputConnection
W/IInputConnectionWrapper: getTextBeforeCursor on inactive InputConnection
D/Capacitor: App paused
D/ViewRootImpl@84a84ac[MainActivity]: dispatchDetachedFromWindow
D/ViewRootImpl@84a84ac[MainActivity]: Surface release. android.view.ViewRootImpl.doDie:7954 android.view.ViewRootImpl$ViewRootHandler.handleMessage:4955 android.os.Handler.dispatchMessage:106 android.os.Looper.loop:214 android.app.ActivityThread.main:6986 java.lang.reflect.Method.invoke:-2 com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run:494 com.android.internal.os.ZygoteInit.main:1445
D/InputTransport: Input channel destroyed: fd=148
D/Capacitor/Plugin/App: Firing change: false
V/Capacitor/Plugin/App: Notifying listeners for event appStateChange
D/Capacitor/Plugin/App: No listeners found for event appStateChange
D/Capacitor: App stopped
D/Capacitor: Saving instance state!
D/ViewRootImpl@edef802[MainActivity]: MSG_WINDOW_FOCUS_CHANGED 0 1
D/InputMethodManager: prepareNavigationBarInfo() DecorView@80c6513[MainActivity]
getNavigationBarColor() -855310
W/libEGL: EGLNativeWindowType 0x72fcae1010 disconnect failed
D/OpenGLRenderer: eglDestroySurface = 0x72f3f9a400, 0x72fcae1000
D/ViewRootImpl@edef802[MainActivity]: Relayout returned: old=[0,0][1080,2220] new=[0,0][1080,2220] result=0x5 surface={valid=false 0} changed=true
D/ViewRootImpl@edef802[MainActivity]: Relayout returned: old=[0,0][1080,2220] new=[0,0][1080,2220] result=0x1 surface={valid=false 0} changed=false

The updated console.log is being logged, but my map is not being displayed.

If you see the log message then it’s clearly using the latest code now. So there must be some other reason why the map doesn’t work in Android.

I don’t know enough about your code to guess why, but you could try using the Chrome Dev Tools to debug it while it’s running on Android. See Remote Debugging WebViews

1 Like