Showing posts with label Eclipse. Show all posts
Showing posts with label Eclipse. Show all posts

Friday, June 26, 2015

Android Developer Tools (ADT) in Eclipse will end at the end of the year

Google are ending development and official support for the Android Developer Tools (ADT) in Eclipse at the end of the year. This specifically includes the Eclipse ADT plugin and Android Ant build system.

source: Android Developers Blog - An update on Eclipse Android Developer Tools


Wednesday, March 25, 2015

Setting Up Google Play Services, for Eclipse-Android SDK

This video show how to set up Google Play Services on Eclipse with Android SDK, reference Google document Setting Up Google Play Services.


Include how to:
- Install Google Play services SDK using Android SDK Manager.
- Import library project google-play-services_lib.
- Add referencing to google-play-services_lib in your project.
- Modify AndroidManifest.xml, to add <meta-data android:name="com.google.android.gms.version" android:value="@integer/google_play_services_version" /> under <application>.

Also override onResume() method, to call GooglePlayServicesUtil.isGooglePlayServicesAvailable() method to test our setup.

Then finally, try something wrong, in case:
- With google-play-services_lib project closed, Errors of java.lang.NullPointerException occurred during the build.


- Without <meta-data...> in AndroidManifest.xml, no error in compiling, but fail in run time.


- Without referencing to google-play-services_lib, cannot resolve com.google


Once you've set up your project to reference the library project, you can begin developing features with the Google Play services APIs.

Monday, January 26, 2015

How to fix "Found 2 versions of android-support-v4.jar in the dependency list"

Recently after updated SDK on Android-Eclipse, tried to import my old example, and have the following error reported:

Found 2 versions of android-support-v4.jar in the dependency list,
but not all the versions are identical (check is based on SHA-1 only at this time).
...

My solution is to delete the file android-support-v4.jar in libs folder of my project.

Saturday, January 24, 2015

Install ADT (Android Developer Tools) on Eclipse

Android offers a custom plugin for the Eclipse IDE, called Android Development Tools (ADT). This plugin provides a powerful, integrated environment in which to develop Android apps. It extends the capabilities of Eclipse to let you quickly set up new Android projects, build an app UI, debug your app, and export signed (or unsigned) app packages (APKs) for distribution.

Note: Be aware that Android Studio is now the official IDE for Android, so you should migrate to Android Studio to receive all the latest IDE updates. 

You should install the ADT plugin only if you already have an Eclipse installation that you want to continue using.

~ referenec: http://developer.android.com/sdk/installing/installing-adt.html


Download Eclipse:
It's very straightforward, visit http://www.eclipse.org/downloads/, download Eclipse IDE for Java Developers (Eclipse 3.7.2 or greater), unpack the downloaded file, and move the unpacked folder to any location you want.


Install ADT (Android Developer Tools) on Eclipse:


  1. Start Eclipse, then select Help > Install New Software.
  2. Click Add, in the top-right corner.
  3. In the Add Repository dialog that appears, enter "ADT Plugin" for the Name and the following URL for the Location:
    https://dl-ssl.google.com/android/eclipse/
    Note: The Android Developer Tools update site requires a secure connection. Make sure the update site URL you enter starts with HTTPS.
  4. Click OK.
  5. In the Available Software dialog, select the checkbox next to Developer Tools and click Next.
  6. In the next window, you'll see a list of the tools to be downloaded. Click Next.
  7. Read and accept the license agreements, then click Finish.
    If you get a security warning saying that the authenticity or validity of the software can't be established, click OK.
  8. When the installation completes, restart Eclipse.
reference: http://developer.android.com/sdk/installing/installing-adt.html



Monday, September 22, 2014

Run Systrace in Android-Eclipse


The Systrace tool helps analyze the performance of your application by capturing and displaying execution times of your applications processes and other Android system processes. The tool combines data from the Android kernel such as the CPU scheduler, disk activity, and application threads to generate an HTML report that shows an overall picture of an Android device’s system processes for a given period of time.

The Systrace tool is particularly useful in diagnosing display problems where an application is slow to draw or stutters while displaying motion or animation. For more information on how to use Systrace, see Analyzing Display and Performance.


Keyboard shortcuts that are available while viewing a Systrace trace HTML report.


Tuesday, September 16, 2014

"The import android.support.v7 cannot be resolved" and "ActionBarActivity cannot be resolved to a type"

It's a common error "The import android.support.v7 cannot be resolved" on import android.support.v7.app.ActionBarActivity; and "ActionBarActivity cannot be resolved to a type" on extends ActionBarActivity. It may be various reason to cause it. One of the reason is the auto-generated project appcompat_v7 closed.

Please check the video:

Sunday, August 24, 2014

Android Eclipse tips: switch between Automatic and manual target modes

In Eclipse and ADT, you can select launching your app automatically select suitable AVD/device, or manually select.

By default, a run configuration uses the automatic target mode in order to select an AVD/device. If your run configuration uses manual mode, then the "device chooser" is presented every time that your application is run, so that you can select which AVD/device to use.
http://developer.android.com/tools/building/building-eclipse.html#RunConfig

