Ωlo*_*stA 14 sqlite android kotlin companion-object
我尝试编写一个类来管理 SQLite 数据库,但出现错误消息“需要顶级声明 > 任务 :app:buildInfoGeneratorDebug”。
package com.xexxxwxxxxs.GMP
import android.database.sqlite.SQLiteDatabase
import android.database.sqlite.SQLiteOpenHelper
import android.content.Context
import android.content.ContentValues
class DBHandler(context: Context, name: String?, factory: SQLiteDatabase.CursorFactory?, version: Int) : SQLiteOpenHelper(context, DATABASE_NAME, factory, DATABASE_VERSION)
{
override fun onCreate(db: SQLiteDatabase)
{
}
override fun onUpgrade(db: SQLiteDatabase, oldVersion: Int, newVersion: Int)
{
}
companion object
{
private val DATABASE_VERSION = 1
private val DATABASE_NAME = "GMP.db"
}
}?
Run Code Online (Sandbox Code Playgroud)
你有什么想法?
提前致谢
Ens*_*han 39
我只是删除了最后一个大括号,然后再写一遍。它的工作:)
| 归档时间: |
|
| 查看次数: |
26042 次 |
| 最近记录: |