Search code examples
android-studiogradlecompiler-errorssqldelightkmm

Gradle build for sqldelight Generation failed with line 17:10 - '{' expected, got ':' Android Studio version 4.1.2


I am converting a working Android Studio app to the KMM Environment. At this point I have a very simple KMM framework. Once I added SQLDelight to the common packages I started getting the following error on my build. I have checked every example I could find and can not see what is wrong. Please help if you can?

This is the error message:

Generation failed; see the generator error output for details Task :shared:generateAndroidDebugPicturesDBInterface FAILED WARN: The registry key 'psi.track.invalidation' accessed, but not loaded yet

WARN: The registry key 'psi.incremental.reparse.depth.limit' accessed, but not loaded yet

WARN: The registry key 'ide.hide.excluded.files' accessed, but not loaded yet

C:/Users/pagel/AndroidStudioProjects/DailyNasa/shared/src/commonMain/sqldelight/com/pagetyler/shared/cache/Pictures.sq line 17:10 - '{' expected, got ':' 17 :

                           **^**

Execution failed for task ':shared:generateAndroidDebugPicturesDBInterface'. Generation failed; see the generator error output for details. `

It is failing on processing the .sq files that it should be using to generate the tables and queries. When it encounters the very first ":" in the file after the first query label is specified. Here is the .sq file script. The build fails after getAllPict: that is the first query label specified.

This is the .sq File

CREATE TABLE Daily_Pictures (
    "date_loaded"       TEXT NOT NULL PRIMARY KEY,
    "copyright"         TEXT NOT NULL,
    "image_explanation" TEXT NOT NULL,
    "hd_url_string"     TEXT NOT NULL,
    "media_type"        TEXT NOT NULL,
    "service_version"   TEXT NOT NULL,
    "picture_title"     TEXT NOT NULL,
    "picture_url_string"    TEXT NOT NULL,
    "picture_file_reg"  TEXT NOT NULL,
    "picture_file_hd"   TEXT NOT NULL,
    "picture_On_DB" INTEGER AS Boolean DEFAULT NULL,
    "picture_Favorite"  INTEGER AS Boolean DEFAULT NULL,
    "storeDate" TEXT NOT NULL DEFAULT 0
);

getAllPict:
select  dp.date_loaded, dp.copyright, dp.hd_url_string, dp.image_explanation, dp.media_type, 
        dp.picture_Favorite, dp.picture_On_DB, dp.picture_file_hd, dp.picture_file_reg, 
        dp.picture_title, dp.picture_url_string, dp.service_version, dp.storeDate
  from  "Daily_Pictures" dp;}
    
insertPic:
INSERT OR REPLACE INTO Daily_Pictures(date_loaded, copyright, image_explanation, hd_url_string, 
           media_type, service_version, picture_title, picture_url_string, picture_file_reg, 
           picture_file_hd, picture_On_DB, picture_Favorite, storeDate)
    Values(?,?,?,?,?,?,?,?,?,?,?,?,?);
                            
updatePic:
INSERT OR REPLACE INTO Daily_Pictures(date_loaded, copyright, image_explanation, hd_url_string, 
          media_type, service_version, picture_title, picture_url_string, picture_file_reg, 
          picture_file_hd, picture_On_DB, picture_Favorite, storeDate)
    Values(?,?,?,?,?,?,?,?,?,?,?,?,?);
                            
getPicByKey:
    SELECT * from Daily_Pictures where date_loaded = ?;

delAllPict:
    DELETE FROM Daily_Pictures;

delPictByKey:
    DELETE FROM Daily_Pictures where date_loaded = ?;

cleanUpDB:
    delete from Daily_Pictures where storeDate < ? and (not picture_Favorite and not picture_On_DB);

cleanUpFavorites:
    delete from Daily_Pictures where storeDate < ? and (picture_Favorite);

New version up to first error. updated 2020-3-5 same results

    getAllPict:
    select  dp.date_loaded, dp.copyright, dp.hd_url_string,  dp.image_explanation, dp.media_type, dp.picture_Favorite, dp.picture_On_DB,
        dp.picture_file_hd, dp.picture_file_reg, dp.picture_title, dp.picture_url_string, dp.service_version, dp.storeDate
    from  "Daily_Pictures" dp;


Solution

  • theres a curly brace here that shouldn't be there:

    from "Daily_Pictures" dp;}