• ActiveAndroid问题no such table解决总结


     android.database.sqlite.SQLiteException: no such table
     at android.database.sqlite.SQLiteConnection.nativePrepareStatement(Native Method)
                at android.database.sqlite.SQLiteConnection.acquirePreparedStatement(SQLiteConnection.java:889)
                at android.database.sqlite.SQLiteConnection.prepare(SQLiteConnection.java:500)
                at android.database.sqlite.SQLiteSession.prepare(SQLiteSession.java:588)
                at android.database.sqlite.SQLiteProgram.<init>(SQLiteProgram.java:58)
                at android.database.sqlite.SQLiteQuery.<init>(SQLiteQuery.java:37)
                at android.database.sqlite.SQLiteDirectCursorDriver.query(SQLiteDirectCursorDriver.java:44)
                at android.database.sqlite.SQLiteDatabase.rawQueryWithFactory(SQLiteDatabase.java:1314)
                at android.database.sqlite.SQLiteDatabase.rawQuery(SQLiteDatabase.java:1253)
                at com.activeandroid.Model.rawQuery(Model.java:349)

    1.模拟器问题,改成真机调试不会有问题

    2.<meta-data android:name="AA_DB_NAME" android:value="name.db"/>"name.db"的命名不能为你的包名,比如包名为com.sometest.app,不能命名sometest.db

    3.


    <meta-data
    android:name="AA_MODELS"
    android:value="com.item.android.models.MyModel"/>

     添加model到mainfest.xml

    https://github.com/pardom/ActiveAndroid/wiki/Creating-your-database-model

    Speeding up application startup

    ActiveAndroid will look through all your files to find your Model classes. This process can be very slow if you have a lot of dependencies. To speed up this process, specify your Model classes explicitely in your AndroidManifest:

    <meta-data     android:name="AA_MODELS"     android:value="com.myapp.model.Item, com.myapp.model.Category" />
  • 相关阅读:
    想开始学习易语言
    又是一天过去了
    希望疫情早点过去
    你们都是在哪里找买软件框架的
    Leetcode 538. 把二叉搜索树转换为累加树
    Leetcode 543. 二叉树的直径 树的遍历
    Leetcode 347. 前 K 个高频元素
    Leetcode 337. 打家劫舍 III
    工作小记:企业微信 嵌H5页面 用户权限获取匹配
    (十一)React Ant Design Pro + .Net5 WebApi:后端环境搭建IdentityServer4(三)持久化
  • 原文地址:https://www.cnblogs.com/jackyshan/p/4520944.html
Copyright © 2020-2023  润新知