I am creating the android app for booking and also I need FCM messaging in the android app.When i implement FCM messaging than it is working well but after i implement the Google calendar in app than the app is crashing when i am sending message on FCM on that line:
java.lang.NoSuchMethodError: No static method
createRootContext(II)Lcom/fasterxml/jackson/core/json/JsonReadContext;
in class Lcom/fasterxml/jackson/core/json/JsonReadContext; or its
super classes (declaration of 'com.fasterxml.jackson.core.json.JsonReadContext' appears in /data/app/com.mmf.loggedinapp-2/split_lib_dependencies_apk.apk:classes102.dex)
This is my FCM Code :
fireBaseReference.push().setValue(map);
This is my FCM code which create crashing when i am sending message on FCM
usering this method reference1.push().setValue(map);
PrefManager prefManager = new PrefManager(getApplicationContext());
Map<String, String> map = new HashMap<String, String>();
Calendar c = Calendar.getInstance();
SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd");
String strDate = sdf.format(c.getTime());
map.put("sender_id", prefManager.getLoggedInId());
map.put("message", messageText);
map.put("time", timeString);
map.put("receiver_id", contactid);
map.put("date", strDate);
map.put("type", "mobile");
map.put("messageStatus", "0");
map.put("status", "1");
if (docUri == null) {
map.put("doc_url", "");
map.put("docFileName", "");
} else {
map.put("doc_url", docUri.toString());
map.put("docFileName", docFileName);
}
if (imageUri == null) {
map.put("imageUri", "");
map.put("imageName", "");
} else {
map.put("imageUri", imageUri.toString());
map.put("imageName", imageName);
}
reference1.push().setValue(map);
This is my build.gradle :-
implementation fileTree(dir: 'libs', include: ['*.jar'])
implementation 'com.android.support:appcompat-v7:27.1.1'
implementation 'com.android.support.constraint:constraint-layout:1.1.2'
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:design:27.1.1'
implementation 'com.intuit.sdp:sdp-android:1.0.5'
implementation 'com.google.firebase:firebase-messaging:17.3.0'
implementation 'com.google.firebase:firebase-core:16.0.1'
implementation 'com.google.firebase:firebase-database:16.0.1'
implementation 'de.hdodenhof:circleimageview:2.2.0'
implementation 'com.android.support:cardview-v7:27.1.1'
implementation 'com.android.support:palette-v7:27.1.1'
implementation 'com.squareup.retrofit2:converter-gson:2.3.0'
implementation 'com.squareup.retrofit2:retrofit:2.3.0'
implementation'
com.toptoche.searchablespinner:searchablespinnerlibrary:1.3.1'
implementation 'com.googlecode.libphonenumber:libphonenumber:8.8.2'
implementation 'net.gotev:uploadservice:2.1'
implementation 'com.github.ome450901:SimpleRatingBar:1.3.2'
implementation 'com.vincentbrison.openlibraries.android:dualcache:3.1.1'
implementation 'org.apache.commons:commons-lang3:3.5'
implementation 'com.github.travijuu:numberpicker:1.0.7'
implementation 'com.google.android.gms:play-services-maps:15.0.1'
implementation 'com.android.support:multidex:1.0.3'
implementation 'com.andanhm.quantitypicker:quantitypicker:1.1.0'
implementation 'com.firebase:firebase-client-android:2.5.2'
implementation 'com.google.firebase:firebase-storage:16.0.1'
implementation 'com.mikhaellopez:circularimageview:3.0.2'
implementation 'com.github.sundeepk:compact-calendar-view:2.0.2.3'
implementation 'com.hbb20:ccp:2.0.8'
implementation 'com.github.barteksc:android-pdf-viewer:2.3.0'
implementation 'org.apache.commons:commons-io:1.3.2'
implementation 'com.github.bumptech.glide:glide:4.3.0'
implementation 'com.wang.avi:library:2.1.3'
implementation 'io.branch.sdk.android:library:2.+'
implementation 'com.github.chrisbanes:PhotoView:2.1.3'
implementation 'com.devlomi.record-view:record-view:2.0.0'
implementation 'com.github.gcacace:signature-pad:1.2.1'
implementation 'com.stripe:stripe-android:7.0.0'
implementation 'com.amitshekhar.android:android-networking:1.0.0'
implementation 'com.github.franmontiel:FullScreenDialog:1.0.1'
implementation 'com.seatgeek:placesautocomplete:0.3-SNAPSHOT'
implementation 'com.jcodecraeer:xrecyclerview:1.5.9'
implementation 'com.twilio:voice-android:2.0.7'
implementation 'com.squareup.retrofit:retrofit:1.9.0'
implementation 'com.koushikdutta.ion:ion:2.1.8'
implementation 'com.cocosw:bottomsheet:1.3.1'
implementation 'me.leolin:ShortcutBadger:1.1.4#aar'
implementation 'net.the4thdimension:audio-wife:1.0.3'
implementation 'com.google.android.gms:play-services-gcm:15.0.1'
implementation 'com.google.android.gms:play-services-auth:16.0.0'
implementation 'com.google.api-client:google-api-client-android:1.23.0'
exclude module: 'httpclient'
implementation 'com.google.http-client:google-http-client-gson:1.23.0'
exclude module: 'httpclient'
implementation 'com.google.apis:google-api-services-calendar:v3-rev331-
1.24.1'
implementation('com.crashlytics.sdk.android:crashlytics:2.9.4#aar') {
transitive = true;
}
implementation 'com.android.volley:volley:1.1.0'
}
apply plugin: 'com.google.gms.google-services'
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)
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
I get an error like this. What should I do? do i have to do? do i have to add something in my dependencies?
this my code
//, MapboxMap.OnMapClickListener, PermissionsListener, View.OnClickListener {
private MapView mapView;
private Button button;
private MapboxMap mapboxMap;
private PermissionsManager permissionsManager;
private LocationComponent locationComponent;
// variables for calculating and drawing a route
private DirectionsRoute currentRoute;
private static final String TAG = "DirectionsActivity";
private NavigationMapRoute navigationMapRoute;
private RoadManager roadManager;
#Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
this is my dependencies
implementation fileTree(dir: 'libs', include: ['*.jar'])
implementation 'androidx.appcompat:appcompat:1.0.2'
implementation 'androidx.constraintlayout:constraintlayout:1.1.3'
implementation 'com.google.firebase:firebase-database:17.0.0'
implementation 'com.google.firebase:firebase-auth:17.0.0'
implementation 'com.google.firebase:firebase-storage:17.0.0'
//implementation 'com.firebaseui:firebase-ui-auth:1.2.0'
implementation 'com.squareup.picasso:picasso:2.71828' //2.5.2
implementation 'com.firebaseui:firebase-ui-database:1.2.0'
implementation 'com.google.firebase:firebase-analytics:17.2.0'//vcoba kalo error ini diapus
implementation 'com.google.android.gms:play-services-maps:17.0.0'
testImplementation 'junit:junit:4.12'
androidTestImplementation 'androidx.test.ext:junit:1.1.0'
androidTestImplementation 'androidx.test.espresso:espresso-core:3.1.1'
implementation 'com.google.android.gms:play-services-location:17.0.0'
implementation 'androidx.recyclerview:recyclerview:1.0.0'
implementation 'com.android.support:recyclerview-v7:28.0.0'
implementation 'com.android.support:cardview-v7:28.0.0'
implementation 'androidx.cardview:cardview:1.0.0'
implementation 'org.osmdroid:osmdroid-android:5.6#aar'
implementation 'com.mapbox.mapboxsdk:mapbox-android-navigation-ui:0.42.1'
implementation('com.mapbox.mapboxsdk:mapbox-android-sdk:6.8.1') {
exclude group: 'group_name', module: 'module_name'
}
}
what should I do to solve this problem?
RoadManager is part of OSMBonusPack.
First of all, you should follow OSMBonusPack HowToInstall guide.
And then follow OSMBonusPack tutorial.
Android Studio version 3.4
app/build.gradle:
android {
compileSdkVersion 28
defaultConfig {
minSdkVersion 18
targetSdkVersion 28
versionCode 427
versionName "2.1.427"
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
def AAVersion = '4.5.2'
dependencies {
annotationProcessor "org.androidannotations:androidannotations:$AAVersion"
annotationProcessor "org.androidannotations:ormlite:$AAVersion"
implementation fileTree(dir: 'libs', include: ['*.jar'])
implementation 'com.android.support.constraint:constraint-layout:1.1.3'
implementation 'com.android.support:animated-vector-drawable:28.0.0'
implementation 'com.android.support:appcompat-v7:28.0.0'
implementation 'com.android.support:cardview-v7:28.0.0'
implementation 'com.android.support:customtabs:28.0.0'
implementation 'com.android.support:exifinterface:28.0.0'
implementation 'com.android.support:support-media-compat:28.0.0'
implementation 'com.android.support:support-v4:28.0.0'
implementation 'com.crashlytics.sdk.android:crashlytics:2.9.7'
implementation 'com.google.android.gms:play-services-gcm:16.0.0'
implementation 'com.google.code.gson:gson:2.8.2'
implementation 'com.j256.ormlite:ormlite-android:5.1'
implementation 'commons-codec:commons-codec:1.11'
implementation 'commons-io:commons-io:2.6'
implementation 'org.apache.commons:commons-lang3:3.8.1'
implementation 'org.apache.httpcomponents:httpclient:4.3.6'
implementation "org.androidannotations:androidannotations-api:$AAVersion"
implementation "org.androidannotations:ormlite-api:$AAVersion"
testImplementation 'junit:junit:4.12'
androidTestImplementation 'com.android.support.test.espresso:espresso-core:3.0.2'
androidTestImplementation 'com.android.support.test:runner:1.0.2'
}
import org.apache.http.NameValuePair;
import org.apache.http.client.utils.URLEncodedUtils;
private static NotificationInvoice getNotificationInvoice(NotificationFO notification) {
String notificationText = notification.getNotificationText();
String payload = "";
NotificationType type = null;
Log.d(TAG, "check_notificationText:\n" + notificationText);
List<NameValuePair> params = URLEncodedUtils.parse(new URI(notificationText), "UTF-8");
Log.d(TAG, "check_params(" + params.size() + "):\n" + params);
}
In Android 6.0 the "notificationText" success parse to List<NameValuePair>:
check_notificationText:
http://11.1.1:54401/notify?receiver=testok&system=factura_mobile&device_type=android&type=invoice&payload=11111;0000000;5.55;2019-05-16;2019-05-16;ecb6f683-63b3-4efd-b8c3-0877f1aeae8d
check_params(5):
receiver=testok, system=factura_mobile, device_type=android, type=invoice, payload=11111;0000000;5.55;2019-05-16;2019-05-16;ecb6f683-63b3-4efd-b8c3-0877f1aeae8d
As you can see the param "payload" = 11111;0000000;5.55;2019-05-16;2019-05-16;ecb6f683-63b3-4efd-b8c3-0877f1aeae8d
Nice it's correct.
But on Android 9.0 the "notificationText" not success parse :
check_notificationText:
http://11.11.11.11:54401/notify?receiver=22222222222222&system=factura_mobile&device_type=android&type=invoice&payload=3c55ba74-a85e-401b-8c1c-40ca83947768;0000000;5.55;2019-05-16;2019-05-16;1a87fb32-4543-4111-89a4-e150a7f71168
check_params(10):
[receiver=22222222222222, system=factura_mobile, device_type=android, type=invoice, payload=3c55ba74-a85e-401b-8c1c-40ca83947768, 0000000, 5.55, 2019-05-16, 2019-05-16, 1a87fb32-4543-4111-89a4-e150a7f71168]
getNotificationInvoice_FOUND_PAYLOAD -> set_to_payload_param.getValue = 3c55ba74-a85e-401b-8c1c-40ca83947768
As you can see the param "payload" = 3c55ba74-a85e-401b-8c1c-40ca83947768 but must be
3c55ba74-a85e-401b-8c1c-40ca83947768;0000000;5.55;2019-05-16;2019-05-16;1a87fb32-4543-4111-89a4-e150a7f71168
Why URLEncodedUtils not correct parse text in Android 9.0 ?
Try to use Java in-built method java.net.URLEncoder
URLEncodedUtils is deprecated in Android API 22+
List<NameValuePair> params = URLEncoder.encode(notificationText, "UTF-8");
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'