Ensure that the Eclipse LogCat displays items relevant to my application - android

When I run my Android application in Eclipse on my machine, it automatically sets up a LogCat filter for my application, and only shows lines that are relevant to it.
However, running the same application on another PC (which happens to have Eclipse 'Mars') running on it, it just has one filter saying 'All messages (no filters)'.
Is there a setting somewhere to turn this on?
And incidentally, I know that I can set up a filter manually, but I liked the functionality that I had before, so I just want to turn that back on.

Regardless of what IDE you use I would recommend you take a look at pidcat.
From the repo:
Colored logcat script which only shows log entries for a specific application package.
You do need a bash terminal.
I will also recommend you move your project over to Android Studio.

Related

Hide application shortcut

I am trying to make an application of which I am trying to hide the launcher shortcut. The reason for this is so I could use this apps as a module / extension for another app without it being visible or cluttering the launcher environment (ie. having this app on your phone will unlock partial functionality in another app). I have been looking into how to do this for a while now, but I can't find a proper solution.
I have read a 'solution' to this issue that tells me to remove <category android:name="android.intent.category.LAUNCHER" /> from the AndroidManifest.xml file. This however results in Android Studio not being able to build or run the app at all, giving me an error that says Default Activity not found (I have tried this with a fresh project and an empty activity).
I am trying to develop this app on my personal device which is a Huawei P9 Lite, running android 6.0
Is there a way to do this?
EDIT
I've read somewhere that Google has removed the ability to uninstall shortcuts since android 6.0. Although it doesn't really say anything about hiding shortcuts for your application, I went ahead and assumed it's part of the same security fix.
Is there a way to do this for the newest platform versions?
I have read a 'solution' to this issue that tells me to remove from the AndroidManifest.xml file.
That is the correct answer.
This however results in Android Studio not being able to build or run the app at all, giving me an error that says Default Activity not found (I have tried this with a fresh project and an empty activity).
Well, it may not make sense to run it. After all, you say that this app is a plugin to some other app. In many cases, a plugin itself cannot run independently (e.g., you cannot run a browser plugin except via the hosting browser).
That being said, you can edit your run configuration via Run > Edit Configurations, and choose what you want to have happen when you run the module:
The run configuration for an app module defaults to "Default Activity", but you can choose something else (e.g., "Specific Activity").
I've read somewhere that Google has removed the ability to uninstall shortcuts since android 6.0.
That answer is unrelated to your question.

What can I do to prevent Android Studio from automatically clearing my log

