Color picker Example android

Here is an Example I have written  when I faced the  problems importing github project  into my android project.

all u need to do is this,

1.  download project as zip file and extract the zip.

2.  Inside Extracted folder you'll see library folder.

3.  Copy that folder into your android Applications main folder where it contains all its gradle n all... 

4.  open bulid.gradle(Module:app) inside that add dependencies like this, "compile project(':library')"

5.   update Settings.Gradle with include ':app', ':library'

6.  go to Tools>Android>Sync with Gradles and then it will show some error like build gradle not matching bla bla....

7.  In your bulid.gradle(Module:liabrary) change  "compileSdkVersion,  buildToolsVersion, minSdkVersion, targetSdkVersion, versionCode , versionName " to as same as in your bulid.gradle(Module:app) .

8.Bingooo....Its Done...!!!

In Below example I've added a color picker liabrary into myproject.
I've added some extra file(like:"android-mvn-push.gradle" ) you can skip that file in step 3
and remove "apply from: '../android-mvn-push.gradle' " from your bulid.gradle(Module:liabrary)  .


Example;I used this link for color picker zip https://github.com/yukuku/ambilwarna
steps:
1.  Go to the above link and download project as zip file and extract the zip.
2.  Inside Extracted folder you'll see library folder.
3.  Copy that folder into your android Applications main folder where it contains all its gradle n all... and also copy "android-mvn-push.gradle" file to your main project folder

4.  open bulid.gradle(Module:app) inside that add dependencies like this, 
"compile project(':library')"
5  update Settings.Gradle to include ':app', ':library'

6.  go to Tools>Android>Sync with Gradles and then it will show some error like build gradle not matching bla bla....
6.  Click on that open file error option.
7.  In your bulid.gradle(Module:liabrary) change this,

    apply plugin: 'com.android.library'

android {
    compileSdkVersion propCompileSdkVersion
    buildToolsVersion propBuildToolsVersion

    defaultConfig {
        minSdkVersion propMinSdkVersion
        targetSdkVersion propTargetSdkVersion
        versionCode propVersionCode
        versionName propVersionName
    }
    buildTypes {
        release {
            minifyEnabled false
            proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
        }
    }
}

apply from: '../android-mvn-push.gradle'

To>>>>>>>>>>>

    apply plugin: 'com.android.library'

android {
    compileSdkVersion 22
    buildToolsVersion "22.0.1"

    defaultConfig {
        minSdkVersion 14
        targetSdkVersion 22
        versionCode 1
        versionName "1.0"
    }
    buildTypes {
        release {
            minifyEnabled false
            proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
        }
    }
}
apply from: '../android-mvn-push.gradle'



Finally Tools>Android > Sync with gradle...
and 
...It Ready to Work ....!!!

Comments

Popular posts from this blog

Failed to sync Gradle project 'MyApp' Error:Unknown host 'services.gradle.org'.

Using Roboto font android

Windows 10 Slow Performance issue fixed !!!