storio | Reactive API for SQLiteDatabase and ContentResolver.

 by   pushtorefresh Java Updated: 7 months ago - v3.0.0 License: Apache-2.0

Download this library from

Build Applications

kandi X-RAY | storio REVIEW AND RATINGS

Easy ways to learn how to use StorIO -> check out Documentation, Design Tests and Sample App:. You can find all releases on Maven Central. You can override Operation Resolver per each individual Operation, it can be useful for working with SQL JOIN. To save you from coding boilerplate classes we created Annotation Processor which will generate PutResolver, GetResolver and DeleteResolver at compile time, you just need to use generated classes.

kandi-support
Support

  • storio has a highly active ecosystem.
  • It has 2600 star(s) with 187 fork(s).
  • It had no major release in the last 12 months.
  • On average issues are closed in 119 days.
  • It has a neutral sentiment in the developer community.

quality kandi
Quality

  • storio has no issues reported.

security
Security

  • storio has no vulnerabilities reported, and its dependent libraries have no vulnerabilities reported.

license
License

  • storio is licensed under the Apache-2.0 License. This license is Permissive.
  • Permissive licenses have the least restrictions, and you can use them in most projects.

build
Reuse

  • storio releases are available to install and integrate.
  • Deployable package is available in Maven.
  • Build file is available. You can build the component from source.
Top functions reviewed by kandi - BETA

kandi has reviewed storio and discovered the below as its top functions. This is intended to give you an instant insight into storio implemented functionality, and help decide if they suit your requirements.

  • On update tweet .
  • Reload user data
  • Sets the most recent Tweets .
  • Provide the Storite .
  • Subscribe people to actors and casts .
  • Performs an update .
  • Creates an anim animation for the specified view .
  • Updates the given uri .
  • Get tweets with user id .
  • Returns the number of updates .

storio Key Features

Powerful & Simple set of Operations: Put, Get, Delete

API for Humans: Type Safety, Immutability & Thread-Safety

Convenient builders with compile-time guarantees for required params. Forget about 6-7 null in queries

Optional Type-Safe Object Mapping, if you don't want to work with Cursor and ContentValues you don't have to

No reflection in Operations and no annotations in the core, also StorIO is not ORM

Full control over queries, transaction and object mapping

Every Operation over StorIO can be executed as blocking call or as io.reactivex.Flowable/io.reactivex.Single/io.reactivex.Completable/io.reactivex.Maybe

RxJava as first class citizen, but it's not required dependency!

Reactive: io.reactivex.Flowable from Get Operation will observe changes in StorIO (SQLite or ContentProvider) and receive updates automatically

StorIO is replacements for SQLiteDatabase and ContentResolver APIs

StorIO + RxJava is replacement for Loaders API

We are working on MockStorIO (similar to MockWebServer) for easy unit testing

Simple concept of just three main Operations: Put, Get, Delete -> less bugs

Almost everything is immutable and thread-safe -> less bugs

Builders for everything make code much, much more readable and obvious -> less bugs

Our builders give compile time guarantees for required parameters -> less bugs

StorIO annotated with @NonNull and @Nullable annotations -> less bugs

Open Source -> less bugs

Documentation, Sample app and Design tests -> less bugs

StorIO has unit and integration tests -> less bugs

Less bugs -> less bugs

Why we made StorIO

StorIO SQLite

StorIO ContentResolver

Design tests for StorIO SQLite

Design tests for StorIO ContentResolver

Sample App

TweetStorIOSQLitePutResolver

TweetStorIOSQLiteGetResolver

TweetStorIOSQLiteDeleteResolver

If your entities are immutable or they have builders or they use AutoValue/AutoParcel -> write your own Operation Resolvers

If you want to write your own Operation Resolver -> take a look at Default Operation resolvers, they can fit your needs

Via custom Operation Resolvers you can implement any Operation as you want -> store one object in multiple tables, use custom sql things and so on

MAJOR version changes when we make incompatible API changes.

MINOR version changes when we add functionality in a backwards-compatible manner.

PATCH version changes when we make backwards-compatible bug fixes.

CodeGenUnderStorIO allows you generate Java classes for db entities from the db schema built in some visual editor.

storio examples and code snippets

  • default
  • Android Build Tools 3.1.1 failed build finished with non-zero exit value 1
  • How to call non-observable code from rxjava chain

default

// If you need StorIO for SQLite
implementation 'com.pushtorefresh.storio3:sqlite:3.0.1'

// If you need StorIO for ContentResolver
implementation 'com.pushtorefresh.storio3:content-resolver:3.0.1'

// Notice that RxJava is optional dependency for StorIO,
// So if you need it -> please add it manually.

Android Build Tools 3.1.1 failed build finished with non-zero exit value 1

compileOptions {
    sourceCompatibility JavaVersion.VERSION_1_8
    targetCompatibility JavaVersion.VERSION_1_8
}

How to call non-observable code from rxjava chain

