0
    package com.mytelco.ahliang125.mytelco;

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

/**
 * Created by ahliang125 on 4/29/2015.
 */

public class DBHelper extends SQLiteOpenHelper {
    //DatabaseRecord
    public static final String DATABASE_CREATE_RECORD = "create table " +
            DatabaseRecord.DATABASE_TABLE_RECORD + " ("
            + DatabaseRecord.KEY_ID +
            " integer primary key autoincrement, " +
            DatabaseRecord.NAME + " text not null, " +
            DatabaseRecord.TITLE + " text not null, " +
            DatabaseRecord.LINK + " text not null," +
            DatabaseRecord.REMARK + " text not null, " +
            DatabaseRecord.PRIORITY + " text not null, " +
            DatabaseRecord.USERNAME + " text not null);";

    //DatabaseRecord
    public static final String DATABASE_CREATE_USER = "create table " +
            DatabaseUser.DATABASE_TABLE_USER + " ("
            + DatabaseUser.KEY_ID +
            " integer primary key autoincrement, " +
            DatabaseUser.USERNAME + " text not null, " +
            DatabaseUser.PASSWORD + " text not null);";

    //version number to upgrade database version
    //each time if you Add, Edit table, you need to change the
    //version number.
    public static final int DATABASE_VERSION = 3;

    //DatabaseRecord Table
    public static final String DATABASE_TABLE_RECORD = "myTelco_databaseRecord";

    // DatabaseRecord Name
    public static final String DATABASE_NAME_RECORD = "myTelco_databaseRecord";

    //DatabaseUser Table
    public static final String DATABASE_TABLE_USER = "myTelco_databaseUser";

    // DatabaseUser Name
    public static final String DATABASE_NAME_USER = "myTelco_databaseUser";

    //DatabaseRecord path
    public static final String DATABASE_PATH = "/data/data/com.example.ahliang125.mytelco/databases/";

    public static final String KEY_ID = "_id";
    public static final String NAME = "name";
    public static final String TITLE = "title";
    public static final String LINK = "link";
    public static final String REMARK = "remark";
    public static final String PRIORITY = "priority";
    public static final String USERNAME = "username";
    public static final String PASSWORD = "password";

    /*public DBHelper(Context context, String name, SQLiteDatabase.CursorFactory factory, int version) {
        super(context, name, factory, version);
    }*/

    @Override
    public void onCreate(SQLiteDatabase sqLiteDatabase) {

        //All necessary tables you like to create will  create here
        sqLiteDatabase.execSQL(DATABASE_CREATE_RECORD);
        sqLiteDatabase.execSQL(DATABASE_CREATE_USER);
    }

    @Override
    public void onUpgrade(SQLiteDatabase sqLiteDatabase, int i, int i2) {

        sqLiteDatabase.execSQL("DROP TABLE IF EXISTS "
                + DatabaseRecord.DATABASE_TABLE_RECORD);
        onCreate(sqLiteDatabase);
    }

    public DBHelper(Context context) {
        super(context, "myTelco_database.db", null, DATABASE_VERSION);
    }



   /* //---opens the database---
    public DBHelper open() {
        db = DBHelper.getWritableDatabase();
        return this;
    }

    //---closes the database---
    public void close() {
        DBHelper.close();
    }*/

}

This happens when i try to sign my apk to upload to the google play store. Google for few hours and tried the solutions but its still the same error. HELP!I know that there are no default constructor for sqliteopenhelper and we need to call the explicit constructor.

TSL
  • 23
  • 1
  • 5

2 Answers2

1

It's an Android Lint error that validates the classes that are declared in the manifests as entry points such as activities or services. Entry points must have a no-arg constructor.

Your DBHelper is not an entry point and should not be declared in the manifest.

Lint by default is run only on release builds or when you explicitly run it. That's why you get it when exporting a release version of your app.

laalto
  • 150,114
  • 66
  • 286
  • 303
  • It really worked ! Thanks for the help , i spent so many days on this trying to find solution – TSL Jun 29 '15 at 14:49
0

I think this happened because you don't have constructor from super class http://developer.android.com/reference/android/database/sqlite/SQLiteOpenHelper.html

Try to add SQLiteOpenHelper(Context context, String name, SQLiteDatabase.CursorFactory factory, int version) and SQLiteOpenHelper(Context context, String name, SQLiteDatabase.CursorFactory factory, int version, DatabaseErrorHandler errorHandler)

public DBHelper(Context context, String name, SQLiteDatabase.CursorFactory factory, int version) {
    super(context, name, factory, version);
}

And the same for the other constructor

sonic
  • 1,894
  • 1
  • 18
  • 22
  • Hi, do i add that code below the constructor ? So meaning i have 2 constructor for my DBHelper ? – TSL Jun 29 '15 at 14:44
  • Yes. i think you should have three constructors. The one you already have and the 2 declared in the superclass. – sonic Jun 29 '15 at 14:53