Firebase Performance Monitoring, Can't instrument...IllegalArgumentException - firebase

I'm using implementation 'com.google.firebase:firebase-perf:19.0.5'
I applied the plugin: apply plugin: 'com.google.firebase.firebase-perf'
and in my project level gradle: classpath 'com.google.firebase:perf-plugin:1.3.1'
I'm running into a few issues.
1) during my build, I see a lot of Can't instrument exceptions like this:
Can't instrument: kotlin/reflect/jvm/internal/impl/load/java/lazy/descriptors/LazyJavaClassMemberScope$nestedClasses$1$enumMemberNames$1.class
java.lang.IllegalArgumentException
at org.objectweb.asm.ClassVisitor.<init>(ClassVisitor.java:79)
at com.google.firebase.perf.plugin.instrumentation.InstrumentationVisitor.<init>(InstrumentationVisitor.java:55)
at com.google.firebase.perf.plugin.instrumentation.Instrument.instrument(Instrument.java:170)
at com.google.firebase.perf.plugin.instrumentation.Instrument.instrumentClassesInJar(Instrument.java:117)
at com.google.firebase.perf.plugin.FirebasePerfTransform.performTransformationFor(FirebasePerfTransform.java:563)
at com.google.firebase.perf.plugin.FirebasePerfTransform.transformJarInputs(FirebasePerfTransform.java:445)
at com.google.firebase.perf.plugin.FirebasePerfTransform.transform(FirebasePerfTransform.java:416)
at com.android.build.gradle.internal.pipeline.TransformTask$2.call(TransformTask.java:239)
at com.android.build.gradle.internal.pipeline.TransformTask$2.call(TransformTask.java:235)
at com.android.builder.profile.ThreadRecorder.record(ThreadRecorder.java:102)
at com.android.build.gradle.internal.pipeline.TransformTask.transform(TransformTask.java:230)
at sun.reflect.GeneratedMethodAccessor190.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:497)
at org.gradle.internal.reflect.JavaMethod.invoke(JavaMethod.java:103)
at
2) I only see logging TraceMetric and no NetworkRequestMetric. the API calls are using Retrofit2, which uses OkHttp3

I had the same issue, and the fix was to move the classpath of the firebase performance before the other plugin that has the dependency to the "org.ow2.asm:asm"(in the project level gradle file).
dependencies {
classpath 'com.google.firebase:perf-plugin:1.3.1'
classpath "org.jacoco:org.jacoco.core:$jacoco_version"
...
}
Firebase plugin uses version 7.0 of the org.ow2.asm:asm
Jacoco plugin uses 5.+ of the org.ow2.asm:asm
To check the versions you can try to use ./gradlew buildEnvironment
https://www.gitmemory.com/issue/gradle/gradle/9650/499815877
Maybe you have the same issue as me.

Related

Flutter firebase version conflict firebase messaging

