javaandroidandroid-studiogithub

Can't import class from compiled github library


I've included:

compile 'com.ajts.androidmads.SQLite2Excel:library:1.0.2'

in my app level gradle file. I've synced project and it shows up in my app's dependencies:dependencies

But it won't let me import the class from that library:

can't import

I'm not sure what I'm doing wrong. Never used github before.

This is project gradle file code:

buildscript {
    repositories {
        jcenter()
    }
    dependencies {
        classpath 'com.android.tools.build:gradle:3.0.1'

    }
}

allprojects {
    repositories {
        jcenter()
        mavenCentral()
        maven { url "https://maven.google.com" }


        maven { url "https://jitpack.io" }
    }

}

task clean(type: Delete) {
    delete rootProject.buildDir
}

And app gradle code:

apply plugin: 'com.android.application'

android {

    compileSdkVersion 24
    buildToolsVersion "26.0.2"
    defaultConfig {
        minSdkVersion 15
        targetSdkVersion 24
        versionCode 4
        versionName "1.004"
        testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
    }
    buildTypes {
        release {
            minifyEnabled false
            proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
            signingConfig signingConfigs.config
        }
        buildType {
        }
    }
}



dependencies {
    compile fileTree(include: ['*.jar'], dir: 'libs')
    androidTestCompile('com.android.support.test.espresso:espresso-core:2.2.2', {
        exclude group: 'com.android.support', module: 'support-annotations'
    })
    compile 'com.android.support:appcompat-v7:24.2.1'
    compile 'com.android.support:design:24.2.1'
    testCompile 'junit:junit:4.12'
    compile 'com.google.android.gms:play-services-ads:11.2.0'
    compile 'com.ajts.androidmads.SQLite2Excel:library:1.0.2'
}

I would be really greatful for any advice.


Solution

  • edit your code :

    SQLiteToExcel sqliteToExcel = new SQLiteToExcel(this, "helloworld.db");
    

    and you can add this line Top of the code :

    import com.ajts.androidmads.library.SQLiteToExcel;