Android Studio and Capacitor cannot finde console.log() output - android-studio

I have a Angular Application that i converted via Capacitor to a Android App. If i start my app in Android Studio i cannot access my Nodejs. Therefor i want to use the console.log() to see where my problem is.
But i cant find an output of my log, even though its there in the web console.

You can see Capacitor logs in two different places.
Chrome remote inspector, just type this in your Desktop Chrome chrome://inspect/#devices and your device should appear there and a list of webs and apps that can be debugged, choose your app and you'll see all the console.logs there.
Logcat. Inside Android Studio on the bottom on the screen there should be a Logcat section, if you click it it should show console.log messages and also native messages.

Related

Infinite app closing issue in android studio

I have just changed the package name in the android studio, and also replaced the new google-services.json file downloaded from the firebase console to configure the new package. After these changes, the application is installed properly on the emulator but it is displaying just a white screen and not moving to the splash screen. Even, It is not going to Launcher activity, I have tried to debug by putting the breakpoints. In the logcat of the android studio, it seems it is closing and opening in infinite ways. I have also attached the screenshots here.

How to debug a website in Android Studio?

I've suspected for a while that my website doesn't work on Android WebView. Trying to debug this, I've installed Android Studio, and fired up some emulators. Sure enough, my website does not behave properly when viewed in WebView in the emulator.
But, I'm not an app developer, and I've never used Android Studio before. Predictably, all of the docs are focused on creating apps :).
How can I debug what's happening in the WebView? Do I need to create an empty project? Is there some DevTools equivalent? Or maybe some way to dump what it's doing to a log file?
I just need a starting point, and am happy to read docs if I'm pointed in the right direction.

Setting up DevTools failed (Flutter Inspector)

I could not find solution to this either on google or here on StackOverflow. There is only and only 1 question answered related to this issue [https://stackoverflow.com/questions/64655867/about-android-studio-and-flutter-inspector], however for a beginner like me, its not clear about what exactly to do.
Additional information:
OS: Windows
Android studio version 4.1.1
App is running in avd when I opened flutter inspector panel.
Stopped and run the app again.
Previously, somewhere I read that if inspector is not showing anything, click on any widget pressing ctrl key. That worked previously, but not working now. Sure, that was different error and different situation.
flutter doctor screenshot also attached
flutter inspector screenshot
flutter doctor screenshot
This answer from related question helped.
...
And the third one (the one that worked for me): go to File >
Settings > Languages & Frameworks > Flutter > Experiments … and there
you should uncheck “Enable embedding DevTools in the Flutter Inspector
tool window”. That should allow you to use devtools locally instead of
the embedded ones.
picture for reference
Source: https://stackoverflow.com/a/65542661/17789382
Launch Flutter DevTools from terminal using command dart devtools which opens DevTools in the browser. Connect to the address in which debug/run service listening on. Address can be found in the console when the app starts running. Ex: ws://127.0.0.1:54851/JF3H6rhQnN0=/ws.
The following steps helped me to get Flutter Inspector Widget Tree back, hopefully, it will help you as well:
File -> Settings -> Languages & Frameworks -> Flutter:
Enable (Check) "Open Flutter Inspector view on app launch"
Stop and start the app again.
Note: In order for something to show up in the Flutter Inspector, your app has to be running on a Device or on a Simulator or Emulator.

Capacitor compiled Ionic app: How to debug in Android Studio?

I used the command
ngx cap open android
to open my Ionic 5 project in Android Studio like described here. This works fine.
In my app, i`m connecting to server which returns json data needed by my app. This connection does not seem to work, I only have the loading animation in my app.
How can I debug this? It is working in the PWA version and on my Ionic testserver, but the app has a problem connecting. I need an error message or something, to know what goes wrong.
What is a good way to fix such problems? Can I output or log something in android studio from the typescript code?
Open the Chrome browser and navigate to the URL chrome://inspect/#devices. Your connected Android device should show up in the list of Remote Targets.
On your device, open the Ionic app that you would like to debug using Chrome.
With your app running on the device, head back to Chrome and click on inspect chrome://inspect/#devices
see more:
Capacitor compiled Ionic app: How to debug in Android Studio?
I have posted a full project here specifically for use with Angular and Capacitor.
I believe the trick is that you have to use live-reload to debug. If you used the ionic cli to build your project then you should be good to go using the basic commands provided, otherwise you will need to so some modifications manually. This project, post breaks it all down
https://github.com/aaronksaunders/plain-ng-cap-app
Capacitor Run, see section on liveReload - https://ionicframework.com/docs/cli/commands/capacitor-run

How can you display your logs when testing android apps on real devices?

So I am developing my first app with Android Studio, it's a Shopping app and everything seems to work just fine when I try it out on the built-in Emulator (Android 9). However, when I connect my Smartphone (same Android version), I won't get pass my Login screen. Currently the data is stored through SQLite, which may cause issues.
I'd really like to look up what's the exact problem, but there is no Log feed showing up in Android Studios.
Are there any settings that provide the same Logs as if I was running it on an Emulator?
Make sure you have selected right device i.e there is a dropdown option for devices in logcat check that and choose your device because it will be set to the previous device by default
If I'm understanding correctly, you would want to use logcat?You can debug phone issues in it also, just select your phone in the options. I have two external phones I test on, logcat shows those phones.

Resources