1

I am writing this post in order to help other users get through the issues i faced while integrating Notificare notification service in android project in android studio. as I have to integrate Notificare, Segment.io, Branch.io, Google places Autocomplete, In app purchase and main problem faced to me is the clashing of multiple libraries and getting of duplicate entry errors. As Notificare it self has the inappbilling library code, google analytics, play services and its own notification code. I tried the traditional way of integrating the library as provided in the notificare android studio integration the compile command in gradle file way, but that didnt work as i used to get duplicate entry for the inappbilling code which was already present in the library.

So here is the procedure.

Download the sdk folder from the notificare sdk source with sample and then rename folder from sdk to notificare and then create a gradle file in the notificare folder as it doesnt have the gradle file by following steps:

create build.gradle file manually in notificare project. and copy the following code in it:

apply plugin: 'com.android.library'

dependencies {
    compile 'com.android.support:support-v4:21.0.3'
}

android {
    compileSdkVersion 21
    buildToolsVersion "21.1.2"

    defaultConfig {
        minSdkVersion 14
        targetSdkVersion 21
    }

    sourceSets {
        main {
            manifest.srcFile 'AndroidManifest.xml'
            java.srcDirs = ['src']
            res.srcDirs = ['res']
        }
    }
}

above code is taken from this link.

then in the libs folder the notificare-push-lib.jar file rename to extn .zip extract the zip so we can remove contents clashing with other libraries. then in the com folder delete the android folder which has vendor-billing folder which will clash with your in app purchase implementation. once the folder is deleted select the contents of folder which will be like com, META-INF and re select all 3 folders and compress them to zip.

This step is very important for mac users:

as you create zip file the mac automatically creates __MACOSX folder which needs to be removed which can be done using following command in terminal:

zip -d notificare.zip __MACOSX/\*

this will remove the __MACOSX folder within the zip. Now rename the zip file to jar file with following command:

mv notificare.zip notificare.jar

copy this file and replace it in your project notificare libs folder

then in your main project app/build.gradle file add following command:

compile project(":notificare")
compile 'com.google.android.gms:play-services:8.4.0'

and also add following in main project settings.gradle file :

include ':app', ':notificare'
project(':notificare').projectDir = new File('notificare')

Clean project. Sync gradle. build the project it should run and the notificare should register your device.

Community
  • 1
  • 1

0 Answers0