@Override 
public Observable<List<Assignment>> query(Specification specification) {
    return Observable.create(subscriber -> {
            final SqlSpecification sqlSpecification = (SqlSpecification) specification;

            final SQLiteDatabase database = mOpenHelper.getReadableDatabase();
            final List<Assignment> assignments = new ArrayList<>();

            try { 
                final Cursor cursor = database.rawQuery(sqlSpecification.toSqlQuery(), new String[]{});

                for (int i = 0, size = cursor.getCount(); i < size; i++) {
                    cursor.moveToPosition(i);

                    assignments.add(mToAssignmentMapper.map(cursor));
                } 

                subscriber.onNext(assignments);

                cursor.close();
            } finally { 
                database.close();
                subscriber.onCompleted(); 
            } 
    }
} 

COMMUNITY DISCUSSIONS

Top Trending Discussions on storio
  • Android crashing after trying to build a release version
  • Android Build Tools 3.1.1 failed build finished with non-zero exit value 1
  • How to call non-observable code from rxjava chain
Top Trending Discussions on storio

QUESTION

Android crashing after trying to build a release version

Asked 2018-Jul-25 at 18:13

The App works fine when I export it as as a debug version with no errors at all however it crashes at launch when I export it as a release version.

I've attached the error from the Android Monitor

10-24 03:02:02.286 17303-17303/? E/CustomizationReader: appName = Prism
10-24 03:02:02.287 17303-17303/? E/CustomizationReader: key = sku_id
10-24 03:02:02.287 17303-17303/? E/CustomizationReader: Result = 33
10-24 03:02:02.531 24402-24402/? E/dalvikvm: Could not find class 'kotlin.jvm.internal.PropertyReference1Impl', referenced from method com.earnso.mangaworld.util.RarContentProvider.<clinit>
10-24 03:02:02.549 24402-24402/? E/AndroidRuntime: FATAL EXCEPTION: main
                                                   Process: com.earnso.mangaworld, PID: 24402
                                                   java.lang.NoClassDefFoundError: kotlin.jvm.internal.PropertyReference1Impl
                                                       at com.earnso.mangaworld.util.RarContentProvider.<clinit>(RarContentProvider.kt)
                                                       at java.lang.Class.newInstanceImpl(Native Method)
                                                       at java.lang.Class.newInstance(Class.java:1215)
                                                       at android.app.ActivityThread.installProvider(ActivityThread.java:5037)
                                                       at android.app.ActivityThread.installContentProviders(ActivityThread.java:4623)
                                                       at android.app.ActivityThread.handleBindApplication(ActivityThread.java:4563)
                                                       at android.app.ActivityThread.access$1500(ActivityThread.java:151)
                                                       at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1402)
                                                       at android.os.Handler.dispatchMessage(Handler.java:110)
                                                       at android.os.Looper.loop(Looper.java:193)
                                                       at android.app.ActivityThread.main(ActivityThread.java:5333)
                                                       at java.lang.reflect.Method.invokeNative(Native Method)
                                                       at java.lang.reflect.Method.invoke(Method.java:515)
                                                       at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:828)
                                                       at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:644)
                                                       at dalvik.system.NativeStart.main(Native Method)
10-24 03:02:02.862 1130-1350/? E/cm_cmc_c: app launch:com.earnso.mangaworld
10-24 03:02:03.297 24442-24442/? E/dalvikvm: Could not find class 'android.os.LocaleList', referenced from method com.domobile.applock.aa.a
10-24 03:02:03.491 24442-24442/? E/dalvikvm: Could not find class 'android.graphics.drawable.AdaptiveIconDrawable', referenced from method com.domobile.applock.aa.r
10-24 03:02:03.769 24442-24442/? E/dalvikvm: Could not find class 'android.app.job.JobScheduler', referenced from method com.google.android.gms.internal.zzcjg.z
10-24 03:02:03.770 24442-24442/? E/dalvikvm: Could not find class 'android.app.job.JobScheduler', referenced from method com.google.android.gms.internal.zzcjg.a
10-24 03:02:04.062 1130-1350/? E/cm_cmc_c: app launch:com.htc.launcher
10-24 03:02:04.080 24442-24442/? E/dalvikvm: Could not find class 'android.app.usage.UsageStatsManager', referenced from method com.domobile.applock.service.LockService.onCreate
10-24 03:02:04.104 24442-24442/? E/eLock: startWatching
10-24 03:02:09.807 829-829/? E/StatusBar.BatteryControllerHTC: battery level = 84, plugged = true, isChargingProtection = true
10-24 03:02:12.308 739-762/? E/WindowManager: Starting window AppWindowToken{432983f0 token=Token{42f86568 ActivityRecord{42aeee78 u0 com.earnso.mangaworld/.ui.main.MainActivity t947}}} timed out
10-24 03:02:16.404 17303-17754/? E/Prism.WidgetManager: The same lists. No need to update. skip it.
10-24 03:02:19.775 829-829/? E/StatusBar.BatteryControllerHTC: battery level = 84, plugged = true, isChargingProtection = true
10-24 03:02:29.814 829-829/? E/StatusBar.BatteryControllerHTC: battery level = 84, plugged = true, isChargingProtection = true
10-24 03:02:31.433 1130-24563/? E/NativeCrypto: ssl=0x63b441f8 cert_verify_callback x509_store_ctx=0x68dd2940 arg=0x0
10-24 03:02:31.438 1130-24563/? E/NativeCrypto: ssl=0x63b441f8 cert_verify_callback calling verifyCertificateChain authMethod=ECDHE_RSA
10-24 03:02:39.811 829-829/? E/StatusBar.BatteryControllerHTC: battery level = 85, plugged = true, isChargingProtection = true
10-24 03:02:42.729 31423-31423/? E/SS3StatQuery: ScreenSaver3Activity changeScreenStat false
10-24 03:02:47.732 17303-18963/? E/Prism.MastheadStatePro_: uri: content://com.htc.launcher.masthead_state/visibility
10-24 03:02:47.741 17303-24059/? E/Prism.MastheadStatePro_: uri: content://com.htc.launcher.masthead_state/visibility
10-24 03:02:47.965 739-1035/? E/RemoteViews: ANR Warning,RemoteViews can only be used once ,if not ,it may cause ANR in hosts such as Laucher,SystemUI. keys for search <ANR Exception MSG   History>
10-24 03:02:48.218 17303-24721/? E/Prism.MastheadStatePro_: uri: content://com.htc.launcher.masthead_state/panelstatus?notify=false
10-24 03:02:49.782 829-829/? E/StatusBar.BatteryControllerHTC: battery level = 85, plugged = true, isChargingProtection = true
10-24 03:02:59.810 829-829/? E/StatusBar.BatteryControllerHTC: battery level = 85, plugged = true, isChargingProtection = true

