Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Using with AndroidX #66

Open
bhapps opened this issue Jul 7, 2019 · 3 comments
Open

Using with AndroidX #66

bhapps opened this issue Jul 7, 2019 · 3 comments

Comments

@bhapps
Copy link

bhapps commented Jul 7, 2019

ReActiveAndroid Version:
Latest

Bug or Feature Request:
Bug

Description:
Issue with ReActiveAndroid compatibility with AndroidX or SDK Version

AndroidX
compileSdkVersion 28
minSdkVersion 21
targetSdkVersion 28

implementation 'androidx.appcompat:appcompat:1.0.2'
implementation 'com.google.android.material:material:1.0.0'
implementation 'androidx.constraintlayout:constraintlayout:1.1.3'
implementation 'androidx.vectordrawable:vectordrawable:1.0.1'
implementation 'androidx.legacy:legacy-support-v4:1.0.0'
implementation 'androidx.recyclerview:recyclerview:1.0.0'

error when save()
error when select()

Attempt to invoke interface method 'java.lang.Object java.util.Map.get(java.lang.Object)' on a null object reference

at com.reactiveandroid.ReActiveAndroid.getDatabaseForTable(ReActiveAndroid.java:118)
        at com.reactiveandroid.ReActiveAndroid.getTableName(ReActiveAndroid.java:186)
        at com.reactiveandroid.query.Select$From.getPartSql(Select.java:181)
        at com.reactiveandroid.query.QueryBase.getSql(QueryBase.java:19)
        at com.reactiveandroid.query.AggregateQueryBase.getAggregateFunctionSql(AggregateQueryBase.java:112)
        at com.reactiveandroid.query.AggregateQueryBase.count(AggregateQueryBase.java:21)
@bhapps
Copy link
Author

bhapps commented Jul 10, 2019

Tested with the below;

compileSdkVersion 28
    defaultConfig {
        applicationId "com.myapp.myapplication"
        minSdkVersion 21
        targetSdkVersion 28
        versionCode 1
        versionName "1.0"
        testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
    }

classpath 'com.android.tools.build:gradle:3.4.1'

get the below error ...

Caused by: java.lang.NullPointerException: Attempt to invoke interface method 'java.lang.Object java.util.Map.get(java.lang.Object)' on a null object reference
        at com.reactiveandroid.ReActiveAndroid.getDatabaseForTable(ReActiveAndroid.java:118)
        at com.reactiveandroid.ReActiveAndroid.getModelAdapter(ReActiveAndroid.java:149)
        at com.reactiveandroid.Model.getModelAdapter(Model.java:187)
        at com.reactiveandroid.Model.getModelAdapter(Model.java:71)
        at com.reactiveandroid.Model.save(Model.java:39)
        at com.myapp.myapplication.ORMModel.save(ORMModel.java:273)

@bhapps
Copy link
Author

bhapps commented Jul 10, 2019

I think the issue is related to the android.support Library:

import android.support.annotation.NonNull;
import android.support.annotation.Nullable;

As this Library has not been Migrated to AndroidX which uses:

implementation 'androidx.annotation:annotation:1.1.0'

as apposed to the Library using currently

compile 'com.android.support:support-annotations:25.3.1"

@bhapps
Copy link
Author

bhapps commented Jul 10, 2019

@ImangazalievM

I have pushed commit to Forked version to be compatible with AndroidX and tested.
Please see bhapps@dba3022

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant