I updated my localytics from 4.2 to 4.5.
I updated my firebase to the latest ver also 11.6.0.
I am using gradle:
compile 'com.google.android.gms:play-services-ads:11.6.0'
compile 'com.google.firebase:firebase-core:11.6.0'
compile 'com.google.firebase:firebase-messaging:11.6.0'
compile 'com.localytics.android:library:4.5.1'
compile 'com.android.support:appcompat-v7:26.1.0'
Unfortunately the app is crashing at launch time with this trace:
java.lang.NoClassDefFoundError: com.localytics.android.BackgroundService
at com.localytics.android.ManifestHandler.cancelBackgroundTask(ManifestHandler.java:180)
at com.localytics.android.ManifestHandler._onUploadCompleted(ManifestHandler.java:162)
at com.localytics.android.BaseHandler._uploadCallback(BaseHandler.java:326)
at com.localytics.android.BaseHandler$3.run(BaseHandler.java:129)
at com.localytics.android.BaseProvider.runBatchTransaction(BaseProvider.java:403)
at com.localytics.android.BaseHandler._runBatchTransactionOnProvider(BaseHandler.java:154)
at com.localytics.android.BaseHandler.handleMessage(BaseHandler.java:125)
at android.os.Handler.dispatchMessage(Handler.java:102)
at android.os.Looper.loop(Looper.java:135)
at android.os.HandlerThread.run(HandlerThread.java:61)
I have no idea how to fix this (besides reverting to the older version).
Track what is missing and add it. In my case it was gcm dependency.
implementation "com.google.android.gms:play-services-gcm:11.6.2"
You can also try upgrade your support library versions and buildToolsVersion to latest version.
Related
Hej Guys
I have developed a cordova crossplatform app which if build in debug works fine but when build in release the app keeps crashing. Following are the versions I am using.
Cordova-cli: 8.0.0
Cordova-android: 7.1.1
Npm: 6.4.1
Node: 8.12.0
I have an idea about that its com.android.support libraray which is causing the problem as in my build.gradle file there are multiple versions of the support library.
dependencies {
implementation fileTree(dir: 'libs', include: '*.jar')
// SUB-PROJECT DEPENDENCIES START
implementation(project(path: ":CordovaLib"))
compile "com.google.android.gms:play-services-location:11.6.2"
compile "com.android.support:appcompat-v7:27.0.0"
compile "com.android.support:support-v4:24.1.1+"
compile "com.android.support:support-v4:+"
compile "com.android.support:support-v4:27.+"
compile "com.android.support:support-v13:27.+"
compile "me.leolin:ShortcutBadger:1.1.17#aar"
compile "com.google.firebase:firebase-messaging:11.6.2"
compile "com.squareup.okhttp3:okhttp:3.+"
// SUB-PROJECT DEPENDENCIES END
}
From what i have read from different sources the library version should be aligned to use the same version.
I am using cordova-android-support-gradle-release plugin to fix android-support version to 26.+. If I set the android-support version less then 26.+ then i get the following error: Constructor Builder in class Builder cannot be applied to given types
The Plugins which are setting the support library version in my solution are:
phonegap-plugin-push: plugin-version: 2.2.3, support-library-version v13:27.+
phonegap-plugin-barcodescanner: plugin-version: 8.0.0, support-library-version v4:27.+
cordova-plugin-file-opener2: plugin-version: 2.0.19, support-library-version v4:+
cordova-plugin-camera: plugin-version: 4.0.3, support-library-version v4:24.1.1+
How do I align Support library versions? Should i edit the Plugin.xml of the plugin which is setting the Support library version or should I create a Build-extra-gradle file?
Is It com.android.support library that is causing the app to crash if yes then why is the app not crashing when build in debug?
Any help would be appreciated. Thanks :)
Full error trace:
Error:Execution failed for task ':app:processDebugGoogleServices'.
> Please fix the version conflict either by updating the version of the google-services plugin (information about the latest version is available at https://bintray.com/android/android-tools/com.google.gms.google-services/) or updating the version of com.google.android.gms to 11.4.2.
The error happens when I am adding the last dependency:
compile 'com.google.firebase:firebase-ml-model-interpreter:16.2.0'
Here are my gradle dependencies:
dependencies {
compile fileTree(include: ['*.jar'], dir: 'libs')
compile 'com.jakewharton:butterknife:8.6.0'
annotationProcessor 'com.jakewharton:butterknife-compiler:8.6.0'
compile 'com.facebook.android:facebook-login:4.27.0'
compile 'com.firebaseui:firebase-ui-database:2.0.1'
compile 'com.firebaseui:firebase-ui-storage:2.0.1'
compile 'com.firebase:firebase-jobdispatcher:0.6.0'
compile 'com.google.firebase:firebase-core:11.4.2'
compile 'com.google.firebase:firebase-auth:11.4.2'
compile 'com.google.firebase:firebase-ads:11.4.2'
compile 'com.google.firebase:firebase-database:11.4.2'
compile 'com.google.firebase:firebase-storage:11.4.2'
compile 'com.google.firebase:firebase-messaging:11.4.2'
compile 'com.android.support:design:25.4.0'
compile 'com.android.support:appcompat-v7:25.4.0'
compile 'com.android.support:recyclerview-v7:25.4.0'
compile 'com.android.support:cardview-v7:25.4.0'
compile 'com.android.support:support-v4:25.4.0'
implementation 'com.android.support:support-v4:25.4.0'
implementation 'com.android.support:support-vector-drawable:25.4.0'
compile 'com.android.support.constraint:constraint-layout:1.0.2'
implementation 'com.android.support.constraint:constraint-layout:1.0.2'
testCompile 'junit:junit:4.12'
compile 'com.github.chrisbanes:PhotoView:2.1.3'
//network
compile 'com.squareup.retrofit2:retrofit:2.1.0'
compile 'com.squareup.retrofit2:converter-gson:2.1.0'
compile('com.crashlytics.sdk.android:crashlytics:2.6.8#aar') {
transitive = true
}
//billing
compile 'com.anjlab.android.iab.v3:library:1.0.44'
//tutorial
compile 'com.github.popalay:tutors:1.0.6'
//rate dialog
compile 'io.github.kobakei:ratethisapp:1.2.0'
compile 'com.github.tozny:java-aes-crypto:1.1.0'
compile 'com.flurry.android:analytics:8.1.0'
compile 'com.github.ceryle:RadioRealButton:v2.1.1'
compile 'com.github.drawers:SpinnerDatePicker:1.0.6'
/* compile 'com.siclo.ezphotopick:library:1.0.8'
implementation project(':EZPhotoPickerLib')*/
compile project(path: ':EZPhotoPickerLib')
compile "commons-io:commons-io:2.6"
compile "com.github.hotchemi:permissionsdispatcher:3.1.0"
annotationProcessor "com.github.hotchemi:permissionsdispatcher-processor:3.1.0"
compile 'org.tensorflow:tensorflow-lite:+'
compile 'com.google.firebase:firebase-ml-model-interpreter:16.2.0'
}
apply plugin: 'com.google.gms.google-services'
Tried syncing the libs but I am constantly getting this error no matter what I do.
Go to your Project level build and replace
classpath 'com.google.gms:google-services:3.x.x'
with
classpath 'com.google.gms:google-services:4.0.0'
and sync your code
because in your app gradle you are using mi-modal-interpreter lastes which have dependencies version which are compatible with gsm latest version. Whereas you are using an old version google.gsm which confuses the version conflict.
if you update the google.gsm to 4.x.x then may be you have to update other all dependencies of google to latest versions. And you are also using firebase.ui:2.x.x On Updating these UI to firebase.ui:3.x.x then you need to change your code too because some of the methods is ui:2.x.x are also replace with new methods
refernce
For Firebase dependencies:
Always check "Getting Started" guide for SDK / plugin versions:
https://firebase.google.com/docs/android/setup
Latest google-services plugin version as of Aug 2018 is 4.0.1
Starting from May 2018, Google Play services and Firebase Android SDKs started to adopt a new versioning system complied to semantic versioning. After you upgrade all relevant SDKs to 15.0.0+ (check out each API's documentation), you no longer need to use identical versioning for each API moving forward. See below blog post for details (but ignore the specific versions in the post since they are no longer latest. Refer to Firebase documentation for latest versioning):
http://www.googblogs.com/announcing-new-sdk-versioning-in-google-play-services-and-firebase/
Also, Firebase SDK versions:
https://firebase.google.com/support/release-notes/android
Ref : https://firebase.google.com/docs/ml-kit/android/use-custom-models
As last answer update gradle
once again check official site documentation
Use a TensorFlow Lite model for inference with ML Kit on Android
You can use ML Kit to perform on-device inference with a TensorFlow Lite model.
This API requires Android SDK level 16 (Jelly Bean) or newer.
See the ML Kit quickstart sample on GitHub for an example of this API in use, or try the codelab.
Before you begin
If you have not already added Firebase to your app, do so by following the steps in the getting started guide.
Include the dependencies for ML Kit in your app-level build.gradle file:
dependencies {
// ...
implementation 'com.google.firebase:firebase-ml-model-interpreter:16.2.0'
}
Convert the TensorFlow model you want to use to TensorFlow Lite (tflite) format. See TOCO: TensorFlow Lite Optimizing Converter.
Host or bundle your model
Before you can use a TensorFlow Lite model for inference in your app, you must make the model available to ML Kit. ML Kit can use TensorFlow Lite models hosted remotely using Firebase, stored locally on the device, or both.
By both hosting the model on Firebase and storing the model locally, you can ensure that the most recent version of the model is used when it is available, but your app's ML features still work when the Firebase-hosted model isn't available.
Model security
Regardless of how you make your TensorFlow Lite models available to ML Kit, ML Kit stores them in the standard serialized protobuf format in local storage.
In theory, this means that anybody can copy your model. However, in practice, most models are so application-specific and obfuscated by optimizations that the risk is similar to that of competitors disassembling and reusing your code. Nevertheless, you should be aware of this risk before you use a custom model in your app.
On Android API level 21 (Lollipop) and newer, the model is downloaded
to a directory that is excluded from automatic backup.
On Android API level 20 and older, the model is downloaded to a directory named com.google.firebase.ml.custom.models in app-private internal storage. If you enabled file backup using BackupAgent, you might choose to exclude this directory.
For More Details Please Check https://firebase.google.com/docs/ml-kit/android/use-custom-models
my application include QR Scanner and Generator but when i add 'com.google.android.gms:play-services-vision:9.4.0' library it conflect with 'com.google.firebase:firebase-database:11.0.4' library
here my Gradle dependences
plus it shows me an error ..
Error:Execution failed for task ':app:processDebugGoogleServices'.
Please fix the version conflict either by updating the version of the google-services plugin (information about the latest version is available at https://bintray.com/android/android-tools/com.google.gms.google-services/) or updating the version of com.google.android.gms to 9.8.0.
Always try to use same version of APIs when you are dealing with google APIs:
If you are using Android Studio 3.0 you can use both compile and implementation
implementation 'com.google.firebase:firebase-database:11.0.4'
implementation 'com.google.android.gms:play-services-vision:11.0.4'
If you are using Android Studio version below 3.0 use compile
compile 'com.google.firebase:firebase-database:11.0.4'
compile 'com.google.android.gms:play-services-vision:11.0.4'
Try this
implementation 'com.google.firebase:firebase-database:11.0.4'
implementation 'com.google.android.gms:play-services-vision:11.0.4'
Add this:
implementation 'com.google.firebase:firebase-database:9.0.0'
compile 'com.google.firebase:firebase-database:9.0.0'
I'm using the following dependencies:
compile 'com.android.support:appcompat-v7:25.3.0'
compile 'com.android.support:support-v4:25.3.0'
compile 'com.android.support:recyclerview-v7:25.3.0'
compile 'com.android.support:design:25.3.0'
compile 'com.google.firebase:firebase-core:10.0.1'
compile 'com.google.firebase:firebase-database:10.0.1'
compile 'com.google.firebase:firebase-auth:10.0.1'
compile 'com.google.firebase:firebase-crash:10.0.1'
compile 'com.firebaseui:firebase-ui-database:1.1.1'
compile 'com.firebaseui:firebase-ui-auth:1.1.1'
compile 'com.google.android.gms:play-services:10.0.1'
In the Gradle file an error is shown:
All com.android.support libraries must use the exact same version
specification (mixing versions can lead to runtime crashes). Found
versions 25.3.0, 25.1.0, 24.0.0......
I can't update
com.google.android.gms:play-services:10.0.1
because i get the following error:
Please fix the version conflict either by updating the version of the
google-services plugin (information about the latest version is
available at
https://bintray.com/android/android-tools/com.google.gms.google-services/)
or updating the version of com.google.android.gms to 10.0.1.
When i remove the Firebase dependencies the error is gone. What causes this error and how can i get rid of it?
The com.firebaseui:firebase-ui-auth:10.0.1 library has transitive dependencies on:
com.android.support:cardview-v7:25.1.0
com.android.support:customtabs:25.1.0
You can force use of a newer version by explicitly including it in your dependencies:
compile "com.android.support:cardview-v7:25.3.0"
compile "com.android.support:customtabs:25.3.0"
The other version listed in the warning message, 24.0.0, must be from the Play Services library. In Android Studio, you can open the Gradle window and double-click on :app > Tasks > android > androidDependencies to get a dependency report to find the conflicting libraries.
I would also strongly recommend replacing:
compile 'com.google.android.gms:play-services:10.0.1'
with the specific APIs you need. They are listed here in Table 1. Including the single play-services library pulls in ALL the APIs, needlessly increasing the size of your APK and frequently requiring Multidex.
See this related question for further discussion of this issue.
did you add the classpath 'com.google.gms:google-services:versionĀ· to the dependencies and the apply plugin: 'com.google.gms.google-services' to the build.gradle ?
and change the compile 'com.android.support:support-v4:25.3.0' by com.android.support:support-v7:25.3.0'
After having started using Firebase for event logging in my android app I keep getting these error messages when I fire up my app:
E/System: java.lang.IllegalStateException: The database '/...folder here.../google_app_measurement_local.db' is not open.
at android.database.sqlite.SQLiteDatabase.throwIfNotOpenLocked(SQLiteDatabase.java:2169)
at android.database.sqlite.SQLiteDatabase.createSession(SQLiteDatabase.java:365)
at android.database.sqlite.SQLiteDatabase$1.initialValue(SQLiteDatabase.java:84)
at android.database.sqlite.SQLiteDatabase$1.initialValue(SQLiteDatabase.java:83)
at java.lang.ThreadLocal$Values.getAfterMiss(ThreadLocal.java:430)
at java.lang.ThreadLocal.get(ThreadLocal.java:65)
at android.database.sqlite.SQLiteDatabase.getThreadSession(SQLiteDatabase.java:359)
at android.database.sqlite.SQLiteProgram.getSession(SQLiteProgram.java:101)
at android.database.sqlite.SQLiteQuery.setLastStmt(SQLiteQuery.java:96)
at android.database.sqlite.SQLiteQuery.close(SQLiteQuery.java:111)
at android.database.sqlite.SQLiteCursor.close(SQLiteCursor.java:300)
at android.database.sqlite.SQLiteCursor.finalize(SQLiteCursor.java:366)
at java.lang.Daemons$FinalizerDaemon.doFinalize(Daemons.java:202)
at java.lang.Daemons$FinalizerDaemon.run(Daemons.java:185)
at java.lang.Thread.run(Thread.java:818)
Here's a snippet from my build.gradle:
dependencies {
compile 'com.android.support:support-v4:25.0.0'
compile 'com.google.firebase:firebase-analytics:9.8.0'
compile 'com.google.firebase:firebase-crash:9.8.0'
compile files('src/main/resources/simple-xml-2.7.jar')
compile files('src/main/resources/date4j.jar')
compile 'com.android.support:appcompat-v7:25.0.0'
compile files('src/main/resources/picasso-2.5.2.jar')
}
All I do is call
_firebaseAnalytics = FirebaseAnalytics.getInstance(context);
and then
_firebaseAnalytics.logEvent(FirebaseAnalytics.Event.SHARE, payload);
I have not been able to find any solutions online and am now hoping for help here...
Please move to latest version of firebase SDK. Firebase solved this memory leak issue in their updated sdk. Remove your old SDK and add below line in your gradle file.
compile 'com.google.firebase:firebase-core:11.0.1'
I have just faced with this when enabling strictmode, when adding
compile 'com.google.firebase:firebase-core:9.8.0'
I had to use earlier version:
compile 'com.google.firebase:firebase-core:9.6.0'
I've found latest version from Firebase Android SDK Release Notes