This is the app level gradle file.

import java.text.SimpleDateFormat

apply plugin: 'com.android.application'
apply plugin: 'kotlin-android'
apply plugin: 'kotlin-android-extensions'
apply plugin: 'kotlin-kapt'

if (file("custom.gradle").exists()) {
    apply from: "custom.gradle"
}

ext {
    // Git is needed in your system PATH for these commands to work.
    // If it's not installed, you can return a random value as a workaround
    getCommitCount = {
        return 'git rev-list --count HEAD'.execute().text.trim()
        // return "1"
    }

    getGitSha = {
        return 'git rev-parse --short HEAD'.execute().text.trim()
        // return "1"
    }

    getBuildTime = {
        def df = new SimpleDateFormat("yyyy-MM-dd'T'HH:mm'Z'")
        df.setTimeZone(TimeZone.getTimeZone("UTC"))
        return df.format(new Date())
    }
}

android {
    compileSdkVersion 26
    buildToolsVersion "26.0.1"
    publishNonDefault true
    dexOptions {
        // Prevent OutOfMemory with MultiDex during the build phase
        javaMaxHeapSize "4g"
    }
    defaultConfig {
        applicationId "com.earnso.mangaworld"
        minSdkVersion 16
        targetSdkVersion 26
        testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
        versionCode 26
        versionName "0.6.3"

        buildConfigField "String", "COMMIT_COUNT", "\"${getCommitCount()}\""
        buildConfigField "String", "COMMIT_SHA", "\"${getGitSha()}\""
        buildConfigField "String", "BUILD_TIME", "\"${getBuildTime()}\""
        buildConfigField "boolean", "INCLUDE_UPDATER", "false"

        vectorDrawables.useSupportLibrary = true

        ndk {
            abiFilters "armeabi-v7a", "arm64-v8a", "x86"
        }
    }
    buildTypes {
        debug {
            //versionNameSuffix "-${getCommitCount()}"
            //applicationIdSuffix ".debug"
            multiDexEnabled true
        }
        release {
            minifyEnabled false
            //shrinkResources true
            multiDexEnabled true
            //proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
        }
    }
    productFlavors {
        standard {
            buildConfigField "boolean", "INCLUDE_UPDATER", "true"
        }
        fdroid {
        }
        dev {
            minSdkVersion 16
            resConfigs "en", "xxhdpi"
        }
    }
    packagingOptions {
        exclude 'META-INF/DEPENDENCIES'
        exclude 'LICENSE.txt'
        exclude 'META-INF/LICENSE'
        exclude 'META-INF/LICENSE.txt'
        exclude 'META-INF/NOTICE'
    }
    lintOptions {
        abortOnError false
        checkReleaseBuilds false
    }
}

