Can't see the code flowing while using chrome://inspect/#devices? - android

I am working on an app,which I have installed in my Smartphone, I wanted to check the flow of code while running the app.
using Android Studio I installed the app via USB Debugger, and open the app project files in
chrome://inspect/#devices
, while running , I have added multiple breakpoints in the code to see the flow, but the code haven't stopped at any breakpoint, yet there is no issue with the running of app, the app ran smoothly.
I am facing the same issue while using emulator as well.
Can someone help me to figure out, what I could do ?
EDIT -
I have followed #KannanSJD instructions as well, by "Attaching Debugger to Android" and selecting "Java Only" but not got any success. , As you can see in the below attachments

make sure you attach your debugger to your app process. Use the below icon on top left
if your app package and its process is not showing then make sure you are running in Debug mode and not in release mode using build variants.
Make sure your app is open and you see your process as in screenshot.
Also instead of detect automatically you cna use Java only if you have NDK also used in your project. This will fasten the process of attaching debugger.
Also make sure you find the following log in your debug console.
Please check if you have muted your breakpoints, refer following image. That should NOT be enabled.

Related

App isn't installed on your device error in very first program

There seem to be too many bugs which have not been properly documented, regarding android studio. I am trying to run a basic Hello world app, and this error is truly making me give up any more efforts.
What I did:
Open Android studio(also tried running as administrator) and tried to run the default Hello world app on an Android 10 device(Xiaomi). At the start it shows Failed to start monitoring 7D8XXCOJGQQCZLJV(device number). At first I ignored it being a beginner and clicked on the run button. The file was successfully built and the RUN section shows 'Install successfully finished'.
Now for clarity here are some screenshots that will display what happened on my android device after the above steps:
The app seemed to be installed correctly, but whenever I click on the app logo the response I get is really frustrating:
As per the this link I tried to go to the device manager and do some changes, by setting and enabling Xiaomi drivers for Portable devices.
But then windows shows:
If anybody knows how to solve this, please do help me in doing so. It is quite discouraging to experience so many errors, right at the beginning. If somebody could give a working solution then that would really help me in continuing my android journey.
There was just a tiny error that led to this entire problem. This was because I had set the value of android:exported="false" in the main activity, which had to be set to true. Hope that this may help anybody in the future!
set the value of android:exported="true" in the AndroidManifest

How to start developing app for Google Glass?

I am working on a Google glass Android app. I have installed the glass development kit (GDK) in Android SDK. Now I created a glass project using Android Studio (Version 3.3.2). The newly created project is showing an error "Default Activity not found" in run->edit configuration.
Please refer the screenshot for the error.
1.
And 2. By clicking run->Edit Configuration in menu.
I have searched a lot on Google and found many articles regarding the same. All are suggested to set the edit configurations option like below.
Module: app
Package: Deploy default APK
Activity: Launch default Activity
Target Device: USB Device
I did the same, but no one is working for me. After spending the whole day to make it work, I came here. This error is due to the Launcher activity, because there is no launcher activity in Google glass project instead it uses Voice Trigger intent filter. It is similar to wearable apps they also don't have the launcher activity.
Android Studio won't let you use a standard run configuration without specifying a launcher in the manifest.
You could try using the gradle command line instead:
./gradlew installDebug
In case you haven't resolved the issue. I came across similar issue before, two ways worked for me:
Choose "Nothing" as the option. You will be able to run the app manually on the Glass, but your debugger won't work straight away. You have to manually attach the debugger to the process. You may also have to use logcat if there is a bug in the launching process.
Specify an activity (whichever is associated with voice trigger).
Also, I noticed that you created the app using Kotlin. Kotlin activity didn't work in my case, throwing exceptions associated with nullable var when resuming the activity. Non-activity classes worked fine. Please let me know if Kotlin activity worked in your case.

Unable to set breakpoints in Android Studio

I am working on Ubuntu 14.04, AndroidStudio is 1.2.1.1. I am able to build the app, click on the "Debug" icon and launch the app. I can see logcat output and I can pause the app from the debugger. The one thing I cannot do is set a break point. I tried clearing the cache, restarting AS, right clicking in the file where I want to set the break point. None of these produce the desired effect. This is a well-hidden feature.
I also had this same issue in Android Studio, where I couldn't set breakpoints. This is what I was doing wrong: I was clicking on a line that didn't have any code in it, or a line that contained a comment. As soon as I clicked on a line in method/class, it allowed me to set the breakpoint.
There shouldn't be any problems setting break points if you follow the process outlined here
If you are running into some issues, here are a few steps to get you started:
- Use a Log.d() in your app and see if it outputs to the logs. If it doesn't then you know you are not in debug mode.
- Are you debugging on the device or the emulator? If the device, you need to enable development. I would suggest to select "wait for debugger" to make sure it's attached before you run the code.
This should be pretty straightforward. Let me know what you find out.
To add a line breakpoint, proceed as follows:
Locate the line of code where you want to pause execution, then either click the left gutter along that line of code or place the caret on the line and press Control+F8 (on Mac, Command+F8).
If your app is already running, you don't need to update it to add the breakpoint—just click Attach debugger to Android proccess . Otherwise, start debugging by clicking Debug .

Application Instead of running redirects itself into Debugging mode

I have an android application,it takes me in unusual situation when I going to run my application it automatically redirects itself to debugging mode, and debugging screen is displayed whenever I want to run the application from eclipse to my cell phone,I removed all the breakpoints, I uninstalled my application, remove my project from workspace then again add it to but can't get success, I haev already tested all of the techniques which may help me to get out of this problem but nothing works for me.
Try to add below line in manifest file
android:debuggable = false
For more info visit this link

How to debug an android application

Over the course of this project so far i've gotten used to looking at the logcat to tell me where the problem is when my app crashes, but my current problem doesn't crash the app it just does something it shouldn't and i can't find the code that's casuing the problem.
I've tried to debug before and go through the code line by line to see what causes it but for this android app it wont work. These are the steps i have taken.
added debuggable = true to the manifest inside the opening application tag.
added a line breakpoint on the line i wish the app to stop debugging on.
I switch to debug perspective in eclipse and start debugging the application
It seems to just stop when the console says this: Attempting to connect debugger to 'w1279057.CW1' on port 8688
Have i done something wrong?
If you are using Eclipse then http://www.vogella.de/articles/EclipseDebugging/article.html and use LogCat
If you are triying to debug on a real phone you need to enable USB debugging in the settings. It is explained here:
http://www.groovypost.com/howto/mobile/how-to-enable-usb-debugging-android-phone/

Categories

Resources