I have a firebase flutter app, everything worked, but when I added firebase_messaging: ^5.1.4. The app gives this:
FAILURE: Build failed with an exception.
* What went wrong:
Could not determine the dependencies of task ':app:preDebugBuild'.
> In project 'app' a resolved Google Play services library dependency depends on another at an exact version (e.g. "[18.0.
0]", but isn't being resolved to that version. Behavior exhibited by the library will be unknown.
Dependency failing: com.google.firebase:firebase-messaging:18.0.0 -> com.google.firebase:firebase-iid#[18.0.0], but fire
base-iid version was 19.0.0.
The following dependencies are project dependencies that are direct or have transitive dependencies that lead to the art
ifact with the issue.
-- Project 'app' depends on project 'firebase_messaging' which depends onto com.google.firebase:firebase-messaging#18.0.
0
-- Project 'app' depends onto com.google.firebase:firebase-core#17.0.0
-- Project 'app' depends on project 'cloud_functions' which depends onto com.google.firebase:firebase-functions#17.0.0
-- Project 'app' depends on project 'firebase_core' which depends onto com.google.firebase:firebase-core#16.0.9
For extended debugging info execute Gradle from the command line with ./gradlew --info :app:assembleDebug to see the dep
endency paths to the artifact. This error message came from the google-services Gradle plugin, report issues at https://
github.com/google/play-services-plugins and disable by adding "googleServices { disableVersionCheck = false }" to your b
uild.gradle file.
These are my other packages
firebase_auth: ^0.11.1+12
firebase_storage: ^3.0.4
cloud_firestore: ^0.12.7+1
cloud_functions: ^0.4.1+1
(they all work)
I have this in my build gradle: classpath 'com.google.gms:google-services:4.2.0'
implementation 'com.google.firebase:firebase-core:17.0.0'
Is there a way of fixing this?
Thank you very much!
I'm currently trying this:
in the app level build.gradle I have this:
apply plugin: 'com.google.gms.google-services'
I'm adding this:
com.google.gms.googleservices.GoogleServicesPlugin.config.disableVersionCheck = true
(after apply plugin: 'com.google.gms.google-services')
Include Firebase Core dependency in pub spec.yaml and not specifying the versions of firebase dependencies resolve most of the issues.
https://pub.dev/packages/firebase_core
run these two lines
rm Podfile.lock
pod install --repo-update
these will does the job. it took my two days to fix it

React native app crashes for first time when downloaded from playstore when you have google referral receiver in your manifest

We have built an application and recently we have added com.google.android.gms.analytics.CampaignTrackingReceiver the default receiver in the manifest to auto capture the install sources medium etc.
We have a strange issue here. Every time we download the application, it crashes for the first time. Below is the logs.
Caused by java.lang.ClassNotFoundException: Didn't find class "com.google.android.gms.analytics.CampaignTrackingReceiver" on path: DexPathList[[zip file "/data/app/YOURPACKAGENAME--w6LGEcDlZ0B12LlUiobEQ==/base.apk"],nativeLibraryDirectories=[/data/app/YOURPACKAGENAME--w6LGEcDlZ0B12LlUiobEQ==/lib/arm, /data/app/YOURPACKAGENAME--w6LGEcDlZ0B12LlUiobEQ==/base.apk!/lib/armeabi-v7a, /system/lib, /vendor/lib]]
at dalvik.system.BaseDexClassLoader.findClass(BaseDexClassLoader.java:125)
at java.lang.ClassLoader.loadClass(ClassLoader.java:379)
at java.lang.ClassLoader.loadClass(ClassLoader.java:312)
at android.app.ActivityThread.handleReceiver(ActivityThread.java:3229)
at android.app.ActivityThread.-wrap17(Unknown Source)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1722)
at android.os.Handler.dispatchMessage(Handler.java:106)
at android.os.Looper.loop(Looper.java:176)
at android.app.ActivityThread.main(ActivityThread.java:6656)
at java.lang.reflect.Method.invoke(Method.java)
at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:547)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:873)
Below is the google, firebase related libraries added in build.gradle.
compile project(':react-native-firebase')
compile "com.google.android.gms:play-services-base:16.0.1"
compile "com.google.firebase:firebase-core:16.0.4"
compile "com.google.firebase:firebase-analytics:16.0.4"
apply plugin: 'com.google.gms.google-services'
All firebase events have been tracked as expected. How to solve the above crash?
Most likely your production build is being stripped of some classes by your Proguard config.
Se if adding this in your proguard-pro file works:
-keep class com.google.android.gms.analytics { *; }

While trying to run "gradle test jacoco" in gitbash I am getting TestExecutionException, NoClassDefFoundError, ClassNotFoundException