dependencies {

    // Modified dependencies

    // Android support library
    final support_library_version = '26.1.0'
    // ReactiveX

    // Network client

    // REST
    final retrofit_version = '2.3.0'
    compile "com.squareup.retrofit2:retrofit:$retrofit_version"
    compile "com.squareup.retrofit2:converter-gson:$retrofit_version"
    compile "com.squareup.retrofit2:adapter-rxjava:$retrofit_version"
    // JSON

    // YAML

    // JavaScript engine

    // Disk

    // HTML parser

    // Job scheduling

    // Changelog

    // Database

    // Model View Presenter
    final nucleus_version = '3.0.0'
    compile "info.android15.nucleus:nucleus:$nucleus_version"
    compile "info.android15.nucleus:nucleus-support-v7:$nucleus_version"
    // Dependency injection

    // Image library
    final glide_version = '4.2.0'
    compile "com.github.bumptech.glide:glide:$glide_version"
    compile "com.github.bumptech.glide:okhttp3-integration:$glide_version"
    kapt "com.github.bumptech.glide:compiler:$glide_version"
    // Transformations

    // Logging

    // Crash reports

    // Sort

    // UI
    compile('com.afollestad.material-dialogs:core:0.9.4.7') {
        exclude group: "com.android.support", module: "support-v13"
    }
    // Conductor

    // RxBindings
    final rxbindings_version = '1.0.1'
    compile "com.jakewharton.rxbinding:rxbinding-kotlin:$rxbindings_version"
    compile "com.jakewharton.rxbinding:rxbinding-appcompat-v7-kotlin:$rxbindings_version"
    compile "com.jakewharton.rxbinding:rxbinding-support-v4-kotlin:$rxbindings_version"
    compile "com.jakewharton.rxbinding:rxbinding-recyclerview-v7-kotlin:$rxbindings_version"
    // Tests
    final robolectric_version = '3.1.4'
    testCompile "org.robolectric:robolectric:$robolectric_version"
    testCompile "org.robolectric:shadows-multidex:$robolectric_version"
    testCompile "org.robolectric:shadows-play-services:$robolectric_version"
    compile "org.jetbrains.kotlin:kotlin-stdlib:$kotlin_version"
    final coroutines_version = '0.19.1'
    compile 'com.github.inorichi:subsampling-scale-image-view:01e5385'
    compile 'com.github.inorichi:tachimage:68cd311'
    compile 'com.github.inorichi:junrar-android:634c1f5'
    compile 'com.android.support:multidex:1.0.1'
    compile 'io.reactivex:rxandroid:1.2.1'
    compile 'io.reactivex:rxjava:1.3.2'
    compile 'com.jakewharton.rxrelay:rxrelay:1.2.0'
    compile 'com.f2prateek.rx.preferences:rx-preferences:1.0.2'
    compile 'com.github.pwittchen:reactivenetwork:0.7.0'
    compile 'com.squareup.okhttp3:okhttp:3.9.0'
    compile 'com.squareup.okio:okio:1.13.0'
    compile 'com.google.code.gson:gson:2.8.2'
    compile 'com.github.salomonbrys.kotson:kotson:2.5.0'
    compile 'com.github.bmoliveira:snake-yaml:v1.18-android'
    compile 'com.squareup.duktape:duktape-android:1.2.0'
    compile 'com.jakewharton:disklrucache:2.0.2'
    compile 'com.github.seven332:unifile:1.0.0'
    compile 'org.jsoup:jsoup:1.10.2'
    compile 'com.evernote:android-job:1.1.11'
    compile 'com.google.android.gms:play-services-gcm:11.0.4'
    compile 'com.github.gabrielemariotti.changeloglib:changelog:2.1.0'
    compile 'com.pushtorefresh.storio:sqlite:1.13.0'
    compile 'uy.kohesive.injekt:injekt-core:1.16.1'
    compile 'jp.wasabeef:glide-transformations:3.0.1'
    compile 'com.jakewharton.timber:timber:4.5.1'
    compile 'ch.acra:acra:4.9.2'
    compile 'com.github.gpanther:java-nat-sort:natural-comparator-1.1'
    compile 'com.dmitrymalkovich.android:material-design-dimens:1.4'
    compile 'com.github.dmytrodanylyk.android-process-button:library:1.0.4'
    compile 'eu.davidea:flexible-adapter:5.0.0-rc1'
    compile 'com.nononsenseapps:filepicker:2.5.2'
    compile 'com.github.amulyakhare:TextDrawable:558677e'
    compile 'me.zhanghai.android.systemuihelper:library:1.0.0'
    compile 'com.nightlynexus.viewstatepageradapter:viewstatepageradapter:1.0.4'
    compile 'com.github.mthli:Slice:v1.2'
    compile 'com.bluelinelabs:conductor:2.1.4'
    compile 'com.github.inorichi:conductor-support-preference:26.0.2'
    compile 'com.google.android.gms:play-services-ads:11.0.4'
    testCompile 'junit:junit:4.12'
    testCompile 'org.assertj:assertj-core:1.7.1'
    testCompile 'org.mockito:mockito-core:1.10.19'
    compile "com.android.support:support-v4:$support_library_version"
    compile "com.android.support:appcompat-v7:$support_library_version"
    compile "com.android.support:cardview-v7:$support_library_version"
    compile "com.android.support:design:$support_library_version"
    compile "com.android.support:recyclerview-v7:$support_library_version"
    compile "com.android.support:preference-v7:$support_library_version"
    compile "com.android.support:support-annotations:$support_library_version"
    compile "com.android.support:customtabs:$support_library_version"
    compile 'com.android.support.constraint:constraint-layout:1.0.2'
    compile "org.jetbrains.kotlinx:kotlinx-coroutines-core:$coroutines_version"
    compile "org.jetbrains.kotlinx:kotlinx-coroutines-android:$coroutines_version"
    compile 'com.google.android.gms:play-services-ads:11.0.4'
}

buildscript {
    ext.kotlin_version = '1.1.51'
    repositories {
        mavenCentral()
    }
    dependencies {
        classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
    }
}

repositories {
    mavenCentral()
}

kotlin {
    experimental {
        coroutines 'enable'
    }
}

// add support for placeholders in resource files
//https://code.google.com/p/android/issues/detail?id=69224
def replacePlaceholdersInFile(basePath, fileName, placeholders) {
    def file = new File(basePath, fileName);

    if (!file.exists()) {
        logger.quiet("Unable to replace placeholders in " + file.toString() + ". File cannot be found.")
        return;
    }

    logger.debug("Replacing placeholders in " + file.toString())
    logger.debug("Placeholders: " + placeholders.toString())

    def content = file.getText('UTF-8')

    placeholders.each { entry ->
        content = content.replaceAll("\\\$\\{${entry.key}\\}", entry.value)
    }

    file.write(content, 'UTF-8')
}

afterEvaluate {
    android.applicationVariants.all { variant ->
        variant.outputs.each { output ->
            output.processResources.doFirst {
                // prepare placeholder map from manifestPlaceholders including applicationId placeholder
                def placeholders = variant.mergedFlavor.manifestPlaceholders + [applicationId: variant.applicationId]

                replacePlaceholdersInFile(resDir, 'xml-v25/shortcuts.xml', placeholders)
            }
        }
    }
}

Building on the debug version works completely fine but as soon as I transfer it to release version it starts crashing.

ANSWER

Answered 2017-Oct-25 at 00:47

Close Android Studio Completely. Clean and Rebuild the Project.

Source https://stackoverflow.com/questions/46898911

QUESTION

Android Build Tools 3.1.1 failed build finished with non-zero exit value 1

Asked 2018-Apr-10 at 16:22

When I updated Android Studio to 3.1.1 version I got finished with non-zero exit value 1 error. I found out that it problem with com.android.tools.build:gradle because when I switch back to 3.0.1 build finished successfully.

app build.gradle

plugins {
    id "io.github.rockerhieu.versionberg" version "1.0.0"
}

apply plugin: 'com.android.application'
apply plugin: 'kotlin-android'
apply plugin: 'kotlin-kapt'
apply plugin: 'io.fabric'
apply plugin: 'com.google.firebase.firebase-perf'
apply plugin: 'com.github.triplet.play'

versionberg {
    major 1
    minor 0
    nameTemplate '${major}.${minor}.0'
}

android {
    compileSdkVersion rootProject.ext.compileSdkVersion
    buildToolsVersion rootProject.ext.buildToolsVersion
    //noinspection GroovyMissingReturnStatement
    defaultConfig {
        applicationId "com.app.appid"

        minSdkVersion rootProject.ext.minSdkVersion
        targetSdkVersion rootProject.ext.targetSdkVersion

        multiDexEnabled true

        versionCode versionberg.code
        versionName "1.0.0"

        testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"

        renderscriptTargetApi 25
        renderscriptSupportModeEnabled false

    }

    compileOptions {
        sourceCompatibility JavaVersion.VERSION_1_8
        targetCompatibility JavaVersion.VERSION_1_8
    }

    lintOptions {
        abortOnError false
    }

    kapt {
        generateStubs = true
        mapDiagnosticLocations = true
    }

    dataBinding {
        enabled = true
    }

    buildTypes {
        debug {
            ext.enableCrashlytics = false
            ext.betaDistributionNotifications = false

            applicationIdSuffix ".debug"

        }

        qa {
            ext.betaDistributionNotifications = false

            applicationIdSuffix ".qa"

            signingConfig signingConfigs.qa

        }

        release {
            ext.betaDistributionNotifications = false

            minifyEnabled false
            signingConfig signingConfigs.release
            proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'

        }

        android.applicationVariants.all { variant ->
            variant.outputs.all {
                outputFileName = "${getAppName()}_${defaultConfig.versionName}-${defaultConfig.versionCode}(${variant.buildType.name}).apk"
            }
        }

    }

    packagingOptions {
        exclude 'META-INF/LICENSE.txt'
        exclude 'META-INF/NOTICE.txt'
        exclude 'META-INF/rxjava.properties'
        exclude 'org/joda/time/format/*.properties'
    }
}

def getAppName() {
    def stringsFile = android.sourceSets.main.res.sourceFiles.find { it.name.equals 'strings.xml' }
    return new XmlParser().parse(stringsFile).string.find { it.@name.equals 'app_name' }.text()
}

configurations {
    all*.exclude group: 'commons-logging', module: 'commons-logging'
}

