Nooby Android Developer - android

so I just recently (yesterday) started developing on the Android platform. So far I have created a Hello World application as described in their tutorial, but it does not run. When I run it, it waits at the blinky Android screen, then finally moves to the screen where it says Android in a fancy font and its kind of glossy and silver but never moves from there. What have I done wrong? Thank you.

That just sounds like the Android emulator isn't starting properly.
If you run adb logcat from the command line, or open "LogCat" view in Eclipse, do you see any messages appearing? You may have to select the "emulator-5554" device first from the "Devices" tab first.

Try exiting the emulator and eclipse both, and then restarting eclipse and running the project once again. This worked for me.

Related

Writing first Android app, stuck trying to simply run the Hello World tutorial

I'm new to Java, haven't used Eclipse in probably 2 years. We're starting up a mobile dev team at work, and I'm just going over the tutorials on the Android site:
http://developer.android.com/training/basics/firstapp/running-app.html
Simply just created a project, launched the virtual device manager, have that emulator running, then click Run -> Run as Android application in Eclipse .
I've been staring at this screen for about 5 minutes now:
It says "Launching (100%)" in the bottom right corner of eclipse, and this Progres window just says Launching, but the emulator isn't doing anything.
I know emulators are generally pretty slow... But is this normal or did I do something wrong?
That happened to me too, and still does at times:
Close the emulator and execute the program again
If that didn't work, execute the program while the emulator is running. A new emulator will pop up, close the old emulator
If that didn't work, delete device and create a new one.
Also, is there anything at all popping up on the Logcat view?
I would recommand checking the list of process afterwards. Sometimes when i brutally terminate an app in eclipse, the process is still running.
But i'm on PC and i use an older version. Maybe it has been fixed.

android eclipse avd

I'm a newbie that needs some help on getting the AVD running with my app. I've been developing C code for decades, but I have to admit the Eclipse/AVD setup has me stumped! I'm following the 'HelloWorld' tutorials on the developer.android website (and some others) and everything seems to be working OK, up to the point where I try to run it on the AVD simulator. I'm not getting any warnings, the Eclipse build/run output window says that everything is installed OK and the AVD does startup and run. Eclipse says that my app is loading, but it never runs. All I get is the simulator window with "ANDROID" on the screen and the buttons on the right-hand side.
I've got Eclipse Indigo and r18 of the Android PlugIn (I tried to install Helios, but the Eclipse website directed me to Indigo!). Is Indigo OK for running the simulator, or do I specifically need Helios? I also have Java 1.7.
The API level I have installed is Level 15 (v4.xxx of Android, I think). Don't know if I need a lower version to get my tutorial app to run, but level 15 is the only one I can select when setting up a device in the AVD manager.
I've been trying to get this going for days, trying all sorts of switches and buttons, but to no avail. Before I start uninstalling everything and reinstalling, can anyone advise if there is anything I might be missing, or has tripped over this problem themselves and found a way around it? Something that always trips up new starters maybe? Or do I need to go back to scratch?
Any help would be much appreciated.
How long are you leaving your emulator running after you attempt to launch your application? The Android OS can take a long time to boot up in the emulator. If it's stuck on the "ANDROID" screen then you're either not waiting long enough or there's something wrong with your emulator. It should eventually boot into the normal Android lock screen or home screen just like a device.
You can launch your emulator ahead of attempting to run your app by opening the Android Virtual Device Manager (toolbar icon in Eclipse, if installed properly) and then selecting an emulator and clicking the "Start" button. If you don't have any emulators listed, then you need to create one by clicking the "New..." button.

Emulator in Eclipse on Mac OS X

This is my first time running Eclipse on a mac. For some reason, when I launch an app in the emulator, while the console tells me that it successfully started the app, I can't see an emulator window anywhere. I know its running bc when I tried again, console told me "Activity not started, its current task has been brought to the front."
How do I find the emulator?!
Did you try cycling through open applications with command-tab or clicking on the application icon in the dock? Running applications will have a bright dot under them.
Ok, I'm using MotoDev Studio. Apparently I had to click the little cell phone icon in the bottom right to bring up the emulator.
Thanks all!

Don't see "Hello,Android" on emulator

