In my activity, I'm trying to use MaterialContainerTransform but it shows an error that
Required Transition found: MaterialContainerTransform
override fun onCreate(savedInstanceState: Bundle?) {
window.requestFeature(Window.FEATURE_ACTIVITY_TRANSITIONS)
setEnterSharedElementCallback(MaterialContainerTransformSharedElementCallback())
//this is giving error
window.sharedElementEnterTransition = MaterialContainerTransform().apply {
addTarget(android.R.id.content)
duration = 300L
}
window.sharedElementReturnTransition = MaterialContainerTransform().apply {
addTarget(android.R.id.content)
duration = 250L
}
My dependencies
dependencies {
implementation fileTree(dir: "libs", include: ["*.jar"])
implementation "org.jetbrains.kotlin:kotlin-stdlib:$kotlin_version"
implementation 'androidx.core:core-ktx:1.3.1'
implementation 'androidx.appcompat:appcompat:1.2.0'
implementation 'androidx.constraintlayout:constraintlayout:2.0.0-beta3'
implementation 'androidx.legacy:legacy-support-v4:1.0.0'
testImplementation 'junit:junit:4.13'
androidTestImplementation 'androidx.test.ext:junit:1.1.1'
androidTestImplementation 'androidx.test.espresso:espresso-core:3.2.0'
//material
implementation 'com.google.android.material:material:1.3.0-alpha02'
def coroutines_version = "1.3.8"
implementation "org.jetbrains.kotlinx:kotlinx-coroutines-core:$coroutines_version"
implementation "org.jetbrains.kotlinx:kotlinx-coroutines-android:$coroutines_version"
implementation 'androidx.navigation:navigation-fragment-ktx:2.3.0'
implementation 'androidx.navigation:navigation-ui-ktx:2.3.0'
implementation 'androidx.viewpager2:viewpager2:1.0.0'
}
There are two types of MaterialContainerTransform the com.google.android.material.transition.MaterialContainerTransform that uses AndroidX Transition and includes bug fixes that apply to all API levels and the com.google.android.material.transition.platform.MaterialContainerTransform class that is built on the framework Transition class.
Only the framework Transition version can be used for window transitions, so you should make sure you're importing the right version of MaterialContainerTransform:
import com.google.android.material.transition.platform.MaterialContainerTransform
Related
Hey I am updating kotlinx coroutines to latest version in android. I am getting weird issue on lint check. I updated my version to 1.5.1 to 1.6.0 in my project.
buidl.gradle(application)
ext {
kotlin_version = '1.5.21'
kotlin_serializtion_version = '1.5.21'
kotlin_coroutines_version = "1.6.0"
retrofit_version = '2.5.0'
moshiVersion = "1.12.0"
retrofit2_version = "2.5.0"
okhttp3_version = "4.9.0"
mockk_version = "1.10.4"
picassoVersion = "2.71828"
lifecycle_version = "2.4.0"
koin_version = "3.1.5"
barcode_scanner_version = "16.1.1"
camerax_version = "1.0.0"
camera_view_version = "1.0.0-alpha22"
stripe_version = "19.0.0"
jacoco_version = "0.8.7"
room_version = "2.3.0"
}
dependencies {
classpath 'com.android.tools.build:gradle:4.1.2'
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
classpath 'com.google.firebase:firebase-crashlytics-gradle:2.4.1'
classpath 'com.google.gms:google-services:4.3.3'
classpath "org.jetbrains.kotlin:kotlin-serialization:$kotlin_serializtion_version"
classpath 'com.google.firebase:firebase-appdistribution-gradle:2.2.0'
}
buidl.gradle(app)
dependencies {
implementation fileTree(dir: 'libs', include: ['*.jar'])
implementation "org.jetbrains.kotlin:kotlin-reflect:$kotlin_version"
implementation 'androidx.constraintlayout:constraintlayout:2.0.4'
implementation 'androidx.browser:browser:1.3.0'
implementation 'androidx.appcompat:appcompat:1.2.0'
implementation "androidx.fragment:fragment-ktx:1.4.0"
implementation 'com.google.android.play:core:1.10.3'
implementation 'com.google.android.material:material:1.2.1'
//Kotlin extensions library for Play Core
implementation 'com.google.android.play:core-ktx:1.8.1'
//Android Kotlin extensions
implementation "androidx.core:core-ktx:1.3.2"
//Unit test
testImplementation 'junit:junit:4.12'
testImplementation 'org.mockito:mockito-inline:3.4.0'
androidTestImplementation 'org.mockito:mockito-android:3.4.0'
implementation "org.jacoco:org.jacoco.core:$jacoco_version"
testImplementation "com.nhaarman.mockitokotlin2:mockito-kotlin:2.2.0"
testImplementation 'androidx.arch.core:core-testing:2.1.0'
testImplementation "io.mockk:mockk:${mockk_version}"
//Moshi (JSON parser)
implementation "com.squareup.moshi:moshi-kotlin:$moshiVersion"
kapt "com.squareup.moshi:moshi-kotlin-codegen:$moshiVersion"
//Retrofit2
implementation "com.squareup.retrofit2:retrofit:$retrofit2_version"
implementation "com.squareup.retrofit2:converter-moshi:$retrofit2_version"
//Paging 3
implementation "androidx.paging:paging-runtime-ktx:3.0.0-alpha07"
//Okhttp3
implementation "com.squareup.okhttp3:okhttp:$okhttp3_version"
implementation "com.squareup.okhttp3:logging-interceptor:$okhttp3_version"
//Kotlin Coroutines
implementation "org.jetbrains.kotlinx:kotlinx-coroutines-android:$kotlin_coroutines_version"
testImplementation "org.jetbrains.kotlinx:kotlinx-coroutines-test:$kotlin_coroutines_version"
//ViewModel and LiveData
implementation "androidx.lifecycle:lifecycle-viewmodel-ktx:$lifecycle_version"
implementation "androidx.lifecycle:lifecycle-livedata-ktx:$lifecycle_version"
implementation "androidx.lifecycle:lifecycle-runtime-ktx:$lifecycle_version"
//HTML parser
implementation 'org.jsoup:jsoup:1.12.1'
//Payments
implementation 'com.google.android.gms:play-services-wallet:19.1.0'
implementation "com.stripe:stripe-android:$stripe_version"
//Firebase
implementation platform('com.google.firebase:firebase-bom:27.1.0')
implementation 'com.google.firebase:firebase-analytics'
implementation 'com.google.firebase:firebase-crashlytics-ktx'
implementation 'com.google.firebase:firebase-config-ktx'
implementation "com.google.firebase:firebase-messaging"
implementation "com.google.firebase:firebase-core"
//Pager indicator
implementation 'me.relex:circleindicator:2.1.4'
//Animations
implementation 'com.airbnb.android:lottie:3.2.2'
implementation 'pl.bclogic:pulsator4droid:1.0.3'
//Loading images
implementation 'com.github.bumptech.glide:glide:4.11.0'
kapt 'com.github.bumptech.glide:compiler:4.11.0'
//View container which can wrap content
implementation 'com.google.android:flexbox:2.0.1'
//Phone Authentication
implementation 'com.google.android.gms:play-services-auth:20.0.1'
implementation 'com.google.android.gms:play-services-auth-api-phone:18.0.1'
implementation 'com.googlecode.libphonenumber:libphonenumber:8.7.0'
//Video player
implementation 'com.google.android.exoplayer:exoplayer:2.11.3'
//Dependency injection - Koin AndroidX Scope features
implementation "io.insert-koin:koin-android:$koin_version"
implementation "io.insert-koin:koin-androidx-workmanager:$koin_version"
testImplementation "io.insert-koin:koin-test-junit4:$koin_version"
testImplementation "io.insert-koin:koin-test:$koin_version"
//WorkManager
implementation "androidx.work:work-runtime-ktx:2.7.1"
// App Startup
implementation "androidx.startup:startup-runtime:1.1.0"
//Progress button extension
implementation 'com.github.razir.progressbutton:progressbutton:2.1.0'
//PDF Viewer
implementation 'com.github.barteksc:android-pdf-viewer:2.8.2'
//Amplitude
implementation 'com.amplitude:android-sdk:2.25.2'
//Salesforce chat
implementation "com.salesforce.service:chat-ui:4.2.2"
//Jumio
implementation "com.jumio.android:core:3.9.2#aar" // Jumio Core library
implementation "com.jumio.android:nv:3.9.2#aar" // Netverify library
implementation "com.jumio.android:nv-barcode:3.9.2#aar" // Barcode scanning
implementation "com.jumio.android:nv-mrz:3.9.2#aar" // MRZ scanning
//AppsFlyer
implementation 'com.appsflyer:af-android-sdk:6.2.0'
implementation 'com.android.installreferrer:installreferrer:2.2'
// Code Scanner & Camera
implementation "com.google.mlkit:barcode-scanning:$barcode_scanner_version"
implementation "androidx.camera:camera-camera2:$camerax_version"
implementation "androidx.camera:camera-lifecycle:$camerax_version"
implementation "androidx.camera:camera-view:$camera_view_version"
// Braze (marketing push notifications)
implementation "com.appboy:android-sdk-ui:14.0.0"
// Room
implementation "androidx.room:room-ktx:$room_version"
kapt "androidx.room:room-compiler:$room_version"
androidTestImplementation "androidx.room:room-testing:$room_version"
implementation "androidx.room:room-runtime:$room_version"
//Memory leak analysis - should only run in dev builds (devqaImplementation)
//devqaImplementation 'com.squareup.leakcanary:leakcanary-android:2.2'
}
Error what I am getting
Could not load custom lint check jar file /Users/vmodi/.gradle/caches/transforms-2/files-2.1/28f32124189df6c8d7d39ecfef6ee770/jetified-ui-graphics-1.0.5/jars/lint.jar
java.lang.NoClassDefFoundError: com/android/tools/lint/client/api/Vendor
at androidx.compose.ui.graphics.lint.UiGraphicsIssueRegistry.<init>(UiGraphicsIssueRegistry.kt:34)
at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:62)
at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45)
at java.lang.reflect.Constructor.newInstance(Constructor.java:423)
at java.lang.Class.newInstance(Class.java:442)
at com.android.tools.lint.client.api.JarFileIssueRegistry$Factory.loadIssueRegistry(JarFileIssueRegistry.kt:200)
at com.android.tools.lint.client.api.JarFileIssueRegistry$Factory.get(JarFileIssueRegistry.kt:152)
at com.android.tools.lint.client.api.JarFileIssueRegistry$Factory.get(JarFileIssueRegistry.kt:116)
at com.android.tools.lint.client.api.LintDriver.registerCustomDetectors(LintDriver.kt:494)
at com.android.tools.lint.client.api.LintDriver.analyze(LintDriver.kt:414)
at com.android.tools.lint.LintCliClient.run(LintCliClient.kt:256)
at com.android.tools.lint.LintCliClient.run(LintCliClient.kt:237)
at com.android.tools.lint.gradle.LintGradleClient.run(LintGradleClient.kt:255)
at com.android.tools.lint.gradle.LintGradleExecution.runLint(LintGradleExecution.kt:259)
at com.android.tools.lint.gradle.LintGradleExecution.lintSingleVariant(LintGradleExecution.kt:275)
at com.android.tools.lint.gradle.LintGradleExecution.analyze(LintGradleExecution.kt:62)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:498)
at com.android.tools.lint.gradle.api.ReflectiveLintRunner.runLint(ReflectiveLintRunner.kt:38)
at com.android.build.gradle.tasks.LintBaseTask.runLint(LintBaseTask.java:117)
at com.android.build.gradle.tasks.LintPerVariantTask.lint(LintPerVariantTask.java:67)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:498)
at org.gradle.internal.reflect.JavaMethod.invoke(JavaMethod.java:104)
at org.gradle.api.internal.project.taskfactory.StandardTaskAction.doExecute(StandardTaskAction.java:49)
at org.gradle.api.internal.project.taskfactory.StandardTaskAction.execute(StandardTaskAction.java:42)
at org.gradle.api.internal.project.taskfactory.StandardTaskAction.execute(StandardTaskAction.java:28)
at org.gradle.api.internal.AbstractTask$TaskActionWrapper.execute(AbstractTask.java:726)
at org.gradle.api.internal.AbstractTask$TaskActionWrapper.execute(AbstractTask.java:693)
at org.gradle.api.internal.tasks.execution.ExecuteActionsTaskExecuter$3.run(ExecuteActionsTaskExecuter.java:569)
at org.gradle.internal.operations.DefaultBuildOperationExecutor$RunnableBuildOperationWorker.execute(DefaultBuildOperationExecutor.java:395)
at org.gradle.internal.operations.DefaultBuildOperationExecutor$RunnableBuildOperationWorker.execute(DefaultBuildOperationExecutor.java:387)
at org.gradle.internal.operations.DefaultBuildOperationExecutor$1.execute(DefaultBuildOperationExecutor.java:157)
at org.gradle.internal.operations.DefaultBuildOperationExecutor.execute(DefaultBuildOperationExecutor.java:242)
at org.gradle.internal.operations.DefaultBuildOperationExecutor.execute(DefaultBuildOperationExecutor.java:150)
at org.gradle.internal.operations.DefaultBuildOperationExecutor.run(DefaultBuildOperationExecutor.java:84)
at org.gradle.internal.operations.DelegatingBuildOperationExecutor.run(DelegatingBuildOperationExecutor.java:31)
at org.gradle.api.internal.tasks.execution.ExecuteActionsTaskExecuter.executeAction(ExecuteActionsTaskExecuter.java:554)
at org.gradle.api.internal.tasks.execution.ExecuteActionsTaskExecuter.executeActions(ExecuteActionsTaskExecuter.java:537)
at org.gradle.api.internal.tasks.execution.ExecuteActionsTaskExecuter.access$300(ExecuteActionsTaskExecuter.java:108)
at org.gradle.api.internal.tasks.execution.ExecuteActionsTaskExecuter$TaskExecution.executeWithPreviousOutputFiles(ExecuteActionsTaskExecuter.java:278)
I have a compile-time error with the samples provided in the code-labs.
This is the ViewModel
class VM : ViewModel() {
val isVisible = MutableStateFlow(true).asStateFlow()
}
This is what I'd like to write:
#Composable
fun Whatever(vm: VM = viewModel()) {
val isVisible by vm.isVisible.collectAsState(true)
// Use is visible here
}
But it yields to the following error:
Type 'State<TypeVariable(R)>' has no method 'getValue(Nothing?, KProperty<*>)' and thus it cannot serve as a delegate
Which is really strange because I can use it like so:
#Composable
fun Whatever(vm: VM = viewModel()) {
val isVisible = vm.isVisible.collectAsState(true)
if(isVisible.value) { … }
}
What dependency do I need to bring in to make the delegate work?
Here are my dependencies: and compose_version = 1.0.0-beta01
dependencies {
// LiveData
implementation "androidx.lifecycle:lifecycle-livedata-ktx:2.3.0"
implementation 'androidx.core:core-ktx:1.3.2'
implementation 'androidx.appcompat:appcompat:1.2.0'
implementation 'com.google.android.material:material:1.3.0'
implementation "androidx.activity:activity-compose:1.3.0-alpha03"
implementation "androidx.compose.runtime:runtime:$compose_version"
implementation "androidx.compose.ui:ui:$compose_version"
implementation "androidx.compose.foundation:foundation-layout:$compose_version"
implementation "androidx.compose.material:material:$compose_version"
implementation "androidx.compose.material:material-icons-extended:$compose_version"
implementation "androidx.compose.foundation:foundation:$compose_version"
implementation "androidx.compose.animation:animation:$compose_version"
implementation "androidx.compose.ui:ui-tooling:$compose_version"
implementation "androidx.compose.runtime:runtime-livedata:$compose_version"
implementation "androidx.compose.runtime:runtime:$compose_version"
implementation "androidx.compose.ui:ui:$compose_version"
implementation "androidx.compose.ui:ui-tooling:$compose_version"
implementation 'androidx.lifecycle:lifecycle-runtime-ktx:2.3.0'
// Kotlin coroutines
implementation "org.jetbrains.kotlinx:kotlinx-coroutines-android:$coroutines_version"
implementation 'androidx.appcompat:appcompat:1.3.0-beta01'
implementation 'androidx.activity:activity-ktx:1.2.0'
implementation 'androidx.core:core-ktx:1.5.0-beta02'
implementation "androidx.activity:activity-compose:1.3.0-alpha03"
implementation "androidx.lifecycle:lifecycle-viewmodel-savedstate:2.3.0"
implementation "androidx.lifecycle:lifecycle-livedata-ktx:2.3.0"
implementation "androidx.lifecycle:lifecycle-viewmodel-compose:1.0.0-alpha02"
androidTestImplementation 'androidx.test:rules:1.3.0'
androidTestImplementation 'androidx.test:runner:1.3.0'
androidTestImplementation "androidx.compose.ui:ui-test:$compose_version"
androidTestImplementation "androidx.compose.ui:ui-test-junit4:$compose_version"
}
As described in the doc, try to add the following imports:
import androidx.compose.runtime.getValue
import androidx.compose.runtime.livedata.observeAsState
i'm creating simple library which make call to weather api, in my lib-project i use RxJava and RxAndroid and retrofit for http calls.
My WeatherService make the call and receive result as json and need to make some manipulations and return it as Single<CurrentWeather> to the client app.
In my lib-project i add to gradle all needed dependencies for rx and retrofit.
My library gradle:
ext{
rxJava = "2.1.17"
rxAndroid = "2.0.2"
support = "27.1.1"
retrofitVersion = "2.4.0"
}
dependencies {
implementation fileTree(dir: 'libs', include: ['*.jar'])
implementation "com.android.support:appcompat-v7:$support"
testImplementation 'junit:junit:4.12'
androidTestImplementation 'com.android.support.test:runner:1.0.2'
androidTestImplementation 'com.android.support.test.espresso:espresso-core:3.0.2'
implementation "com.squareup.retrofit2:retrofit:$retrofitVersion"
implementation "com.squareup.retrofit2:converter-gson:$retrofitVersion"
implementation "com.squareup.retrofit2:adapter-rxjava2:$retrofitVersion"
implementation "io.reactivex.rxjava2:rxandroid:$rxAndroid"
implementation "io.reactivex.rxjava2:rxjava:$rxJava"
}
Now in my sample app in MainActivity i wanted to test one function to see if it works as expected, but when i try call the function which return Single it show comlpile error:
error: cannot access Single
class file for io.reactivex.Single not found
lib function declaration:
public Single<Current> getCurrentWeather(double lat, double lng) {
return mClient.getWeather(lat + "," + lng).flatMap(new Function<JSONObject, SingleSource<Current>>() {
#Override
public SingleSource<Current> apply(JSONObject jsonObject) throws Exception {
//parse jsonObject and return as Single<Current>
return Single.create(new SingleOnSubscribe<Current>() {
#Override
public void subscribe(SingleEmitter<Current> emitter) throws Exception {
Current current = new Current();
emitter.onSuccess(current);
}
});
}
});
}
Client app MainActivity: Here i have the compile error.
WeatherService.getIsnstance().getCurrentWeather(32.5554, 35.545)
Client app gradle:
dependencies {
implementation fileTree(dir: 'libs', include: ['*.jar'])
implementation 'com.android.support:appcompat-v7:27.1.1'
implementation 'com.android.support.constraint:constraint-layout:1.1.3'
testImplementation 'junit:junit:4.12'
androidTestImplementation 'com.android.support.test:runner:1.0.2'
androidTestImplementation 'com.android.support.test.espresso:espresso-core:3.0.2'
implementation project(":weatherlib")
}
Client app settings.gradle:
include ':app', ':weatherlib'
Do i miss something here ?
Do this means that everyone who will wish to use this lib will have to add rx dependencies in their gradle too?
You need to use api instead of implementation for your library's dependencies.
See here for the difference between them.
I've looked at Anko 0.8 - unresolved lparams reference, but I'm not using lparams in the outermost layout like in that link.
I get 'unresolved reference: lparams' in the following code (and no import suggestions in Android Studio). Any ideas as to what I've missed and/or overlooked?
class LoginActivityUi: AnkoComponent<LoginActivity> {
override fun createView(ui: AnkoContext<LoginActivity>): View = with(ui) {
verticalLayout {
backgroundColorResource = R.color.background_page
textView{
text = "ASDF"
}.lparams{
}
}
}
}
Here are my dependencies ($kotlin_version is 1.2.71, $anko_version is 0.10.6):
dependencies {
implementation fileTree(include: ['*.jar'], dir: 'libs')
implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlin_version"
implementation 'com.android.support:appcompat-v7:28.0.0'
implementation 'com.android.support:design:28.0.0'
testImplementation 'junit:junit:4.12'
androidTestImplementation 'com.android.support.test:runner:1.0.2'
androidTestImplementation 'com.android.support.test.espresso:espresso-core:3.0.2'
implementation "org.jetbrains.anko:anko-commons:$anko_version"
// Appcompat-v7 (only Anko Commons)
implementation "org.jetbrains.anko:anko-appcompat-v7-commons:$anko_version"
// Appcompat-v7 (Anko Layouts)
implementation "org.jetbrains.anko:anko-appcompat-v7:$anko_version"
implementation "org.jetbrains.anko:anko-coroutines:$anko_version"
// Anko Layouts
implementation "org.jetbrains.anko:anko-sdk15:$anko_version" // sdk15, sdk19, sdk21, sdk23 are also available
implementation "org.jetbrains.anko:anko-appcompat-v7:$anko_version"
// Coroutine listeners for Anko Layouts
implementation "org.jetbrains.anko:anko-sdk15-coroutines:$anko_version"
implementation "org.jetbrains.anko:anko-appcompat-v7-coroutines:$anko_version"
// CardView-v7
implementation "org.jetbrains.anko:anko-cardview-v7:$anko_version"
// Design
implementation "org.jetbrains.anko:anko-design:$anko_version"
implementation "org.jetbrains.anko:anko-design-coroutines:$anko_version"
// GridLayout-v7
implementation "org.jetbrains.anko:anko-gridlayout-v7:$anko_version"
// Percent
implementation "org.jetbrains.anko:anko-percent:$anko_version"
// RecyclerView-v7
implementation "org.jetbrains.anko:anko-recyclerview-v7:$anko_version"
implementation "org.jetbrains.anko:anko-recyclerview-v7-coroutines:$anko_version"
// Support-v4 (only Anko Commons)
implementation "org.jetbrains.anko:anko-support-v4-commons:$anko_version"
// Support-v4 (Anko Layouts)
implementation "org.jetbrains.anko:anko-support-v4:$anko_version"
// ConstraintLayout
implementation "org.jetbrains.anko:anko-constraint-layout:$anko_version"
}
Okay, so... As you can see in this diff, as of Anko 0.10.6 the verticalLayout methods have been modified to take initializer lambdas that are of type LinearLayout.() -> Unit instead of the previous _LinearLayout.() -> Unit types. The underscored _LinearLayout class is the one that defines the lparams methods that you're looking for, which is why it has gone missing due to this change.
There's already an open issue for this breaking change here: https://github.com/Kotlin/anko/issues/673
In the meantime, you can either stick with 0.10.5, or you can use linearLayout with an explicit orientation as a workaround:
linearLayout {
orientation = LinearLayout.VERTICAL
backgroundColorResource = R.color.background_page
textView {
text = "ASDF"
}.lparams {
}
}
I am trying to save a location to geofire but not getting any response from console and in logs.
I have added the dependency in gradle files and created my database reference like this:
DatabaseReference pickupRef = FirebaseDatabase.getInstance().getReference(AppConstants.PICK_UP_REF);
pickupRef.keepSynced(true);
and the string AppConstants.PICK_UP_REF equals PickUpRef. In my activity, I have done this:
Log.d(TAG, "UID in PUR:\t" + uid);
GeoFire mGeoFire = new GeoFire(pickupRef.child(uid));
if (mLastLocation != null) {
mGeoFire.setLocation(uid, new GeoLocation(mLastLocation.getLatitude(), mLastLocation.getLongitude()), new GeoFire.CompletionListener() {
#Override
public void onComplete(String key, DatabaseError error) {
if (error != null){
Log.d(TAG, "Write complete");
} else {
Log.d(TAG, "Write Failed:\t" + error.getMessage());
}
}
});
The oncompletionlistener never gets fired and nothing is updated in my database. Anyone else faced this problem or have I misconfigured it?
Here's my gradle file:
apply plugin: 'com.android.application'
android {
compileSdkVersion 27
defaultConfig {
applicationId "com.jjoey.transportr"
minSdkVersion 17
targetSdkVersion 27
versionCode 1
versionName "1.0"
testInstrumentationRunner
"android.support.test.runner.AndroidJUnitRunner"
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
}
dependencies {
implementation fileTree(dir: 'libs', include: ['*.jar'])
implementation 'com.android.support:appcompat-v7:27.1.1'
implementation 'com.android.support:design:27.1.1'
implementation 'com.android.support.constraint:constraint-layout:1.1.0'
implementation 'com.android.support:support-annotations:27.1.1'
implementation 'com.reginald:editspinner:1.0.0'
implementation 'com.squareup.picasso:picasso:2.5.2'
implementation 'de.hdodenhof:circleimageview:2.1.0'
implementation 'com.android.support:support-v4:27.1.1'
implementation 'com.google.firebase:firebase-core:12.0.1'
implementation 'com.google.firebase:firebase-auth:12.0.1'
implementation 'com.google.firebase:firebase-database:12.0.1'
implementation 'com.google.firebase:firebase-storage:12.0.1'
implementation 'com.firebase:geofire-android:2.3.1'
implementation 'com.google.android.gms:play-services-nearby:12.0.1'
implementation 'com.google.android.gms:play-services-maps:12.0.1'
implementation 'com.google.android.gms:play-services-places:12.0.1'
implementation 'com.google.android.gms:play-services-location:12.0.1'
implementation 'com.afollestad.material-dialogs:core:0.9.6.0'
testImplementation 'junit:junit:4.12'
androidTestImplementation 'com.android.support.test:runner:1.0.2'
androidTestImplementation 'com.android.support.test.espresso:espresso-core:3.0.2'
implementation 'com.android.support:cardview-v7:27.1.1'
}
apply plugin: 'com.google.gms.google-services'
Change your dependencies like below in app grandle:
dependencies {
implementation fileTree(dir: 'libs', include: ['*.jar'])
implementation 'com.android.support:appcompat-v7:27.1.1'
implementation 'com.android.support:design:27.1.1'
implementation 'com.android.support.constraint:constraint-layout:1.1.0'
implementation 'com.android.support:support-annotations:27.1.1'
implementation 'com.reginald:editspinner:1.0.0'
implementation 'com.squareup.picasso:picasso:2.5.2'
implementation 'de.hdodenhof:circleimageview:2.2.0'
implementation 'com.android.support:support-v4:27.1.1'
implementation 'com.google.firebase:firebase-core:16.0.0'
implementation 'com.google.firebase:firebase-auth:16.0.1'
implementation 'com.google.firebase:firebase-database:16.0.1'
implementation 'com.google.firebase:firebase-storage:16.0.1'
implementation 'com.firebase:geofire-android:2.3.1'
implementation 'com.google.android.gms:play-services-nearby:15.0.1'
implementation 'com.google.android.gms:play-services-maps:15.0.1'
implementation 'com.google.android.gms:play-services-places:15.0.1'
implementation 'com.google.android.gms:play-services-location:15.0.1'
implementation 'com.afollestad.material-dialogs:core:0.9.6.0'
testImplementation 'junit:junit:4.12'
androidTestImplementation 'com.android.support.test:runner:1.0.2'
androidTestImplementation 'com.android.support.test.espresso:espresso-core:3.0.2'
implementation 'com.android.support:cardview-v7:27.1.1'
}
And change in Project grandle:
classpath 'com.android.tools.build:gradle:3.1.2'
classpath 'com.google.gms:google-services:4.0.1'