简体   繁体   中英

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: 依赖

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

无法导入

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.

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;

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM