antoniolg / Kotlin-for-Android-Developers

Companion App for the book

Home Page:http://antonioleiva.com/kotlin-android-developers/

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Create SqlLite table failed when running the app

wangjinzhong opened this issue · comments

When I run the app, an error was occurred by create database table DayForecastTable. This is the error:
android.database.sqlite.SQLiteException: near "org": syntax error (code 1): , while compiling: CREATE TABLE IF NOT EXISTS DayForecast(id INTEGER PRIMARY KEY org.jetbrains.anko.db.SqlTypeModifierImpl@a5038ce, date INTEGER, description TEXT, high INTEGER, low INTEGER, iconUrl TEXT, cityId INTEGER);
Why the AUTOINCREMENT cannot be recognized. My anko version is 0.10.1

I have also encountered this problem,the follow is my version
ext.kotlin_version = '1.1.2-4'
ext.anko_version = '0.10.1'

Looks like a bug in Anko 0.10.1. If you use Anko 0.10.0, it'll work. I'm going to raise the issue in the Anko repo. Thanks for finding it! I started doing everything in 0.10.0, but updated it last minute to 0.10.1 and the table was already created, that's why I didn't find this bug.

Oh, there's an open issue already: Kotlin/anko#409

I'm updating the book with minor stuff, will revert the info there (and this repo) to 0.10.0