I created Hello,Android application with TextView, not xml.
When I run it I don't see "Hello,Android", only wallpaper.
Any ideas, what is wrong?
It takes up to 2 minutes to have the run app rendered. Don't worry, just be patient.
You can leave the emulator running and run the app over and over again so it will not take that long after the first time.
I also found that starting the emulator from the command line is a lot faster, and you can just leave it running, and run the app from Eclipse; this way starting the app will not take long at all since your emulator has been running already.
I hope above is helpful...
I guess you are using Eclipse so the first question is Do you have an android phone connected to the computer? If so the "Hello, Android"-program will hopefully be running on that.
I had the same problem, and I gues I know why I couldnt see "Hello, Android".
You just have to click on
"Home" Icon in the emulator
Select applications icon at the bottom of emulator desktop.
Lauch the helloAndroid application to see the message.
Hope this helps.
Lasantha

Why doesn't logcat show anything in my Android?

Why doesn't logcat show anything in my Android (while developing apps with Eclipse)?
It just doesn't print anything. It's empty.
I had this same issue but my fix was much more basic:
If the LogCat panel is empty in Eclipse the emulator doesn't have the focus. Go to the DDMS perspective and try clicking on the 'emulator' entry in the Devices panel (top-left screen).
Dial
*#*#2846579#*#*
and you will see a hidden menu. Go to the Project Menu > Background Setting > Log setting and define the log availability (log switch) and level (log level setting).
Please note this may apply to Huawei phones only as is stated for an Ideos X3 (here) and is tested at a Honor U8860.
If clicking in Devices panel doesn't bring the spam, use reset adb in dropout menu from triangle on the right of the snapshot button.
I have the same problem on/off and the way I solved is by menu File → Restart (restart Eclipse).
Maybe you have Mylyn installed?
http://code.google.com/p/android/issues/detail?id=1808
While the answer provided by MoMo will resolve the problem temporarily it will most likely reoccur the next time you launch Eclipse, or launch on a different Emulator/Device.
Instead of always having to select my device in the devices view I've found a better solution is to go into your Eclipse preferences and navigate to Android -> LogCat in the list on the left and then enable "Monitor logcat for messages from applications in workspace".
This way no matter what device you are using logcat will automatically start showing output from it as soon as the application launches.
It will also setup a filter that ensures that only output from your application is displayed, which you can reuse / disable as needed.
Maybe the log is not enabled in your device.
Try to run the following command.
adb shell
echo 1 > /sys/kernel/logger/log_main/enable
OK. This is how I got it to work. I first followed MoMo's advice, that is...
If the LogCat panel is empty in Eclipse the emulator doesn't have the
focus. Go to the DDMS perspective and try clicking on the 'emulator'
entry in the Devices panel (top-left screen).
But to no avail.
I then attempted to reset adb (Android Debug Bridge) as suggested by fyodorananiev.
How? Menu Window → Devices → upside down triangle menu button → Reset adb.
It also didn't work, but I did get the following message:
Android hierarchyviewer: Unable to get the focused window from device
This meant that MoMo was right in that my Android device or emulator didn't have focus. However, the solution I did in my case is different.
What worked for me:
Replugged my Android device, which was connected to my computer via USB.
Restarted Eclipse, as mentioned by Abu Hamzah (although since I didn't know I can do menu File → Restart, I manually closed down Eclipse, and then restarted the application again.)
I can now see logs in my logcat.
Go to Developer settings and check that for Debugging\Select App for Debugging is empty
If you are using a device, the simplest check is to restart Eclipse.
You don't have to shutdown Eclipse
Use menu File → Restart
In a quick second or two you should see your LogCat return.
The simplest solution worked for me: Shutdown and restart my phone and Eclipse alike.
I had faced the same issue but in my case logs are shown when other devices are connected and not shown when my device is connected.
It took me days and finally, the issue resolved when I restarted my phone.
Below: Really dumb answer, but it happens!
My cat stepped on the space button while I was away and [SPACE]xN was typed in the search bar.
That resulted in an empty Log Cat. I tried restarting and wasted like 1 hour before I realized I should clear my search bar.
TLDR; CLEAR YOUR LOG CAT SEARCH BAR!
I think you haven't selected the device or emulator, on which running your application.
In Eclipse, go to DDMS Perspective and select the device or emulator on which you are running your application.
(Note: No need to restart Eclipse)
In case if you are using CyanogenMod in your mobile, it will disable logging by default. Try this method:
In your device, open "/system/etc/init.d/" folder
If there are many files, try opening each file and find for this line:
rm /dev/log/main
Now, comment this line like this: # rm /dev/log/main
Save the file and reboot.
It gets interesting when you find out that none of all the answers in for this question were helpful.
And then you find out that in your version of ADT 22.6.3.v201404151837-1123206 if you add two filters with the same package name (application name) then the log will not appear.
It was weird, because the log was there two seconds ago, and launching the app in debug mode adds a default filter for the app which collides with the filter I've setup manually, and then ADT magically removes all the logs, and none of the filter worked including the all messages (no filters)!
But it was masking another issue...
I'm working with dual screens. The second one is connected via VGA/RGB - (not really sure what it's called) and what can I do. I'm a ton more comfortable with the logcat away from my code editors, so I've placed it in another window, and as it turns out that is the main reason for the disappearing logs for me.
If using the DDMS to refocus doesn't work, try closing and restarting LogCat. That helped me.
I've had this happen occasionally. Closing and re-opening Eclipse seems to fix it.
If you tried all of the others, and still got losing on an empty logcat. I got another simple way.
Download an old version of ADB, and try again. It might be working, at least working for me with Android 7.0 phone (vendor stopped updating).
Here is the useful link for old versions.
I had the same issue. No need to restart Eclipse or clean your project. You may follow:
Click on LogCat icon on bottom right corner of eclipse.
In Saved Filter Pane (Left side), double click package of your project (in my case it's com.apps..*).
In Logcate Message Filter Settings popup, select desired option of "by Log Level". You can select verbose, info, error etc.
Click Ok.
Run/Debug your project.
This is simple.
Just close the Logcat from eclipse.
Then reopen it by following steps in Eclipse.
Window - Show View - Other - Android - LogCat - ok
Hope this solves your problem.
Many times when I switched to a new Android device, I do see no more logcat messages. Unfortunately, none of the above suggestions worked for me (Eclipse Photon 4.8.0).
I am now using this . It seems to work for different devices.
Check if the Console is telling you something. Usually this happens when the project could not be installed in the device, and just shows the previous one.
The most common case I have seen this is when there are different signatures in the project, and is not running at all.
Please, read all the red letters you see. If the LogCat does not show anything, take for sure that the Console will do.
For OnePlus devices and Ubuntu OS:
Install Wine on Ubuntu
Install ADB tools on Ubuntu
sudo apt-get install android-tools-adb
Now, attach your device to PC with USB.
Open mounted "One Plus Drivers". A disc like icon
Right click on OnePlus_USB_Drivers_setup.exe and run with Wine
Then open the terminal in the present drive where your "OnePlus_USB_Drivers_setup.exe" and other driver files exists. And run
./adb_config_Linux_OSX.sh or sh adb_config_Linux_OSX.sh
Close this terminal
Open a new terminal and run
adb server-start
Your OnePlus device should prompt you to recognise your PC as a debugging agent.
Now, run on the terminal. It should show your device.
adb devices
Reference: [SOLVED] Android Studio does not recognise my One Plus Two in Linux
Set the same date and time in your Android phone and in your laptop.
I had a similar problem of logs not showing, and when I set the correct date in the phone I started seeing the logs (I restarted the phone and the hour was completely wrong!).
What worked for me besides restarting Eclipse was:
Remove custom filters
After removing all filters, logcat was filled with text again
Close logcat and then reopen it from Window → Show View → Others.
If you're using Eclipse v4.5 (Mars) (at least, Mars.1 or Mars.2), try the solution described here: Logcat show invisible messages in Eclipse Mars.
It helped in my case.
In my case (after trying all the answers provided here to no avail), the problem (and solution) has to do with port 8700:
What I needed to do is:
Exit "Android Device Monitor" (monitor.bat)
Exit all instances of Eclipse.
C:\adt-bundle-windows-x86_64\sdk\tools>..\platform-tools\adb.exe kill-server
C:\adt-bundle-windows-x86_64\sdk\tools>..\platform-tools\adb.exe start-server
C:\adt-bundle-windows-x86_64\sdk\tools> monitor.bat
Also, the Scroll Lock button, needs to be "pressed/active":
Not the other way:

Categories

Resources