Tag Archives: Eclipse

ADB Server is Out of Date – Eclipse Error

04 Mar 2013

This morning I was unable to install/launch an android app from Eclipse to my test android tablet. I suspected it may have something to do with my having rooted an Android tablet the previous working day – but I can’t find a causal link to that effect.

Anyway, I either repaired the issue or found a work-around – either way I’m up again. Time will tell if this has been resolved… so here’s what I did:

  • I discovered online that HTC-Sync seems to cause this, and I *do* have an HTC EVO 4G test phone so I opened Task manager and killed the HTC Sync process (To be honest, this has never been an issue previously. I suspect that this step was unnecessary.)
  • Next I ran adb kill-server via the command prompt
  • I then restarted the server by issuing adb start-server
  • Eclipse didn’t like the above two steps so I restarted Eclipse
  • … and things seem to be ok atm
  • I’ll update this post if this continues to happen, else if this is the last sentence here then the problem for me has disappeared…

Javascript Validation Errors in Eclipse

12 Jan 2013

Every once in a while I’ll run into a JavaScript validation error – Eclipse’s JavaScript validator will sometimes catch something that I’ve missed and will print out a line number and file name in the Eclipse Problems View. The error I got today was a JavaScript validation error on line 1 of my phonegap javascript file. Line 1 contains a comment. Ooookay…

Disabling Javascript validation had not effect, cleaning the project did nothing. Restarting Eclipse and the resort of all last resorts (besides starting a new project from scratch and having to reinstall all plugins and custom work) I even restarted my computer.

The solution I found was to physically remove the phonegap js file from the project directory, right click the project root in the File Explorer and hit F5 or right-click and choose “Refresh”. The error should disappear. Add the js back to where it was and refresh the Project Explorer again. Problem solved, my app is now running!

Losing Device Connection in Eclipse

20 Jun 2012

There may come a time where you will encounter an “AdbCommandRejectedException error: device not found” while trying to upload your app to your device from within Eclipse. This message will appear in the console and will be accompanied by this text: “Error during Sync: An established connection was aborted by the software in your host machine”. As a result you will be unable to install your app. Opening DDMS will show that the device is not connected to your computer a it simply doesn’t appear in the device list even though the phone is in fact physically connected.

To further illustrate:

To resolve this without restarting Eclipse you can execute a BAT file that will restart the ADB server. To do this navigate to your Android installation folder and locate the “platform-tools” folder. Within that folder create an appropriately named BAT file, for example, “restart-adb.bat”. Edit the newly created file in a text editor such as Notepad and add the following two lines:

adb kill-server && adb start-server

Save and close. TO restart ADB simply double-click your bat file and the server will be restarted. A command prompt will appear informing you of what is happening:

Thats it, the ADB has been restarted.

Solving “The connection to the server was unsuccessful” Error in Android/PhoneGap

10 Apr 2012

At some point in time you will always have to update your dev environment – and inevitably when doing so you will find that you can’t compile your apps any more for any sort of a number of reasons – doesn’t matter if its iOS or Android (though I find its much, much more common on iOS). Well, today I’ve updated my Android SDK since I’d like for the first time ever to be able to use the AVD as Google has improved performance in that area. However, upon compiling one of my apps I have run into this error:

04-10 10:46:13.672: I/System.out(4057): onReceivedError: Error code=-6 Description=The connection to the server was unsuccessful. URL=file:///android_asset/www/index.html

This can be solved by adding a line to your main activity.java file:

super.setIntegerProperty("loadUrlTimeoutValue", 7000);

The timeout value itself is arbitrary, here I have it at 7 seconds. Adding this one line above the super.loadUrl resolves the “Connection to the server was unsuccessful” error.

Also, check to make sure that any remote scripts such as those being delivered to the app from a server are accessible. Sometimes I forget to remove the remote debugger from a project and find that this error will appear because the script cannot be downloaded – in that case you see the error message appear while the app loads behind it. So, check your script tags for remotely loading scripts and remove any hooks to remote debuggers/testing servers. You should also download copies of javascript libraries and keep them within your app to remove or at least reduce the chances of this error appearing.

Changing Target Android Version in Eclipse

12 Mar 2012

This one takes care of the “Attribute minSdkVersion(x) is lower that the project target API level(x)” error that you may encounter if attmpeting to change your app’s Android target version after having setup your Eclipse project for Phonegap. The error manifests itself as a build error with this the following description (which illustrates a target of 8 being below the projects API level of 10):

To change the target Android API level you need to do two things:

  1. Update the Android Manifest
  2. Update the App Target API Level

See this page for more information on Build Targets and
acceptable values: Android API Level Guide.

First go to your project folder in Eclipse. In the root you should find a file called “AndroidManifest.xml“. Double-click this file. Eclipse will either show you the UI view of the XML document, which looks like this:

Or Eclipse may show you the manifest in source view which would look like this:

In the UI view of the manifest you are looking for the “Min SDK version” filed – set that to the desired SDK version that you want to target. Save the change and then close the manifest. If you cannot locate the Min SDK Version then look under “Manifest Extras” and click on “Uses SDK” – the desired field will appear to the right under the “Attributes for Uses SDK” heading.

If you see the source-code view for the manifest then look for this line:



… and simply change the number (“8” in the above example) to whichever target API Level that you’re going for.

Next, you need to change the Project Build Target. To do so you will locate the root of your project within the Project Explorer (this appears as a directory tree structure), right click the app project root and select “Properties“. You will see the properties panel which looks like this:

At this point simply select the proper build target, apply and close.


All content © 2012-2017.