Android / Kotlin:错误:“期待顶级声明>任务:app:buildInfoGeneratorDebug”

问题描述 投票:0回答:1

我尝试编写一个类来管理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"
        }
    } 

你有什么想法?

提前致谢

android sqlite kotlin companion-object
1个回答
3
投票

我只是删除了最后一个大括号并再次写入。它的工作:)

© www.soinside.com 2019 - 2024. All rights reserved.