I've got an activity that when it launches, it crashes but it leaves no trace of what went wrong in the console. I can see a very brief moment of red text before its cleared. The dropdown which shows the currently debugged app quickly switches from my app to "no debuggable applications" and back in the blink of an eye.
Is there a way to prevent this behavior?
You have to disable the ADB integration:
Tools -> Android -> Enable ADB integration
There should be no icon before this menu item.
Your LogCat now keeps the log output after your application closes or the application crashes.
Look at the Android Studio console and find the drop down list which states 'Show only selected application'. Change it to 'No Filters' to see all log output from the Android device. You'll have to navigate to find your crash, but your class names, etc. and log tags will all be there so it won't be too difficult.
You can store you log into a file. Go to your terminal and type adb logcat > logfile.txt
(If your have not done it before you will need to add the directory platform-tools of your sdk to your path. See this link http://www.troubleshooters.com/linux/prepostpath.htm)
I haven't found a a good solution to this behavior, but there are some alternative strategies for getting the logcat to display.
First, the logcat is actually available in two places in Android Studio. The first is the logcat tab in the debug pane, which is the one that gives me the most trouble. The second is the logcat tab in the Android pane, which usually works a little better. If there is nothing there either, typically setting the filter to "no filter" and log level to "error" will get me where I want to be.
Second, you can always run logcat from a command prompt. The output won't be as pretty or as readily filterable, but you can write it to a text file and search in there. I generally use adb logcat -v time > logcat.txtto include the timestamps and write the log to a text file.

Android device monitor crashing -- possibly due to Eclipse

Here's an odd issue I can't seem to find any information on.
I'm working on an Android app with a friend who uses Eclipse -- I use Ant and the Android command-line tools. Sometimes when I checkout code that was written by him and the project.properties file gets pulled into my local workspace, I'll have to change the path to the libraries back to where they're at on my machine, as it gets automatically set for him via Eclipse. This may be of use to know in light of what just started happening when I try to launch 'monitor' as I've always done; I get this error dialog box that pops up and says: An error has occurred, please see the logfile: /home/user/.android/monitor-workspace/.metadata/.log
So I did. It was, after I'd tried to launch monitor several times to no avail, a really long logcat-like file of Java traces. I cleared them out, thinking that perhaps it had run over its own max size for internal monitor data, but that didn't stop it crashing. A new set of errors just gets appended.
This is the first time this has ever happened, and unlike essentially every other Android problem I've had, I can't seem to find any existing information on it. The device monitor now seems to want to be integrated into Eclipse. I don't use Eclipse so I'm not sure how the monitor runs within it, or whether I'm correct in assuming that some configuration file somewhere needs to have a line changed (or whatever).
Here's the content of the logfile:
http://pastebin.com/JitCWrGg
Could anyone lend a word of advice?
Many thanks!

Possible reasons/fixes for build error for Android Emulator

STEPS-TAKEN: Not sure what the source of the problem is, but the quick description of the bug is that:
I install all required software, SDKs, configs,
Then create two new projects each using the tabbed-window template, each of which support deployment to Android.
Then I run one project via Titanium Studio's Run option, let the Android Emulator load, and confirm it's the app is installed an working.
Then I closed the emulator, and then run the other project the same way as the last, though when the app is shown on the screen it has the name of the first app, not the app run.
FIXES-TRIED: I've attempt executing "Project >> Clean" for all projects before the second run, and still get the same "bug".
SETUP: To my knowledge all of my configs are correct, and clearly the build "works" though it is very possible there is something wrong with my installation build chain to get to the point I'm running the app in Titanium Studio via the Android Emulator.
ERRORS: I've reviewed the console output for FastDev, AppInstall, Android-Emulator, etc and have seen no error messages that jump out; meaning I have seen no error messages, except for build.py error after the first script runs saying it didn't find the script running on a port when it attempt to kill it; given the request is to kill itself, and it's not found, I just assume this is a confusing way of saying the script did what it was suppose to do.
Current build: is on Windows-XP-SP3 using TiStudio 2.0.1 build, JavaSDK 1.6, r18-Android, and Android-2.2
Recent emulators have persistent state, so your second launch probably gets back the system you were running before.
You should not have to resort to this on a regular basis unless something is broken in the workflow, but deleting the AVD and making a new one should get you a clean slate.
I believe there is also a startup flag to the emulator which tells it not to use the checkpoint from a previous run, but start from scratch - you could try to change your configuration to use that flag.
A downside to either deleting or forgoing checkpoints is that the emulator will take longer to start up.
Really though, you are supposed to be able to re-install or launch a given application, or install a completely different one, all within the same running of an emulator. You aren't supposed to need a new emulator, any more than you need to go buy a new device (or perform a factory reset on it). So something is not right in the setup, and the best solution for long term productivity is to identify and fix that. Short term of course, you might need to wipe the slate clean if that helps you meet today's deadline.

Android application problems in Eclipse

I'm a .NET developer but I like JAVA so in my free time I play around with that. I don't normally use Eclipse but I installed the ADT eclipse plugin and Andriod SDK and I started learning and I made a new project with a TableLayout and it kinda looks good, and it runs ok on the emulator.
However... there a few things that drive me absolutely catatonic and perhaps I am doing something wrong so please help me out.
Firstly, if I change the main.xml file in whatever way, even by adding what is supposedly a correct parameter, it will start freaking out and will generate an error that just says "error" without specifying what that is, it will then generate a main.out.xml and then report an error that the main.out.xml is empty. It later won't let me delete that and will start generating a main.out.out.xml and so forth, even after I correct that original xml that caused the error.
The only way to get things going is to delete the bin folder, restart Eclipse, delete all the out xml files and then sometimes it will run the application or some other times it will start generating those 'out' files again and the loop goes on.
That way it takes hours to run a simple app even one without errors that used to run before.
Surely that was NOT how they intended it to work, is it??
Also.. there is no "Rebuild" button that will flush all files out automatically, or is it hidden somewhere? I am tired of manually deleting those automatically generated files and the build folder and all those out.xml files.
Also, while I'm at it, I also want to point out that the designer view sometimes disappears and there is nothing on earth that will bring it back, the only way is to create a new project and copy the main.xml to it and then it shows up again. Another bug?
I have the latest eclipse version:
Version: Indigo Service Release 2
Build id: 20120216-1857
If you have any clues how to get this to work, I will appreciate it!
Many thanks in advance
When you click the Run button with an XML file selected, Eclipse is running an XSL Transformation on that XML and producing the .out.xml file as the result. This is a feature of the Eclipse Web Tools feature, which you'll have if you installed the Eclipse for Java EE Developers package (it may be included in other packages, too).
As others have said above in the comments, to run your Android app, select the Project, right-click, and choose Run As > Android App. Once you've done that once, it will create a Launch Configuration that you can launch from the Run or Debug toolbar buttons (pressing the small down-arrow on the Run or Debug buttons brings up a list of Launch Configurations that you can select from, as well as an option to manage them).
There is a Preference that will make Eclipse always launch the last thing you ran or debugged, instead of trying to be smart about what is currently selected. Open the Preferences and navigate to Run/Debug > Launching; there you'll find the option under Launch Operation at the bottom of the window.

Categories

Resources