question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Problems with datastore

See original GitHub issue

I have been trying to initialize app sync according to the Amazon guide and I get the message that the connection could be made using the following code

AWSMobileClient.getInstance()
            .initialize(applicationContext, object : Callback<UserStateDetails> {
                override fun onResult(userStateDetails: UserStateDetails) {
                    try {

                        Amplify.addPlugin(AWSApiPlugin()) // If using remote model synchronization
                        Amplify.configure(applicationContext)
                        println("ApiQuickStart " + "All set and ready to go!")
                    } catch (e: Exception) {
                        println("ApiQuickStart ERROR " + e.message)
                        println("ERRROR ApiQuickStart")
                    }

                }

                override fun onError(e: Exception) {
                    println("ApiQuickStart Initialization error. " + e)
                }
            })

ApiQuickStart All set and ready to go!

But when you try to initialize the service with datastore I get the following error message

Code

AWSMobileClient.getInstance()
            .initialize(applicationContext, object : Callback<UserStateDetails> {
                override fun onResult(userStateDetails: UserStateDetails) {
                    try {
                        val dataStorePlugin = AWSDataStorePlugin.forModels(AmplifyModelProvider.getInstance())
                        Amplify.addPlugin(dataStorePlugin)
                        Amplify.addPlugin(AWSApiPlugin()) // If using remote model synchronization
                        Amplify.configure(applicationContext)
                        println("ApiQuickStart " + "All set and ready to go!")
                    } catch (e: Exception) {
                        println("ApiQuickStart ERROR " + e.message)
                        println("ERRROR ApiQuickStart")
                    }

                }

                override fun onError(e: Exception) {
                    println("ApiQuickStart Initialization error. " + e)
                }
            })

Error

ApiQuickStart ERROR com.amplifyframework.datastore.DataStoreException: Error in initializing the SQLiteStorageAdapter

My gradles

apply plugin: 'com.android.application'

apply plugin: 'kotlin-android'

apply plugin: 'kotlin-android-extensions'

android {
    compileSdkVersion 29
    buildToolsVersion "29.0.3"
    defaultConfig {
        applicationId "com.android.example"
        minSdkVersion 15
        targetSdkVersion 29
        vectorDrawables.useSupportLibrary = true
        versionCode 1
        versionName "1.0"
        testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
        multiDexEnabled = true
        android.defaultConfig.vectorDrawables.useSupportLibrary = true
    }
    dataBinding {
        enabled = true
    }
    buildTypes {
        release {
            minifyEnabled false
            proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
        }
    }
    compileOptions {
        sourceCompatibility 1.8
        targetCompatibility 1.8
    }
    kotlinOptions {
        jvmTarget = "1.8"
    }
}

dependencies {
    implementation fileTree(dir: 'libs', include: ['*.jar'])
    implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlin_version"
    implementation 'androidx.appcompat:appcompat:1.1.0'
    implementation 'androidx.core:core-ktx:1.2.0'
    implementation 'androidx.constraintlayout:constraintlayout:1.1.3'
    implementation 'com.google.android.material:material:1.1.0'
    implementation 'androidx.legacy:legacy-support-v4:1.0.0'
    implementation 'com.amplifyframework:core:0.9.1'
    implementation 'com.amplifyframework:aws-datastore:0.9.1'
    implementation 'com.amplifyframework:aws-api:0.9.1'
    implementation 'androidx.multidex:multidex:2.0.1'
    testImplementation 'junit:junit:4.12'
    androidTestImplementation 'androidx.test.ext:junit:1.1.1'
    androidTestImplementation 'androidx.test.espresso:espresso-core:3.2.0'

    implementation "android.arch.navigation:navigation-fragment-ktx:$version_navigation"
    implementation "android.arch.navigation:navigation-ui-ktx:$version_navigation"
    implementation 'androidx.gridlayout:gridlayout:1.0.0'
    implementation 'androidx.lifecycle:lifecycle-extensions:2.2.0'

}
// Top-level build file where you can add configuration options common to all sub-projects/modules.

buildscript {

    ext{
        ext.kotlin_version = '1.3.70'
        version_navigation = '1.0.0'
    }
    repositories {
        google()
        jcenter()
        mavenCentral()

    }
    dependencies {
        classpath 'com.android.tools.build:gradle:3.6.1'
        classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
        classpath 'com.android.tools.build:gradle:3.6.1'
        //classpath 'com.amplifyframework:amplify-tools-gradle-plugin-beta:0.1.0'
        classpath 'com.amplifyframework:amplify-tools-gradle-plugin:0.2.1'
        // NOTE: Do not place your application dependencies here; they belong
        // in the individual module build.gradle files
    }
}

//apply plugin: 'com.amplifyframework.amplifytools'

allprojects {
    repositories {
        google()
        jcenter()
        
    }
}

task clean(type: Delete) {
    delete rootProject.buildDir
}

Issue Analytics

  • State:closed
  • Created 4 years ago
  • Comments:5 (2 by maintainers)

github_iconTop GitHub Comments

1reaction
Volatile-Memorycommented, Mar 26, 2020

EDIT: I found out that my schema had a field on a type with the name ‘index’ SQLite does not like this for reasons, so I changed it to something else and it works. Perhaps the amplify modelgen tool can lint for field names that will cause problems in SQLite.

Original: I am also running into this issue and its blocking me from evaluating amplify for our companies apps.

Any workarounds for this blocker at the time being?

0reactions
jamesonwilliamscommented, Apr 3, 2020

@Gerardo11011 @Computr0n @CompileConnected I believe that has been fixed in the 0.10.0 release. Please re-open if that’s not the case.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Problems with DataStore - Scripting Support - DevForum
Problems with Datastore Recently I have been trying to make a game with saved stats, but none of the scripts I try work,...
Read more >
Troubleshooting | Cloud Datastore Documentation
This page shows you how to resolve issues with Firestore in Datastore mode. Latency. The table below describes possible causes of increased latency:...
Read more >
Troubleshooting VMFS-3 datastore issues (1003964)
Verify that the datastore is not being detected as a snapshot. For more information, see VMFS Volume Can Be Erroneously Recognized as a ......
Read more >
Diagnosing problems with data store exclusive access locks
Diagnose the causes of problems with data store exclusive access locks and examine possible causes to the problems.
Read more >
Troubleshoot ArcGIS Data Store
The links take you to possible solutions to each issue. ArcGIS Data Store configuration. I receive the message Could not connect to server...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found