XxGoliathusxX
XxGoliathusxX

Reputation: 982

Android 3rd Party Integration

Hi i tried to implement a 3rd party library from github. this is kinda crazy. I already worked often with 3rd party libarys. All I had to do was adding the compile command in the build gradle but in this case its something different. This is the github link of the lib i want to implement:

Link to github

The problem is i dont have access to all components of this library. Only to the files in com.h6ah4i.android.widget.advrecyclerview:advrecyclerview:0.8.0:sources@jar

But in the class ExpandableExampleActivity i have to import:

import com.h6ah4i.android.example.advrecyclerview.R;
import com.h6ah4i.android.example.advrecyclerview.common.data.AbstractExpandableDataProvider;
import com.h6ah4i.android.example.advrecyclerview.common.fragment.ExampleExpandableDataProviderFragment;

But i cant. I can see the files in the directory on github!!!

Can somebody help me how to integrate this the best way. Thx

buildscript {
    repositories {
        maven { url 'https://raw.github.com/xujiaao/mvn-repository/master/releases' }
    }

    dependencies {
        classpath 'com.github.xujiaao:aarLinkSources:1.0.0'
    }
}

apply plugin: 'com.android.application'
apply plugin: 'aar-link-sources'

android {
    compileSdkVersion 23
    buildToolsVersion "23.0.0 rc3"

    defaultConfig {
        applicationId "android.oli.com.fitnessapp"
        minSdkVersion 16
        targetSdkVersion 21
        versionCode 1
        versionName "1.0"
    }
    buildTypes {
        release {
            minifyEnabled false
            proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
        }
    }
}

dependencies {
    compile fileTree(include: ['*.jar'], dir: 'libs')
    compile 'com.android.support:appcompat-v7:23.0.1'
    compile 'com.android.support:design:23.0.1'
    compile 'com.android.support:recyclerview-v7:23.0.1'
    compile 'com.android.support:cardview-v7:23.0.1'
    compile 'com.github.sundeepk:compact-calendar-view:1.7.8'

    compile ('com.h6ah4i.android.widget.advrecyclerview:advrecyclerview:0.8.0@aar'){
        transitive=true
    }
    aarLinkSources 'com.h6ah4i.android.widget.advrecyclerview:advrecyclerview:0.8.0:sources@jar'
}

Upvotes: 1

Views: 273

Answers (1)

varunkr
varunkr

Reputation: 5542

As far as I see if you just need to import the three files,

import com.h6ah4i.android.example.advrecyclerview.R;
import com.h6ah4i.android.example.advrecyclerview.common.data.AbstractExpandableDataProvider;
import com.h6ah4i.android.example.advrecyclerview.common.fragment.ExampleExpandableDataProviderFragment;

Then just copy the last two files from the github project into your own. The R file would automatically be generated upon building the project. I don't see that the two files depend on other files, so it should work.

Upvotes: 1

Related Questions