dependencies {
    implementation fileTree(include: ['*.jar'], dir: 'libs')
    androidTestImplementation('com.android.support.test.espresso:espresso-core:2.2.2', {
        exclude group: 'com.android.support', module: 'support-annotations'
    })
    testImplementation "junit:junit:$rootProject.junitLibraryVersion"
    testImplementation "org.mockito:mockito-core:$rootProject.mockitoCoreLobraryVersion"
    testImplementation "org.robolectric:robolectric:$rootProject.robolectricLibraryVersion"

    implementation "com.android.support:appcompat-v7:$rootProject.supportLibraryVersion"
    implementation "com.android.support:cardview-v7:$rootProject.supportLibraryVersion"
    implementation "com.android.support:recyclerview-v7:$rootProject.supportLibraryVersion"
    implementation "com.android.support:design:$rootProject.supportLibraryVersion"
    implementation "com.android.support:palette-v7:$rootProject.supportLibraryVersion"
    implementation "com.android.support.constraint:constraint-layout:" +
            "$rootProject.constraintLayoutLibraryVersion"

    implementation "android.arch.lifecycle:extensions:1.1.1"

    implementation "com.google.firebase:firebase-core:$rootProject.firebaseLibraryVersion"
    implementation "com.google.firebase:firebase-database:$rootProject.firebaseLibraryVersion"
    implementation "com.google.firebase:firebase-storage:$rootProject.firebaseLibraryVersion"
    implementation "com.google.firebase:firebase-messaging:$rootProject.firebaseLibraryVersion"
    implementation "com.google.firebase:firebase-perf:$rootProject.firebaseLibraryVersion"

    implementation "com.firebaseui:firebase-ui-database:$rootProject.firebaseUiLibraryVersion"
    implementation "com.firebaseui:firebase-ui-storage:$rootProject.firebaseUiLibraryVersion"

    implementation 'com.firebase:firebase-jobdispatcher:0.8.2'

    implementation "com.google.android.gms:play-services-maps:$rootProject.playServicesLibraryVersion"
    implementation "com.google.android.gms:play-services-location:$rootProject.playServicesLibraryVersion"

    implementation "com.google.android:flexbox:$rootProject.flexboxLibraryVersion"
    implementation 'com.github.lsjwzh.RecyclerViewPager:lib:v1.1.2'
    kapt "com.android.databinding:compiler:$android_tools_version"

    implementation "com.google.android:flexbox:$rootProject.flexboxLibraryVersion"
    implementation 'com.github.lsjwzh.RecyclerViewPager:lib:v1.1.2'

    implementation "com.github.bumptech.glide:glide:$rootProject.glideLibraryVersion"
    kapt "com.github.bumptech.glide:compiler:$rootProject.glideLibraryVersion"
    implementation "com.github.bumptech.glide:okhttp3-integration:" +
            "$rootProject.glideLibraryVersion"

    implementation('jp.wasabeef:glide-transformations:3.0.1') {
        exclude group: 'com.github.bumptech.glide', module: 'glide'
    }

    implementation "com.squareup.retrofit2:retrofit:$rootProject.retrofitLibraryVersion"
    implementation "com.squareup.retrofit2:adapter-rxjava:$rootProject.retrofitLibraryVersion"
    implementation "com.squareup.retrofit2:adapter-rxjava2:$rootProject.retrofitLibraryVersion"
    implementation "com.squareup.retrofit2:converter-gson:$rootProject.retrofitLibraryVersion"
    implementation "com.squareup.okhttp3:logging-interceptor:$rootProject.okHttpLibraryVersion"

    implementation "com.google.code.gson:gson:2.8.2"

    implementation 'com.squareup.moshi:moshi:1.5.0'

    implementation 'com.jakewharton.timber:timber:4.5.1'

    implementation "com.github.akarnokd:rxjava2-interop:0.10.0"

    implementation('com.crashlytics.sdk.android:crashlytics:2.6.8@aar') {
        transitive = true
    }
    implementation('com.crashlytics.sdk.android:answers:1.3.10@aar') {
        transitive = true
    }

    compile project(':libmediapicker')
    compile project(':libhorizontalpicker')
    compile project(':librangebar')
    compile project(':libsignature')

    implementation 'nz.bradcampbell:paperparcel:2.0.1'
    implementation 'nz.bradcampbell:paperparcel-kotlin:2.0.1'
    kapt 'nz.bradcampbell:paperparcel-compiler:2.0.1'

    implementation "net.danlew:android.joda:$rootProject.jodaTimeLibraryVersion"

    implementation "com.arello-mobile:moxy:$rootProject.moxyLibraryVersion"
    implementation "com.arello-mobile:moxy-app-compat:$rootProject.moxyLibraryVersion"
    kapt "com.arello-mobile:moxy-compiler:$rootProject.moxyLibraryVersion"

    // Dagger core dependencies
    implementation "com.google.dagger:dagger:$rootProject.daggerLibraryVersion"
    kapt "com.google.dagger:dagger-compiler:$rootProject.daggerLibraryVersion"
    implementation "com.google.dagger:dagger-android:$rootProject.daggerLibraryVersion"
    implementation "com.google.dagger:dagger-android-support:$rootProject.daggerLibraryVersion"
    kapt "com.google.dagger:dagger-android-processor:$rootProject.daggerLibraryVersion"

    compileOnly 'org.glassfish:javax.annotation:10.0-b28'

    implementation "io.reactivex:rxjava:$rootProject.rxJavaLibraryVersion"
    implementation "io.reactivex:rxandroid:$rootProject.rxAndroidLibraryVersion"

    implementation "io.reactivex.rxjava2:rxkotlin:$rootProject.rxKotlinLibraryVersion"
    implementation "io.reactivex.rxjava2:rxandroid:$rootProject.rxAndroidV2LibraryVersion"

    implementation "com.github.VictorAlbertos:RxActivityResult:$rootProject.rxActivityResult2LibraryVersion"
    implementation "com.tbruyelle.rxpermissions2:rxpermissions:$rootProject.rxPermissionsLibraryVersion"
    implementation "com.github.miguelbcr:RxPaparazzo:$rootProject.rxPaparazzoLibraryVersion"

    implementation "com.f2prateek.rx.preferences:rx-preferences:$rootProject.rxPreferencesLibraryVersion"
    implementation "com.f2prateek.rx.preferences2:rx-preferences:$rootProject.rxPreferences2LibraryVersion"

    implementation "com.jakewharton.rxbinding:rxbinding-appcompat-v7:$rootProject.rxBindingLibraryVersion"
    implementation "com.jakewharton.rxbinding:rxbinding-support-v4:$rootProject.rxBindingLibraryVersion"

    implementation "com.pushtorefresh.storio:sqlite:$rootProject.storioLibraryVersion"
    implementation "com.pushtorefresh.storio:sqlite-annotations:$rootProject.storioLibraryVersion"
    kapt "com.pushtorefresh.storio:sqlite-annotations-processor:$rootProject.storioLibraryVersion"

    implementation "im.ene.toro3:toro:3.3.0"
    implementation "im.ene.toro3:toro-ext-exoplayer:3.3.0"  // to get ExoPlayer support
    implementation 'com.thoughtbot:expandablerecyclerview:1.3'
    implementation 'com.github.chrisbanes:PhotoView:1.3.1'
    implementation 'com.github.barteksc:android-pdf-viewer:2.4.0'
    implementation 'me.grantland:autofittextview:0.2.1'

    implementation "com.jsqix.dq.indicator:monindicator:$rootProject.monIndicatorLibraryVersion"

    implementation 'ca.barrenechea.header-decor:header-decor:0.2.8'

    implementation 'org.apache.commons:commons-lang3:3.0'

    implementation 'com.github.adrielcafe:AndroidAudioRecorder:0.2.0'

    implementation 'com.tonicartos:superslim:0.4.13'

    implementation 'com.jakewharton:kotterknife:0.1.0-SNAPSHOT'

    //Development
    implementation 'com.squareup.leakcanary:leakcanary-android:1.5.4'
    implementation 'com.facebook.stetho:stetho:1.4.2'
    implementation 'com.facebook.stetho:stetho-okhttp3:1.4.2'

    debugImplementation 'com.amitshekhar.android:debug-db:1.0.1'

    // intercom
    implementation 'io.intercom.android:intercom-sdk-base:4.0.0'
    implementation 'io.intercom.android:intercom-sdk-fcm:4.0.0'

    implementation('io.fabric.sdk.android:fabric:1.3.10@aar') {
        transitive = true
    }
    implementation "org.jetbrains.kotlin:kotlin-stdlib:$kotlin_version"

    implementation "org.jetbrains.anko:anko-commons:$rootProject.anko_version"

    implementation 'com.flaviofaria:kenburnsview:1.0.7'


    implementation 'com.yayandroid:ParallaxRecyclerView:1.1'

    implementation 'pl.charmas.android:android-reactive-location:0.10@aar'

    implementation 'com.edmodo:cropper:1.0.1'

    implementation "me.zhanghai.android.materialprogressbar:library:$rootProject.materialprogressbarLibraryVersion"

    implementation 'com.kyleduo.switchbutton:library:1.4.6'

    implementation "net.danlew:android.joda:$rootProject.jodaTimeLibraryVersion"

    implementation 'com.github.aakira:expandable-layout:1.6.0@aar'
    implementation 'com.github.aakira:expandable-layout:1.6.0@aar'

    implementation 'jp.wasabeef:recyclerview-animators:2.2.7'

    implementation 'it.sephiroth.android.library.targettooltip:target-tooltip-library:1.3.15'

    // Barcode scanner library
    implementation 'me.dm7.barcodescanner:zxing:1.9.8'

    // Signature lib
    implementation 'com.github.gcacace:signature-pad:1.2.1'

    implementation 'com.github.markomilos:paginate:0.5.1'

    // View pager circular indicator
    implementation 'me.relex:circleindicator:1.2.2@aar'

    implementation 'com.airbnb.android:lottie:2.3.1'

    implementation 'com.afollestad:easyvideoplayer:0.3.0'

    implementation 'com.danikula:videocache:2.7.0'

    implementation 'jp.wasabeef:blurry:2.1.1'

    implementation 'io.supercharge:shimmerlayout:2.0.0'

    implementation('com.giphy.sdk:core:1.0.2@aar') {
        transitive = true
    }

}