To set Run Configuration:
  • Right click your project -> Run As -> Run Configurations...
  • or, Click the arrow (downward) beside the Play button (green arrow) on the top menu -> Run Configurations...
In Run Configuration Dialog, select your project under Android Application on the left, select Target, then select your expect Deployment Target Selection Mode.



Thursday, August 7, 2014

Android-Ecipse tips: Manually run Content Assist

Recently I re-installed Android ADT-Eclipse, but the Content Assist feature not work, even press Ctrl+Space. Content Assist can be run manually by click Edit -> Content Assist.

Sunday, May 11, 2014

"the import android.support.v7.app cannot be resolved" after updated

If you have the error of "the import android.support.v7.app cannot be resolved" after Android SDK and ADT updated in Eclipse. Try to Clean all projects, include appcompat_... libs.

Project (on Eclipse menu) -> Clean... -> select Clean all projects... then OK.


Thursday, May 8, 2014

ic_launcher cannot be resolved or is not a field

Sometimes you will face with error of "ic_launcher cannot be resolved or is not a field", one of the possible reason is import android.R incorrectly.

Note: Eclipse sometimes likes to add an import android.R statement at the top of your files that use resources, especially when you ask eclipse to sort or otherwise manage imports. This will cause your make to break. Look out for these erroneous import statements and delete them.
http://source.android.com/source/using-eclipse.html

Wednesday, August 14, 2013

Rename Package in Eclipse

To rename Package in Eclipse for Android SDK, right click your package to be rename (NOT project), select Refactor > Rename...


Enter your new name of package, make sure the check box of Update references is checked (otherwise you will get numbers of in-correct reference), and click OK to finish.


Thursday, July 11, 2013

Graphical Layout Editor of ADT

ADT provides many features to allow you to design and build your application's user interface. Many of these features are in the graphical layout editor, which you can access by opening one of your application's XML layout files in Eclipse.

Graphical Layout Editor of ADT


Know more: Android Developer Tools - Graphical Layout Editor

Sunday, January 6, 2013

Tips to add Support Library

In case you need to add Android Support Library, such as android-support-v4.jar; Google documents suggested to:
- In Eclipse Select Project > Properties, select Java Build Path, and navigate to Libraries.
- Select Add External Jars, include the following jar files, and click OK: <android-sdk-folder>/extras/android/compatibility/v4/android-support-v4.jar

But...I found that it is not always work, even always NOT work!

No error when you compile your code, but fail with error "Caused by: java.lang.NoClassDefFoundError: youractivity" at runtime.

My alternatively, Right click your project, select Android Tools > Add Support Library...

Add Support Library...


----------

Here is another solution advised by Stefan de Bruijn in comments:
- create a folder called "libs", NOT "lib".
- copy the required jar in "libs" folder.
- Update Java Build Path by selecting "Add JARs..." (NOT "Add External JARs...") to add the jar in libs.
- like this: java.lang.NoClassDefFoundError: com.google.ads.AdView.

Monday, December 17, 2012

Displaying the SHA1 certificate fingerprint

There are two type of certificate fingerprint, debug and release.

To display debug certificate fingerprint in Linus, simple open Terminal and type the command:
keytool -list -v -keystore ~/.android/debug.keystore -alias androiddebugkey -storepass android -keypass android


display debug certificate fingerprint


To display release certificate fingerprint, you need to create the release keystore and and sign the .APK once.

- Right click your project and select Android Tools -> Export Signed Application Package...


- Accept the selected project and click Next.


- Select Create new keystore, browse to select Location and enter Password, and click Next.


- Enter Alias, Password, Validity and at least one Certificate issue field, and click Next.


- Select destination APK, and click Finish.


After created the release keystore and and signed the .APK. you can display the release certificate fingerprint.

- open Terminal and type the command:
keytool -list -v -keystore <your_keystore_name> -alias <your_alias_name>

where:
<your_keystore_name> is the path and name of the keystore, including the .keystore extension.
<your_alias_name> is alias that you assigned to the certificate when you created it.



If you get error of "keytool error: java.lang.Exception: Keystore file does not exist", read HERE.

The series:
A simple example using Google Maps Android API v2, step by step.

Friday, December 14, 2012

Setup Google Play services SDK in Eclipse

The Google Play services SDK is an extension to the Android SDK and is available as a downloadable package from the SDK Manager. The download includes the client library and code samples.

To develop using the Google Play services APIs, you must download the Google Play services SDK. Google Play services is not supported on the Android emulator, a physical device runs Android 2.2 or higher must be used to run and debug apps using Google Play services SDK.

To install Google Play services SDK from Eclipse:

- Window > Android SDK Manager.

- Scroll to the bottom of the package list, select and install Extras > Google Play services.

- Accept and install.

- After installed, import the library project into your workspace. Click File > Import

- Select Android > Existing Android Code into Workspace, and browse to the copy of the library project to import it.

- click Browse to select <android-sdk-folder>/extras/google/google_play_services/libproject/google-play-services_lib, and click Finish.


The series:
A simple example using Google Maps Android API v2, step by step.