编辑:
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所遇到的程序开发问题。
如果觉得内存溢出网站内容还不错,欢迎将内存溢出网站推荐给程序员好友。
欢迎分享,转载请注明来源:内存溢出
评论列表(0条)