无法从已编译的github库导入类

时间:2018-03-17 13:00:35

标签: java android android-studio github

我已经包括:

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

在我的应用级gradle文件中。我已同步项目并显示在我的应用依赖项中:dependencies

但它不允许我从该库中导入该类:

can't import

我不确定我做错了什么。以前从未使用过github。

这是项目gradle文件代码:

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
}

app gradle代码:

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'
}

我会非常感谢任何建议。

1 个答案:

答案 0 :(得分:1)

编辑您的代码:

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

您可以添加此行代码顶部:

import com.ajts.androidmads.library.SQLiteToExcel;