apply plugin: 'com.google.gms.google-services'

root build.gradle

buildscript {

    ext.kotlin_version = '1.2.31'
    ext.android_tools_version = '3.1.1'

    repositories {
        jcenter()
        google()
        maven { url 'https://maven.fabric.io/public' }
        maven { url "https://jitpack.io" }
    }

    dependencies {
        classpath "com.android.tools.build:gradle:$android_tools_version"
        classpath 'com.google.gms:google-services:3.1.1'
        classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
        classpath 'com.google.firebase:firebase-plugins:1.1.1'
        classpath 'io.fabric.tools:gradle:1.22.1'
        classpath 'com.github.triplet.gradle:play-publisher:1.2.0'
    }
}

allprojects {
    repositories {
        jcenter()
        maven { url "https://jitpack.io" }
        maven { url "https://oss.sonatype.org/content/repositories/snapshots" }
        maven { url 'https://maven.fabric.io/public' }
        maven { url "https://dl.bintray.com/drummer-aidan/maven" }
        maven { url "https://giphy.bintray.com/giphy-sdk" }
        mavenCentral()
        google()
    }
}

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

ext {
    // Sdk and tools
    minSdkVersion = 21
    targetSdkVersion = 27
    compileSdkVersion = 27
    buildToolsVersion = '27.0.3'

    // App dependencies
    supportLibraryVersion = '27.1.0'
    constraintLayoutLibraryVersion = '1.0.2'
    playServicesLibraryVersion = '11.8.0' /* https://developers.google.com/android/guides/setup */
    firebaseLibraryVersion = playServicesLibraryVersion
    flexboxLibraryVersion = '0.3.1' /* https://github.com/google/flexbox-layout/releases */
    gsonLibraryVersion = '2.8.1' /* https://github.com/google/gson/releases */
    daggerLibraryVersion = '2.14.1' /* https://github.com/google/dagger/releases */
    retrofitLibraryVersion = '2.3.0' /* https://github.com/square/retrofit/releases */
    okHttpLibraryVersion = '3.8.0' /* https://github.com/square/okhttp/releases */
    moxyLibraryVersion = '1.5.3' /* https://github.com/Arello-Mobile/Moxy/releases */
    firebaseUiLibraryVersion = '3.1.0' /* https://github.com/firebase/FirebaseUI-Android/releases */
    lightweightStreamLibraryVersion = '1.1.4'
    monIndicatorLibraryVersion = '1.0.0'
    storioLibraryVersion = '1.13.0' /* https://github.com/pushtorefresh/storio/releases */
    storioLibraryVersion2 = '2.0.0' /* https://github.com/pushtorefresh/storio/releases */
    glideLibraryVersion = '4.3.1'
    glideOkhttp3IntegrationLibraryVersion = '1.4.0@aar'
    rxJavaLibraryVersion = '1.3.3' /* https://github.com/ReactiveX/RxJava/releases */
    rxJavaV2LibraryVersion = '2.1.6' /* https://github.com/ReactiveX/RxJava/releases */
    rxAndroidLibraryVersion = '1.2.1' /* https://github.com/ReactiveX/RxAndroid/releases */
    rxAndroidV2LibraryVersion = '2.0.1' /* https://github.com/ReactiveX/RxAndroid/releases */
    rxKotlinLibraryVersion = '2.1.0' /* https://github.com/ReactiveX/RxKotlin/releases */
    rxBindingLibraryVersion = '1.0.0'
    rxPreferencesLibraryVersion = '1.0.2'
    rxPreferences2LibraryVersion = '2.0.0-RC3'
    rxActivityResult2LibraryVersion = '0.4.5-2.x'
    /* https://github.com/VictorAlbertos/RxActivityResult/releases */
    rxPermissionsLibraryVersion = '0.9.4@aar'
    /* https://github.com/tbruyelle/RxPermissions/releases */
    rxPaparazzoLibraryVersion = '0.6.0-2.x' /* https://github.com/miguelbcr/RxPaparazzo/releases */
    materialprogressbarLibraryVersion = '1.4.1'
    jodaTimeLibraryVersion = '2.9.9'

    junitLibraryVersion = '4.12'
    mockitoCoreLobraryVersion = '1.9.5'
    robolectricLibraryVersion = '3.0'

    timberLibraryVersion = '4.5.1' /* https://github.com/JakeWharton/timber/releases */
    anko_version = '0.10.1' /* https://github.com/Kotlin/anko/releases */
}

