Import the Android SDK (Eclipse or IntelliJ)

Adding the Library in Eclipse

To add the library in Eclipse you will need:

  • Your android project created in Eclipse 
  • The Android SDK installed with google play services version 8.3+ integrated into your project.
  • The latest XtremePush library archive downloaded (get it [here])
  • android-support-v4.jar typically found in in your Android SDKs Home folder in extras/android/support/v4.

Import the XtremePush Library Project using File > Import > Android > Existing Android Code into workspace

Navigate to the folder you downloaded containing the XtremePush Library Project and click finish to import it.

After importing the library select the project in the navigator and open project properties. Go to the Android properties page and make sure Is Library is selected.

Next stay in project properties and go to the Java Build Path properties page. The XtremePush Library depends on android support v4 so it must be added. Go to the Libraries tab and add android-support-v4 using Add External Jars...

You will find android-support-v4.jar in your Android SDKs Home folder in extras/android/support/v4.

You will see android-support-v4.jar in the list of JARs and class folders on your build path after adding it. You are now finished adjusting the library properties.

XtremePush supports push notifications for Android devices via Google’s GCM (Google Cloud Messaging for Android) service. This makes Google Play Services a dependency. Google Play Services is a library project so to add Google Play Services in eclipse use File > Import > Android > Existing Android Code into workspace. You will find Google Play Services in your Android SDKs Home folder in extras/google/google_play_services/libproject/.


After you have imported google play services the final step is to make sure your project depends on both XtremePush and google play services. Go to your project properties, and go to the Android properties page and add both libraries.

 

 

Potential Issues when adding the Library in Eclipse

The android support v4 library is a common dependency of many projects. If you are missing the library or if different versions of the library in your project clash you may see NoClassDefFoundErrors when building your project.

To prevent shared dependencies from clashing make sure that they are unselected for export in the Java Build Path properties page.

The library may not build correctly if your default compiler version differs from that of the project you can set the correct compiler version in the library projects properties on the Java Compiler properties page.

 

Adding the Library in IntelliJ

To add the library in IntelliJ you will need:

  • Your android project created in IntelliJ Idea using .iml files.
  • The Android SDK installed with google play services version 8.3+ integrated into your project.
  • The latest XtremePush library archive downloaded
  • android-support-v4.jar typically found in in your Android SDKs Home folder in extras/android/support/v4.

 

 

Copy the XtremePush library archive to your projects folder and unzip. Resulting folder will contain android archive file XtremePush_lib.aar and xtremepush_lib folder.

 

 

xtremepush_lib folder has to be added to your project as a library module therefore you have to copy it to your project folder.

 

 

Open IntelliJ Idea and add xtremepush_lib folder as a library module to your project. Choose File -> Project Structure. Select in left pane item Modules, click the Add menu item "+" and select Import Module.

 

 

In popup select xtremepush_lib folder location and press OK.

Choose Create module from existing sources and click Next.

 

 

Check if IntelliJ Idea recognised xtremepush_lib as an Android folder and xtremepush_lib/src as a Java source folder and press Next.

 

 

xtremepush_lib contains six .jar files in its libs folder which should be found by IntelliJ IDE (android-async-http-1.4.9.jar, android-beacon-library-2.6.1.jar, gson-2.4.jar, httpclient-4.3.6.jar, otto-1.3.8.jar, XtremePush_lib.jar) 

Check that xtremepush library module depends on its .jar files i.e. it depends on the libs folder and then click Next.

 

 

Ensure the IDE knows that the xtremepush library module uses the Android SDK framework. And click Finish.

 

 

Now the xtremepush_lib module should be added to your project and you should be able to see it in the list of modules.

 

 

Double check that the xtremepush_lib module is designated as a library. Select Android settings of xtremepush_lib and check Library module checkbox.

 

Also ensure that the dependencies in the libs folder are exported by ticking the export box for libs.

And the xtremepush_lib module depends on android-support-v4.jar found in your Android SDKs Home folder in extras/android/support/v4. So you must ad this as an external dependency of the module. If you use this elsewhere in your project don't export it to prevent clashing support libs.

 

 

The final step in adding the library is to make your project depend on it. To do this. First go to your applications module settings. Click the add dependencies "+" select xtremepush_lib and click OK.

 

Now if you return to your applications module settings page you will see that the library has been success fully added.

 

 

You should also see Google Play Services here if you added it earlier. If not ad it now. XtremePush supports push notifications for Android devices via Google’s GCM (Google Cloud Messaging for Android) service. This makes Google Play Services a dependency. Google Play Services is a library project and you will find Google Play Services in your Android SDKs Home folder in extras/google/google_play_services/libproject/.

 

 

 

Have more questions? Submit a request

0 Comments

Article is closed for comments.