Android/Kotlin:错误:“期望顶级声明"任务:app:buildInfoGeneratorDebug“ [英] Android/Kotlin: Error: "Expecting a top level declaration > Task :app:buildInfoGeneratorDebug"

查看:1284
本文介绍了Android/Kotlin:错误:“期望顶级声明"任务:app:buildInfoGeneratorDebug“的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我尝试编写一个类来管理SQLite数据库,但出现错误消息期待顶级声明> Task:app:buildInfoGeneratorDebug".

I try to write a class to manage a SQLite DB, but I have the error message "Expecting a top level declaration > Task :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"
        }
    } 

你有什么主意吗?

预先感谢

推荐答案

我只是删除最后一个花括号,然后再写一次.它正在工作:)

I just delete last curly brace and write it again. It's working :)

这篇关于Android/Kotlin:错误:“期望顶级声明"任务:app:buildInfoGeneratorDebug“的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