android-studio,无法解析符号SQLiteOpenHelper,Context

时间:2016-03-19 04:02:45

标签: android sqlite greendao

我通过greenDAO greenDAO

创建了一个Android项目依赖项

用greeenDAO创建一个模块greendao-lib,但它不起作用。看: enter image description here

这是build.gradle

apply plugin: 'java'
//apply plugin: 'com.android.library'
//apply plugin: 'com.android.application'


dependencies {
    compile fileTree(dir: 'libs', include: ['*.jar'])
    // android core
    //compile 'com.android.support:appcompat-v7:23.2.0'
    //classpath 'com.android.tools.build:gradle:1.3.1'
    // green dao lib
    compile 'de.greenrobot:greendao:2.1.0'
    compile 'de.greenrobot:greendao-generator:2.1.0'
    // javax annotation
    compile 'org.glassfish:javax.annotation:10.0-b28'
    // lombok
    compile 'org.projectlombok:lombok:1.16.2'
    // guava
    compile 'com.google.guava:guava:18.0'
}

如何处理这个问题?

2 个答案:

答案 0 :(得分:2)

请检查您的导入部分,它应如下所示。

import android.content.Context;
import android.database.Cursor;
import android.database.SQLException;
import android.database.sqlite.SQLiteDatabase;
import android.database.sqlite.SQLiteOpenHelper;

答案 1 :(得分:0)

//apply plugin: 'java'
apply plugin: 'com.android.library'