gradle.properties

org.gradle.jvmargs=-Xmx2g -XX:MaxPermSize=512m -XX:+HeapDumpOnOutOfMemoryError -XX:+UseConcMarkSweepGC -Dfile.encoding=UTF-8
kotlin.incremental=true
org.gradle.parallel=true
org.gradle.caching=true
android.enableBuildCache=true
android.enableD8=true

I tried:

  • change jdk to open jdk 8 and oracle jdk 10 from embedded jdk.
  • remove android.enableD8=true and kapt "com.android.databinding:compiler:$android_tools_version"
  • clear/build and Invalidate Caches/Restart

nothing help :(

ANSWER

Answered 2018-Apr-10 at 16:22

I found out that the problem was, desugar java 8, when I removed

compileOptions {
    sourceCompatibility JavaVersion.VERSION_1_8
    targetCompatibility JavaVersion.VERSION_1_8
}

and converted classes with java 8 features to kotlin the project has been successfully builded.

Source https://stackoverflow.com/questions/49750307

QUESTION

How to call non-observable code from rxjava chain

Asked 2017-Jan-11 at 09:49

I've implemented a rxjava chain of calls in my presenter. What it does is it calls remote server with retrofit if there are none results returned from sqlite database.

However, everything is using rxjava except our repository which calls sqlite. When the sqlite returns a result it shows me for example 3 results with null values. It seems it doesn't work to call non observable code from rxjava chain? How can I do it without using StorIO or Brite?

Result looks like this

enter image description here

Presenter

@Override
protected void onCreate(Bundle savedState) {
    super.onCreate(savedState);

    restartableLatestCache(REQUEST_ASSIGNMENTS,
        () -> mRepository.query()
                    .subscribeOn(Schedulers.io())
                    .observeOn(mainThread()),
        (assignmentActivity, response) -> assignmentActivity.onSuccess(response),
        (assignmentActivity, throwable) -> assignmentActivity.onError(throwable)
    );
}

Repository

return mAssignmentLocalDataStore.query(new AssignmentSpecification())
            .flatMap(assignments -> assignments == null || assignments.isEmpty() ?
                    mAssignmentRemoteDataStore.query()
                        .flatMap(remoteAssignments ->
                            Observable.zip(
                                    mEntityRepository.query()
                                            .flatMap(mEntityRepository::add),
                                    mFacilityRepository.query()
                                            .flatMap(mFacilityRepository::add),
                                    mAssignmentLocalDataStore.query(new AssignmentSpecification()),
                                    (remoteEntities, remoteFacilities, assignmentsRetry) -> assignmentsRetry
                            )
                        ): Observable.just(assignments)
            );

SQLite LocalDataStore

@Override
public Observable<List<Assignment>> query(Specification specification) {
    final SqlSpecification sqlSpecification = (SqlSpecification) specification;

    final SQLiteDatabase database = mOpenHelper.getReadableDatabase();
    final List<Assignment> assignments = new ArrayList<>();

    try {
        final Cursor cursor = database.rawQuery(sqlSpecification.toSqlQuery(), new String[]{});

        for (int i = 0, size = cursor.getCount(); i < size; i++) {
            cursor.moveToPosition(i);

            assignments.add(mToAssignmentMapper.map(cursor));
        }

        cursor.close();

        return Observable.just(assignments);

    } finally {
        database.close();
    }
}

ANSWER

Answered 2017-Jan-11 at 09:49

Change query to something like following (using Observable.create). Another variation of this would be to return Observable<Assignment> and call subscriber.onNext for each record.

@Override 
public Observable<List<Assignment>> query(Specification specification) {
    return Observable.create(subscriber -> {
            final SqlSpecification sqlSpecification = (SqlSpecification) specification;

            final SQLiteDatabase database = mOpenHelper.getReadableDatabase();
            final List<Assignment> assignments = new ArrayList<>();

            try { 
                final Cursor cursor = database.rawQuery(sqlSpecification.toSqlQuery(), new String[]{});

                for (int i = 0, size = cursor.getCount(); i < size; i++) {
                    cursor.moveToPosition(i);

                    assignments.add(mToAssignmentMapper.map(cursor));
                } 

                subscriber.onNext(assignments);

                cursor.close();
            } finally { 
                database.close();
                subscriber.onCompleted(); 
            } 
    }
} 

Source https://stackoverflow.com/questions/41586919

Community Discussions, Code Snippets contain sources that include Stack Exchange Network

VULNERABILITIES

No vulnerabilities reported

INSTALL storio

You can use storio like any standard Java library. Please include the the jar files in your classpath. You can also use any IDE and you can run and debug the storio component as you would do with any other Java program. Best practice is to use a build tool that supports dependency management such as Maven or Gradle. For Maven installation, please refer maven.apache.org. For Gradle installation, please refer gradle.org .

SUPPORT

For any new features, suggestions and bugs create an issue on GitHub. If you have any questions check and ask questions on community page Stack Overflow .

Implement storio faster with kandi.

  • Use the support, quality, security, license, reuse scores and reviewed functions to confirm the fit for your project.
  • Use the, Q & A, Installation and Support guides to implement faster.

Discover Millions of Libraries and
Pre-built Use Cases on kandi