ActiveAndroid問題no such table解決總結

來源:互聯網
上載者:User

標籤:

 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" />

ActiveAndroid問題no such table解決總結

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.