导入android.os.CancellationSignal无法在Android上解析ORMLite

导入android.os.CancellationSignal无法在Android上解析ORMLite,第1张

概述编辑:ORMLite版本4.48发生错误.我回滚到4.45,错误停止发生.我已经按照网站上的说明使用ORMLiteforAndroid实现了一个数据库.但是,每当我尝试写入数据库时​​,我都会遇到异常:10-2415:15:04.600:E/AndroidRuntime(12057):FATALEXCEPTION:IntentService[com.mypackage.inst

编辑:

Ormlite版本4.48发生错误.我回滚到4.45,错误停止发生.

我已经按照网站上的说明使用Ormlite for Android实现了一个数据库.但是,每当我尝试写入数据库时​​,我都会遇到异常:

10-24 15:15:04.600: E/AndroIDRuntime(12057): FATAL EXCEPTION: IntentService[com.mypackage.instagram.UpdateInstagramPhotosService]10-24 15:15:04.600: E/AndroIDRuntime(12057): java.lang.ExceptionInInitializerError10-24 15:15:04.600: E/AndroIDRuntime(12057):    at com.j256.ormlite.androID.AndroIDDatabaseConnection.compileStatement(AndroIDDatabaseConnection.java:146)10-24 15:15:04.600: E/AndroIDRuntime(12057):    at com.j256.ormlite.table.tableUtils.doStatements(tableUtils.java:460)10-24 15:15:04.600: E/AndroIDRuntime(12057):    at com.j256.ormlite.table.tableUtils.doCreatetable(tableUtils.java:443)10-24 15:15:04.600: E/AndroIDRuntime(12057):    at com.j256.ormlite.table.tableUtils.createtable(tableUtils.java:220)10-24 15:15:04.600: E/AndroIDRuntime(12057):    at com.j256.ormlite.table.tableUtils.createtable(tableUtils.java:53)10-24 15:15:04.600: E/AndroIDRuntime(12057):    at com.mypackage.database.DatabaseHelper.onCreate(DatabaseHelper.java:33)10-24 15:15:04.600: E/AndroIDRuntime(12057):    at com.j256.ormlite.androID.apptools.OrmlitesqliteOpenHelper.onCreate(OrmlitesqliteOpenHelper.java:209)10-24 15:15:04.600: E/AndroIDRuntime(12057):    at androID.database.sqlite.sqliteOpenHelper.getDatabaseLocked(sqliteOpenHelper.java:252)10-24 15:15:04.600: E/AndroIDRuntime(12057):    at androID.database.sqlite.sqliteOpenHelper.getWritableDatabase(sqliteOpenHelper.java:164)10-24 15:15:04.600: E/AndroIDRuntime(12057):    at com.j256.ormlite.androID.AndroIDConnectionSource.getReaDWriteConnection(AndroIDConnectionSource.java:66)10-24 15:15:04.600: E/AndroIDRuntime(12057):    at com.j256.ormlite.dao.BaseDaoImpl.create(BaseDaoImpl.java:306)10-24 15:15:04.600: E/AndroIDRuntime(12057):    at com.mypackage.instagram.UpdateInstagramPhotosService.performUpdate(UpdateInstagramPhotosService.java:85)10-24 15:15:04.600: E/AndroIDRuntime(12057):    at com.mypackage.PhotoUpdateService.onHandleIntent(PhotoUpdateService.java:27)10-24 15:15:04.600: E/AndroIDRuntime(12057):    at androID.app.IntentService$ServiceHandler.handleMessage(IntentService.java:65)10-24 15:15:04.600: E/AndroIDRuntime(12057):    at androID.os.Handler.dispatchMessage(Handler.java:99)10-24 15:15:04.600: E/AndroIDRuntime(12057):    at androID.os.Looper.loop(Looper.java:137)10-24 15:15:04.600: E/AndroIDRuntime(12057):    at androID.os.HandlerThread.run(HandlerThread.java:60)10-24 15:15:04.600: E/AndroIDRuntime(12057): Caused by: java.lang.ExceptionInInitializerError10-24 15:15:04.600: E/AndroIDRuntime(12057):    at com.j256.ormlite.androID.AndroIDCompiledStatement.<clinit>(AndroIDCompiledStatement.java:33)10-24 15:15:04.600: E/AndroIDRuntime(12057):    ... 17 more10-24 15:15:04.600: E/AndroIDRuntime(12057): Caused by: java.lang.Error: Unresolved compilation problems: 10-24 15:15:04.600: E/AndroIDRuntime(12057):    The import androID.os.CancellationSignal cannot be resolved10-24 15:15:04.600: E/AndroIDRuntime(12057):    CancellationSignal cannot be resolved to a type10-24 15:15:04.600: E/AndroIDRuntime(12057):    CancellationSignal cannot be resolved to a type10-24 15:15:04.600: E/AndroIDRuntime(12057):    CancellationSignal cannot be resolved to a type10-24 15:15:04.600: E/AndroIDRuntime(12057):    CancellationSignal cannot be resolved to a type10-24 15:15:04.600: E/AndroIDRuntime(12057):    CancellationSignal cannot be resolved to a type10-24 15:15:04.600: E/AndroIDRuntime(12057):    at com.j256.ormlite.androID.compat.JellyBeanAPICompatibility.<init>(JellyBeanAPICompatibility.java:5)10-24 15:15:04.600: E/AndroIDRuntime(12057):    at com.j256.ormlite.androID.compat.APICompatibilityUtils.<clinit>(APICompatibilityUtils.java:40)10-24 15:15:04.600: E/AndroIDRuntime(12057):    ... 18 more

这发生在IntentService子类中.这是该类的一些相关代码:

private DatabaseHelper databaseHelper;static {    OpenHelperManager.setopenHelperClass(DatabaseHelper.class);}public DatabaseHelper getHelper() {    if (databaseHelper == null) {        databaseHelper = OpenHelperManager.getHelper(this, DatabaseHelper.class);    }    return databaseHelper;}@OverrIDepublic voID onDestroy() {    super.onDestroy();    if (databaseHelper != null) {        OpenHelperManager.releaseHelper();        databaseHelper = null;    }}

我可以在我的代码中导入androID.os.CancellationSignal就好了.

解决方法:

这对我来说也是如此,谢谢你的帮助……当回到4.45时,问题就解决了.

总结

以上是内存溢出为你收集整理的导入android.os.CancellationSignal无法在Android上解析ORMLite全部内容,希望文章能够帮你解决导入android.os.CancellationSignal无法在Android上解析ORMLite所遇到的程序开发问题。

如果觉得内存溢出网站内容还不错,欢迎将内存溢出网站推荐给程序员好友。

欢迎分享,转载请注明来源:内存溢出

原文地址: http://outofmemory.cn/web/1119035.html

(0)
打赏 微信扫一扫 微信扫一扫 支付宝扫一扫 支付宝扫一扫
上一篇 2022-05-29
下一篇 2022-05-29

发表评论

登录后才能评论

评论列表(0条)

保存