This is a follow up question to this previously asked question:
Eclipse ADT: Working but "Terminate" button greyed out...?
Like in the question above, the terminate button in Eclipse is grayed out, so like the answer is saying, I'm choosing the debug perspective, choosing the app name and then the button is enabled and I can terminate the session.
The problem is that this proccess repeats itself all the time. The button keeps graying out every time I open the debug and I have to repeat the above proccess every single time. Is there a way to fix it?
You can add the Devices view to your perspective - and then you don't need to change to the Debug perspective. To add it, go to Window -> show View -> Devices
Related
I'm writing a little Android App and things are working out nicely, actually. The only problem I'm facing is that Android Studio won't let me refactor all of the occurrences of the variable I inted to rename (see: attached link).
I'm simply using the Alt-Shift-R Shortcut, entering the wanted text and pressing enter. The field variable is changed - but its occurences (though highlighted before) aren't. Using the preview window doesn't change the outcome.
Am I missing anything? I feel like a moron. :')
Variable naming after hitting Enter-Button
valueAusgabe is the previous naming
If you're on Windows or Linux you should be able to rename all occurrences of your variable (variableAusgabe) by just using the Ctrl+Shift+R shortcut.
When you use this, a pop-up shows up and you have to enter the text you want to replace (variableAusgabe), and the text you want to replace it with. Select Refactor for each occurrence or Replace All.
In Android Studio (ver.3.1) shortcut for Refactor/Rename is: Shift+F6.
ctrl + R in windows,
it works for me
I also faced the same problem a few days back, just go ahead to refactor the variable and when the popup appears to confirm the refactoring the variable just uncheck the "Search in comments and strings", and it should work.
You might have some software running in the background that catches the event and isn't firing it back at the system for other software to process it.
One example, and a very popular one, is GeForce Experience In-Game Overlay (Shadowplay). Shift+F6 is used by it to switch post-processing filter slots.
If you happen to run a device with an nvidia chip, you probably have it running.
Steps to find and fix the issue:
Open its settings:
Alt+Z by default, or
RMB click its icon in the tray -> GF Experience -> Gear icon in the upper-right corner -> Scroll down to In-Game Overlay -> Press the Settings button.
Click the Gear icon on the right.
Keyboard shortcuts.
Find Shift+F6, click, press Delete on your keyboard.
If that software is not running in the background, it may be something else but equally as "greedy" is running then. Look for it in the tray. Good luck!
I'm experiencing very interesting problem with my Galaxy S6 Edge phone with marshmallow. When I go to developer options. Instead of a long list of options I get a message of "developer options not available for this user". As far as I know, I don't have any other user (I even don't know how to add a user, to be honest). I saw a couple of people had a similar issue with kitkat but they weren't even able to get the developer options menu item in the settings. I have that developer options item and I actually have it for a while. I haven't done anything special recently and I wonder anyone experienced this before and whether there is a way of fixing this without factory reset.
Finally there are a couple of more symptoms which may/may not be related with this.
Task Switch button at the bottom of screen doesn't work.
The settings button on the notifications panel doesn't work
EDIT : I had to fix the issue by factory reset, I didn't have the chance to try Victor's answer but I am accepting it as the right answer since there are some people who were able to fix their issue
One solution is to run the com.google.android.setupwizard/.SetupWizardTestActivity activity and step through the setup wizard - https://plus.google.com/u/0/+PaulOBrien/posts/8EGNvpY9jQa
A relatively easy way of running that activity is described here: http://forums.androidcentral.com/samsung-galaxy-s7/659407-s7-edge-not-showing-notifications-tray-recent-apps-button-settings-button-dnt-work.html#post5083902
1) Download Nova Launcher & set it as default to replace TouchWiz.
2) Long press on the home screen.
3) Choose Widgets.
4) At the top, under Nova Launcher, scroll to the right & press & hold on Activities and place it somewhere empty on the home screen.
5) Scroll down to Setup Wizard. I saw 2 Setup Wizard options.
6) Under the first Setup Wizard option, I opened it & scrolled down to the 3rd choice which said ".SetupWizardTestActivity". It might be in a different spot for you, but look at the small writing, that's how I saw this one.
7) Select that to create the widget shortcut.
8) Open it. Apparently you're supposed to have a menu to go through and just click through "Next", but there wasn't one for me.
Following the instructions in that forum post fixed the problem on my Note 4.
I was able to fix this by adding and then deleting a new user:
In Settings, go to "Users".
Tap "Add user" and follow the prompts, including "Set up now" to switch to the new user.
Repeat step #1.
Tap your original user to switch back.
Repeat step #1.
Tap the gear icon next to the new user, then tap "Remove user" and follow the prompts.
Recently I noticed one thing in my app.
I created apk for my app say ABC.apk and copied to my device and installed it by clicking on it. After the installation got successfully completed, I got 2 options 'Done' and 'Open', the usual options we get after installation.
I clicked on 'Open' and run the app. I moved to some screen and I minimized the app and moved to someother app, when I click my ABC, it started from my first screen.
It was just fraction of seconds I moved back to it, hence it should not be killed though launched it like it is first time.
Few things I noticed I if I explicitly killed this first instance from background running apps and start the app again it is not giving me this problem, same if I click 'Done' instead of 'Open' it works fine.
Is there anyone who are facing same issue, or have some solution for it?
Thanks in advance.
Prajakta
The problem is the way that the app gets launched from the installer doesn't exactly match the way Android launches apps from the HOME screen. Because this, if you initially launch your app from the installer, when you then later launch the app again from the HOME screen, Android doesn't recognize that the app is already running and just creates a new instance of the root Activity and adds it to the existing task on top of whatever activities are already there.
This is why, if you kill the app and start it again from the HOME screen, you won't ever see this strange behaviour.
This is a nasty Android bug which has been around since the dawn of time and is still broken, even though countless issues have been opened about it and the behaviour is reproducible and well-documented.
See the following issues and questions:
https://issuetracker.google.com/issues/36941942
https://issuetracker.google.com/issues/36907463
https://issuetracker.google.com/issues/64108432
App restarts rather than resumes
Re-launch of Activity on Home button, but...only the first time
There is a workaround documented in my answer to
Re-launch of Activity on Home button, but...only the first time
Just some general comments that come to mind that you must consider that can cause problems.
If you are trying to deploy an apk, did you switch from debug to release before building it? Make sure you are doing a full release. Do a clean and rebuild while in release mode as well.
Did you sign the apk?
Make sure all the necessary (if any) permissions are set in the manifest that will be needed by your app, on the device.
Hope these help point you in a direction.
Mike
(Sorry if I'm butchering any terminology- I'm still getting the hang of Android development. Please feel free to point out my mistakes)
I'm working on a project using several Service objects which appear as separate processes which appear under the Devices window in Eclipse's DDMS perspective. In order to step through one of these, I select its row, and click on the little bug icon (its tooltip is "Debug the selected process, provided its source project is present and open in the workspace").
I'm trying to debug one of these services' instantiation code. That doesn't allow me the needed time to perform those two mouse clicks, so my pre-set breakpoints won't pause the execution where I need.
In desperation I've tried using Thread.sleep() in the Service's onCreate() method, but it's only somewhat helpful, and a nasty habit I'd rather not develop.
What's the right way to debug this sort of code?
Thanks for you help!
Place a breakpoint at the earliest point possible in the main process (perhaps the first activity or a service that runs at startup).
Right click the breakpoint --> Breakpoint Properties... --> choose 'Suspend VM'
Run your app in debug mode (F11). When it reaches the breakpoint it should halt everything else, giving you the time needed to click the debug icon on the process you want.
I'm new to the Android framework (using Eclipse) and I have a question about debugging. Recently I did this error in an activity:
// The installation button
Button button = (Button) findViewById(R.id.preparationInstallButtonID);
button.setOnClickListener(this);
setContentView(R.layout.preparation);
i.e. I tried to add an onclick-event prior the layout had been rendered. This crashed the program, "Sorry, the application xxx has stopped unexpectedly". Running it again, with debug-mode, Eclipse opens a Debug-window containing "Thread<3> (Suspended)" etc (I'm sure you know which window I'm talking about).
Now, how am I able to extract useful data here? Regarding the problem above I found how to fix it by trial-and-erroring, but let's say I'm not able to do trial-and-error, how can the debug-window help me find the source of the error? It says "exception RuntimeException", but I don't see any pointers as of where in my code the exception occured.
If You want to debug:
Right click left of Your part of code You want to debug (at line number). select Toggle Breakpoint.
You can see small circle beside the line number, that is the breakpoint.
Then, make run configuration, click small arrow beside run icon, and click 'run configurations..'
Click on android application, you will see this dialog window:
Read it, "highlight" this: 'Press new button to create a configuration of the selected type'. Click the New button, above the tab, You will see this dialog:
fill it, browse Your project,
for example, I add Scrumptious project, and launch default activity. Click on Target Tab, choose Your emulator. If You want to run on physical device, click 'Always prompt to pick device'. I run on physical device this time,
for the Common tab, if maybe You want to check Display in favorites menu for 'Debug' or 'Run' option. It is optional. Click apply.
click debug icon - and select your project. If You activate 'Debug' on Display in favorites menu, the project will shown at the debug option menu.
I choose 'Always prompt to pick device', this dialog will shown. I want to run at physical device, so I click the device at the 'Choose a running Android Device', and click 'Ok'. You can also run on emulator. Just click your emulator, and click Ok.
If eclipse give confirmation to open perspective, select Yes
Then, if You want to know what is value of the variable, just put your mouse to the instance of variable, or You can browse at 'Variables' window at Debug perspective.
Use the LogCat this will give you the error messages and everything else that goes on in your testdevice/emulator.
Window -> Show View -> Other -> LogCat
I strongly recommend this tutorial on debugging in general.
http://www.vogella.com/articles/EclipseDebugging/article.html
It takes you through all the features Eclipse offers in that department and is well worth the time.
As far as the particular trick that might've helped, it might have been useful to set a breakpoint (i.e., clicking in the left margin of the code to make one of those blue pins appear). Then, when running in debug, you could stop near where the problem occurred, and step forward, beat by beat, using the "step into," "step forward," and "step return" commands at the top of debug window. While you're stepping around the code in that way, you might have the variables window open, so you could see what things are set in a manner they should be, etc.
Alternatively, you could set a breakpoint on RuntimeException (even one that's caught), by clicking on the Breakpoints window in debug, and then licking the "J!" button (the mouseover text shows "add Java Exception Breakpoint."
The debug view lets you do other cool stuff too, like:
letting you set "watchpoints", so you can see when the application changes relevant fields, etc.
"Drop to frame" so you can start your app in the middle.
Set up step filters, so that "stepping" through I mentioned earlier can be done more efficiently.
Create a detail formatter, a little snippet of java code that formats the output of a field so you can view it more cleanly in the debugger.
And much more!
Again, I recommend the above-referenced tutorial. And welcome to the wonderful world of debugging.