While trying to run jacoco in my gradle project, I am getting exceptions.
I have added following dependencies:
compile "org.jacoco:org.jacoco.report:0.7.8"
compile "org.jacoco:org.jacoco.core:0.7.8"
compile "org.ow2.asm:asm-all:5.1"
I also tried with different options like providedCompile, testCompile also.
I am getting this exception, while trying to run "gradle test jacoco" in gitbash.
Exceptions:
org.gralde.api.tasks: TaskExecutionException: Exception failed for
task:'practice-app:jacocoTestReport'
Caused by: java.lang.NoClassDefFoundError:
org/jacoco/report/IReportVistor
Caused by: java.lang.ClassNotFoundException:
org.jacoco.report.IReportVisitor
I also verified other checks like jacoco jars available in my local gradle repo etc.
I had also experienced the similar problem during Jacoco integration in one of our gradle project. The plugin somehow did not bring the required jars. Then, I tried to add all the dependencies manually
say :-
compile "org.jacoco:org.jacoco.report:0.7.8"
compile "org.jacoco:org.jacoco.core:0.7.8"
compile "org.ow2.asm:asm-all:0.7.8"
etc., but that trick also did not work. Still got classnotfound exception against jacoco jars. Then after a lot hit & trial, I came to know about jacocoClasspath. I did the followings:
1) First changed Jacoco version to
jacoco {
toolVersion = "0.7.8+"
}
As got some incompatibility version issue (Don't remember the exact error/exception).
2) Then, added the below code in build.gradle to ensure that required dependencies are present in the jacoco class path.
jacocoTestReport.doFirst {
configurations.testRuntime.each { jacocoClasspath += files(it); }
}
Notes:
1) doFirst will be executed before jacoco task gets executed.
2) I just added whatever present in my runtime to the jacocoClasspath. You may refine the code, to add only the required jars to the jacoco class path.

java.lang.NoClassDefFoundError: org/apache/commons/codec/DecoderException in JBoss AS 7

I am testing JBoss AS 7 prior to deployment with a .war file of an app running in a different server.
I get this error when I try to log onto the database via the app:
SEVERE [] (http--0.0.0.0-8080-4) java.lang.NoClassDefFoundError: org/apache/commons/codec/DecoderException
java.lang.ClassNotFoundException: org.apache.commons.codec.DecoderException from [Module "deployment.app.war:main" from Service Module Loader]
at org.jboss.modules.ModuleClassLoader.findClass(ModuleClassLoader.java:190)
at org.jboss.modules.ConcurrentClassLoader.performLoadClassUnchecked(ConcurrentClassLoader.java:468)
at org.jboss.modules.ConcurrentClassLoader.performLoadClassChecked(ConcurrentClassLoader.java:456)
at org.jboss.modules.ConcurrentClassLoader.performLoadClass(ConcurrentClassLoader.java:398)
at org.jboss.modules.ConcurrentClassLoader.loadClass(ConcurrentClassLoader.java:120)
at org.apache.commons.httpclient.HttpMethodBase.<init>(HttpMethodBase.java:220)
In some forums, they suggest adding the commons-codec jar, but I already have it in JBoss, right? (in here: jboss-as-7.1.1.Final/modules/org/apache/commons/codec/main/commons-codec-1.4.jar)
OSGi is not activated, frankly I have no idea to what purpose it serves, but when I try to activate it it messes with my war as it fails to deploy...
I have JDK, but no JRE if that's any help.
JBoss AS 7 does not use OSGi by default for modular class loading. It uses JBoss Modules so this has nothing to do with OSGi.
What you need to do if you want to use the commons-codec provided with JBoss AS 7 is add a dependency to your deployment.
Modules are not visible by your artefact classes automatically. You have three possibilities:
Define a global module in your standalone.xml
http://javahowto.blogspot.de/2012/09/how-to-create-global-modules-in-jboss.html
This module will be used by all artefacts you are deploying on Jboss.
Put it into your war artefact, into the lib folder. You can do that with Maven.
Define an explicit dependency within your Manifest. https://docs.jboss.org/author/display/AS7/Class+Loading+in+AS7
Section Dependencies: Manifest Entries

gradle sync failed due to ASCII open file

When i try to connect my project in firebase an error raise. It shows, gradle sync failed and ASCII open file. How to solve it? Please give a way.
I changed dependency at gradle.build - Project as follows :
dependencies { classpath 'com.android.tools.build:gradle:3.0.0' classpath 'com.google.gms:google-services:3.1.0' }

Resources