Firebase getInstance always throwing No virtual method Exception - android

I am integrating Firebase realtime database inside my app, I followed the adding instructions, but it's always throwing exception
No virtual method
FATAL EXCEPTION: main
Process: appsTest.test, PID: 17680
java.lang.NoSuchMethodError: No virtual method zzcnu()Z in class Lcom/google/firebase/FirebaseApp; or its super classes (declaration of 'com.google.firebase.FirebaseApp' appears in /data/app/appsTest.test-2/base.apk:classes15.dex)
at com.google.firebase.database.FirebaseDatabase.getInstance(Unknown Source)
at com.google.firebase.database.FirebaseDatabase.getInstance(Unknown Source)
at appsTest.test.inAppViews.newsFeedScreen.NewsFeedFragment.<init>(NewsFeedFragment.java:31)
at appsTest.test.inAppViews.BaseActivity.onClickOnTab(BaseActivity.java:144)
at appsTest.test.inAppViews.BaseActivity.onTabSelected(BaseActivity.java:258)
at com.ashokvarma.bottomnavigation.BottomNavigationBar.sendListenerCall(BottomNavigationBar.java:578)
at com.ashokvarma.bottomnavigation.BottomNavigationBar.selectTabInternal(BottomNavigationBar.java:558)
at com.ashokvarma.bottomnavigation.BottomNavigationBar.access$000(BottomNavigationBar.java:44)
at com.ashokvarma.bottomnavigation.BottomNavigationBar$1.onClick(BottomNavigationBar.java:502)
at android.view.View.performClick(View.java:6213)
at android.view.View$PerformClick.run(View.java:23645)
at android.os.Handler.handleCallback(Handler.java:751)
at android.os.Handler.dispatchMessage(Handler.java:95)
at android.os.Looper.loop(Looper.java:154)
at android.app.ActivityThread.main(ActivityThread.java:6692)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:1468)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1358)
Project gradle
buildscript {
repositories {
jcenter()
}
dependencies {
classpath 'com.android.tools.build:gradle:2.3.2'
classpath 'com.google.gms:google-services:3.0.0'
}
}
App module gradle:
compile "com.google.firebase:firebase-messaging:+"
compile "com.google.firebase:firebase-core:9.6.1"
compile 'com.google.firebase:firebase-database:9.6.1'
apply plugin: 'com.google.gms.google-services' // this code at the end of gradle file
Initializing FireBase Database inside fragment at the OnCreate method:
DatabaseReference mRootRefernce = FirebaseDatabase.getInstance().getReference(); // at this line the exception happened
DatabaseReference reference = mRootRefernce.child("feed");

it's fixed by the following:
use the same version for Google play services (3.1.0)
update all libraries that depend on older version of Google play services, and it's in my case OneSignal library to the latest version

Try to use the latest version of firebase.
compile 'com.google.firebase:firebase-database:11.2.0'
compile 'com.google.firebase:firebase-core:11.2.0'
google services:
classpath 'com.google.gms:google-services:3.1.0'
in app/build.gradle do you have below in the end?
apply plugin: 'com.google.gms.google-services'

Related

Firestore crashing app with new dependencies

Yesterday I updated the dependencies of Firestore with 17.1.1 and Google Services with 4.1.0. Now while launching the app it crashes.
Note:
If I change Google Services to 4.0.2, the Firestore initializes properly and the app works as expected.
classpath 'com.google.gms:google-services:4.0.2'
Update:
Changing to 4.2.0 works.
Logs:
Default FirebaseApp failed to initialize because no default options were found. This usually means that com.google.gms:google-services was not applied to your gradle project.
... I/FirebaseInitProvider: FirebaseApp initialization unsuccessful
Error:
java.lang.RuntimeException: Unable to start activity ComponentInfo{\...\/\...\.ui.MessageActivity}: java.lang.IllegalStateException: Default FirebaseApp is not initialized in this process \...\. Make sure to call FirebaseApp.initializeApp(Context) first.
at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2778)
at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2856)
at android.app.ActivityThread.-wrap11(Unknown Source:0)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1589)
at android.os.Handler.dispatchMessage(Handler.java:106)
at android.os.Looper.loop(Looper.java:164)
at android.app.ActivityThread.main(ActivityThread.java:6494)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:438)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:807)
Caused by: java.lang.IllegalStateException: Default FirebaseApp is not initialized in this process \...\. Make sure to call FirebaseApp.initializeApp(Context) first.
at com.google.firebase.FirebaseApp.getInstance(com.google.firebase:firebase-common##16.0.2:240)
at com.google.firebase.firestore.FirebaseFirestore.getInstance(com.google.firebase:firebase-firestore##17.1.1:68)
at \...\.ServiceLocator.provideFirestore(ServiceLocator.java:18)
at \...\.ServiceLocator.provideMessageRepository(ServiceLocator.java:28)
at \...\.ServiceLocator.provideMessageViewModelFactory(ServiceLocator.java:33)
at \...\.ui.MessageActivity.onCreate(MessageActivity.java:112)
at android.app.Activity.performCreate(Activity.java:7009)
at android.app.Activity.performCreate(Activity.java:7000)
at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1214)
at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2731)
at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2856) 
at android.app.ActivityThread.-wrap11(Unknown Source:0) 
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1589) 
at android.os.Handler.dispatchMessage(Handler.java:106) 
at android.os.Looper.loop(Looper.java:164) 
at android.app.ActivityThread.main(ActivityThread.java:6494) 
at java.lang.reflect.Method.invoke(Native Method) 
at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:438) 
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:807)
gradle Project:
buildscript {
repositories {
google()
jcenter()
}
dependencies {
classpath 'com.android.tools.build:gradle:3.3.0-alpha13'
// NOTE: Do not place your application dependencies here; they belong
// in the individual module build.gradle files
classpath 'com.google.gms:google-services:4.1.0'
}
}
allprojects {
repositories {
google()
jcenter()
}
}
gradle app:
apply plugin: 'com.android.application'
android {
compileSdkVersion 28
defaultConfig {
applicationId "..."
minSdkVersion 22
targetSdkVersion 28
versionCode 8
versionName "1.0.8"
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
}
// ...
buildToolsVersion '28.0.3'
}
dependencies {
implementation fileTree(include: ['*.jar'], dir: 'libs')
implementation 'androidx.appcompat:appcompat:1.0.0'
implementation 'androidx.legacy:legacy-support-v4:1.0.0'
implementation 'com.google.android.material:material:1.0.0'
implementation 'androidx.constraintlayout:constraintlayout:1.1.3'
implementation 'androidx.recyclerview:recyclerview:1.0.0'
// ...
// Firestore
implementation 'com.google.firebase:firebase-core:16.0.4'
implementation 'com.google.firebase:firebase-firestore:17.1.1'
implementation 'com.google.firebase:firebase-auth:16.0.4'
implementation 'com.google.android.gms:play-services-auth:16.0.1'
implementation 'com.google.firebase:firebase-ads:16.0.1'
implementation 'com.firebaseui:firebase-ui-auth:4.1.0'
// Crash Reports
implementation 'com.crashlytics.sdk.android:crashlytics:2.9.5'
}
apply plugin: 'com.google.gms.google-services'
There is no need to use FirebaseApp.initializeApp(context). Using only the dependencies is enough. So you shouldn't ever have to call it manually if you performed the standard integration, as it will be invoked automatically a startup via a ContentProvider that will initialize before any other Activity or Service. You can read Doug's post regarding on how to initialize Firebase on Android.
The problem in your code is that your are using for your project the alpha13 version for your gradle. To solve this, please change the following line of code:
classpath 'com.android.tools.build:gradle:3.3.0-alpha13'
to
classpath 'com.android.tools.build:gradle:3.2.0'
Will solve this issue.
This is a confirmed bug in the play-services plugin 4.1.0 according to https://issuetracker.google.com/issues/112716914. The answer is to use an earlier version, e.g. 4.0.2.
Edit: Version 4.2.0 is released where the bug is fixed.
Switching to 4.2.0 Solves the issue.

Android app works while used as debugging,but crashes if testing version "app-debug" is installed

Please comment why it was downvoted and what should i add more
Here is logcat output
06-02 15:21:04.520 7986-7986/? E/AndroidRuntime: FATAL EXCEPTION: main
Process: com.example.mayurn.engineeringhelper, PID: 7986
java.lang.NoSuchMethodError: No static method zzcx(Landroid/content/Context;)Lcom/google/android/gms/internal/zzbth; in class Lcom/google/android/gms/internal/zzbth; or its super classes (declaration of 'com.google.android.gms.internal.zzbth' appears in /data/app/com.example.mayurn.engineeringhelper-2/base.apk:classes12.dex)
at com.google.firebase.FirebaseApp.initializeApp(Unknown Source)
at com.google.firebase.FirebaseApp.initializeApp(Unknown Source)
at com.google.firebase.FirebaseApp.initializeApp(Unknown Source)
at com.google.firebase.provider.FirebaseInitProvider.onCreate(Unknown Source)
at android.content.ContentProvider.attachInfo(ContentProvider.java:1748)
at android.content.ContentProvider.attachInfo(ContentProvider.java:1723)
at com.google.firebase.provider.FirebaseInitProvider.attachInfo(Unknown Source)
at android.app.ActivityThread.installProvider(ActivityThread.java:5187)
at android.app.ActivityThread.installContentProviders(ActivityThread.java:4782)
at android.app.ActivityThread.handleBindApplication(ActivityThread.java:4722)
at android.app.ActivityThread.access$1600(ActivityThread.java:153)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1408)
at android.os.Handler.dispatchMessage(Handler.java:102)
at android.os.Looper.loop(Looper.java:148)
at android.app.ActivityThread.main(ActivityThread.java:5451)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:726)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:616)
In my Build.gradle (Module:app) I have
compile 'com.android.support:appcompat-v7:25.3.0'
compile 'com.android.support.constraint:constraint-layout:1.0.0-alpha8'
compile 'com.android.support:recyclerview-v7:25.3.0'
compile 'com.android.support:cardview-v7:25.3.0'
compile 'com.android.support:design:25.3.0'
compile 'com.google.firebase:firebase-storage:10.0.1'
compile 'com.google.firebase:firebase-auth:10.0.1'
compile 'com.google.firebase:firebase-database:10.0.1'
compile 'com.firebase:firebase-client-android:2.4.0'
compile 'com.firebaseui:firebase-ui-storage:1.2.0'
compile 'com.firebaseui:firebase-ui-database:1.2.0'
compile 'com.android.support:multidex:1.0.1'
testCompile 'junit:junit:4.12'
}
apply plugin: 'com.google.gms.google-services'
And in build.gradle(Project) I have this
buildscript {
repositories {
jcenter()
}
dependencies {
classpath 'com.android.tools.build:gradle:2.3.2'
// NOTE: Do not place your application dependencies here; they belong
// in the individual module build.gradle files
classpath 'com.google.gms:google-services:3.0.0'
}
}
allprojects {
repositories {
jcenter()
}
}
task clean(type: Delete) {
delete rootProject.buildDir
}
I have seen these answers
Firebase database dependency crashes app
After upgrading to google play services 8.4.0 my app crashes on startup
No static method zzUr() in Firebase when I try to use Analytics with Notifications
All they suggest to use the same version of firebase services.
You can see that I have already done that, the only version of ui-database and ui-storage are different.
Also short note:-MultiDex is enabled and minify is disabled.
The problem in your dependencies is that your firebaseui library is not compatible with firebase library.
Check Compatibility with Firebase / Google Play Services Libraries.
You want 1.2.0 version of firebaseui and therefore you must update firebase library to 10.2.0+.
In your build.gradle you need to add all the dependencies -
dependencies {
// FirebaseUI Database only
compile 'com.firebaseui:firebase-ui-database:1.2.0'
// FirebaseUI Auth onl
compile 'com.firebaseui:firebase-ui-auth:1.2.0'
// FirebaseUI Storage only
compile 'com.firebaseui:firebase-ui-storage:1.2.0'
// Single target that includes all FirebaseUI libraries above
compile 'com.firebaseui:firebase-ui:1.2.0'
}
If this doesn't fix your error then you might want to add these files as well
compile "com.android.support:design:23.2.1"
compile "com.android.support:customtabs:23.2.1"
compile "com.android.support:cardview-v7:23.2.1"
I hope after doing all this, your issue should be long gone.
Btw for more information on this, you can check out the Git repo of Firebase - https://github.com/firebase/FirebaseUI-Android#installation actually this has all the details.

Fatal Exception: java.lang.NoSuchMethodError: No static method zzaaj()Lcom/google/firebase/iid/zzg

I am having firebase notification in app and on some devices it is getting crash on receiving of notification.
crash report:
Fatal Exception: java.lang.NoSuchMethodError: No static method zzaaj()Lcom/google/firebase/iid/zzg; in class Lcom/google/firebase/iid/zzg; or its super classes (declaration of 'com.google.firebase.iid.zzg' appears in /data/app/my.app-1/base.apk)
at com.google.firebase.messaging.FirebaseMessagingService.zzF(Unknown Source)
at com.google.firebase.iid.zzb.onStartCommand(Unknown Source)
at android.app.ActivityThread.handleServiceArgs(ActivityThread.java:4128)
at android.app.ActivityThread.access$2400(ActivityThread.java:229)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1924)
at android.os.Handler.dispatchMessage(Handler.java:102)
at android.os.Looper.loop(Looper.java:148)
at android.app.ActivityThread.main(ActivityThread.java:7325)
at java.lang.reflect.Method.invoke(Method.java)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:1230)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1120)
Module dependencies
compile 'com.android.support:design:25.1.0'
compile 'com.android.support:support-v4:25.1.0'
compile 'com.google.android.gms:play-services-ads:10.2.0'
compile 'com.google.android.gms:play-services-analytics:10.2.0'
compile 'com.google.firebase:firebase-messaging:10.2.0'
Project dependencies:
dependencies {
classpath 'com.android.tools.build:gradle:2.2.3'
classpath "io.realm:realm-gradle-plugin:1.1.1"
classpath 'com.google.gms:google-services:3.0.0'
// NOTE: Do not place your application dependencies here; they belong
// in the individual module build.gradle files
}
I am having all firebase libraries of same version. Please help me out.

Updating firebase in my gradle app module ruined my app. Going back to previous versions does not work

Before any changes my gradle looked like this:
dependencies {
compile fileTree(dir: 'libs', include: ['*.jar'])
androidTestCompile('com.android.support.test.espresso:espresso-core:2.2.2', {
exclude group: 'com.android.support', module: 'support-annotations'
})
compile 'com.google.firebase:firebase-core:10.0.1'
compile 'com.google.firebase:firebase-auth:10.0.1'
compile 'com.google.firebase:firebase-database:10.0.1'
compile 'com.google.android.gms:play-services-auth:10.0.1'
compile 'com.firebaseui:firebase-ui-auth:1.0.1'
}
apply plugin: 'com.google.gms.google-services'
and
buildscript {
repositories {
jcenter()
}
dependencies {
classpath 'com.android.tools.build:gradle:2.2.3'
classpath 'com.google.gms:google-services:3.0.0'
}
}
allprojects {
repositories {
jcenter()
maven { url 'https://maven.fabric.io/public' }
}
}
task clean(type: Delete) {
delete rootProject.buildDir
}
and everything was working fine. Then I updated all of the com/google... dependencies to 10.2.0 version and firebaseui to 1.2.0 as the table here says https://github.com/firebase/FirebaseUI-Android#compatibility-with-firebase--google-play-services-libraries
Then I got some errors on mFirebaseAuth = FirebaseAuth.getInstance() line (sorry but can't remember what exactly) so I changed back all of the versions to 10.0.1 and 1.0.1 and I'm still getting error and my application crashes on start (this error is different than the previous one).
E/AndroidRuntime: FATAL EXCEPTION: main
Process: com.mnm135.emil.showsmanager, PID: 3837
java.lang.NoSuchMethodError: No static method zzdz(Ljava/lang/String;)Z in class Lcom/google/android/gms/common/util/zzw; or its super classes (declaration of 'com.google.android.gms.common.util.zzw' appears in /data/app/com.mnm135.emil.showsmanager-1/base.apk)
at com.google.firebase.FirebaseOptions.<init>(Unknown Source)
at com.google.firebase.FirebaseOptions.fromResource(Unknown Source)
at com.google.firebase.FirebaseApp.initializeApp(Unknown Source)
at com.google.firebase.provider.FirebaseInitProvider.onCreate(Unknown Source)
at android.content.ContentProvider.attachInfo(ContentProvider.java:1751)
at android.content.ContentProvider.attachInfo(ContentProvider.java:1726)
at com.google.firebase.provider.FirebaseInitProvider.attachInfo(Unknown Source)
at android.app.ActivityThread.installProvider(ActivityThread.java:5811)
at android.app.ActivityThread.installContentProviders(ActivityThread.java:5403)
at android.app.ActivityThread.handleBindApplication(ActivityThread.java:5342)
at android.app.ActivityThread.-wrap2(ActivityThread.java)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1528)
at android.os.Handler.dispatchMessage(Handler.java:102)
at android.os.Looper.loop(Looper.java:154)
at android.app.ActivityThread.main(ActivityThread.java:6077)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:865)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:755)
I tried Invalidate caches/restart, clean and rerun. Even rebooting my pc. Nothing seems to work.
Any ideas?
Edit:
I tried aaroncio's solution, removed apply plugin: 'com.google.gms.google-services' and I'm getting different error:
E/AndroidRuntime: FATAL EXCEPTION: main
Process: com.mnm135.emil.showsmanager, PID: 5157
java.lang.NoSuchMethodError: No static method zzzq()Ljava/lang/String; in class Lcom/google/android/gms/common/util/zzu; or its super classes (declaration of 'com.google.android.gms.common.util.zzu' appears in /data/app/com.mnm135.emil.showsmanager-2/base.apk)
at com.google.firebase.FirebaseApp.getInstance(Unknown Source)
at com.google.firebase.auth.FirebaseAuth.getInstance(Unknown Source)
at com.mnm135.emil.showsmanager.base.LoginActivity.onCreate(LoginActivity.java:34)
at android.app.Activity.performCreate(Activity.java:6662)
at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1118)
at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2599)
at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2707)
at android.app.ActivityThread.-wrap12(ActivityThread.java)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1460)
at android.os.Handler.dispatchMessage(Handler.java:102)
at android.os.Looper.loop(Looper.java:154)
at android.app.ActivityThread.main(ActivityThread.java:6077)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:865)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:755)
Line mentioned in comment is mFirebaseAuth = FirebaseAuth.getInstance();
I solved it removing the line about firebase-authentication in the build-gradle file:
compile 'com.google.firebase:firebase-auth:10.2.1'
I removed the imports about authentication also, I was just making some experiments with firebase auth so its not important in this case, but to others may not be ideal solution.
It looks like something changed with the last version of Google Services, I had a similar problem and solved it deleting the following line in gradle:
apply plugin: 'com.google.gms.google-services'

java.lang.NoClassDefFoundError: Failed resolution of: Lorg/jacoco/agent/rt/internal_773e439/Offline;

I have an android application which depends on some android libraries I have built on my own.
If I build the application with the library dependencies specified in the build.gradle then I get the following exception.
-6694/com.mycompany.myproject D/AndroidRuntime: Shutting down VM
05-10 18:47:55.986 6694-6694/com.mycompany.myproject E/AndroidRuntime: FATAL EXCEPTION: main
Process: com.mycompany.myproject, PID: 6694
java.lang.NoClassDefFoundError: Failed resolution of: Lorg/jacoco/agent/rt/internal_773e439/Offline;
at com.mycompany.ui.components.ListArrayAdapter.$jacocoInit(ListArrayAdapter.java)
at com.mycompany.ui.components.ListArrayAdapter.<init>(ListArrayAdapter.java)
at com.mycompany.myproject.NationalityFragment.onCreateView(NationalityFragment.java:47)
at android.support.v4.app.Fragment.performCreateView(Fragment.java:1974)
at android.support.v4.app.FragmentManagerImpl.moveToState(FragmentManager.java:1067)
at android.support.v4.app.FragmentManagerImpl.moveToState(FragmentManager.java:1252)
at android.support.v4.app.BackStackRecord.run(BackStackRecord.java:742)
at android.support.v4.app.FragmentManagerImpl.execPendingActions(FragmentManager.java:1617)
at android.support.v4.app.FragmentController.execPendingActions(FragmentController.java:339)
at android.support.v4.app.FragmentActivity.onStart(FragmentActivity.java:602)
at android.app.Instrumentation.callActivityOnStart(Instrumentation.java:1220)
at android.app.Activity.performStart(Activity.java:5953)
at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2261)
at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2360)
at android.app.ActivityThread.access$800(ActivityThread.java:144)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1278)
at android.os.Handler.dispatchMessage(Handler.java:102)
at android.os.Looper.loop(Looper.java:135)
at android.app.ActivityThread.main(ActivityThread.java:5221)
at java.lang.reflect.Method.invoke(Native Method)
at java.lang.reflect.Method.invoke(Method.java:372)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:899)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:694)
If I remove the dependencies and instead copy the concerned classes from the libraries and run the application, it runs perfectly fine.
Also I have other dependencies like junit and app-compat and those don't seem to cause this issue. Any ideas what might be causing this issue?
I have tried specifying the jacoco plugin to the following version
and it still doesn't seem to work.
I have tried removing jacoco dependencies from the libraries : no
effect.
My main build.gradle looks like this :
task wrapper(type: Wrapper) {
gradleVersion = '2.13'
}
buildscript {
repositories {
mavenCentral()
jcenter()
}
dependencies {
classpath 'com.android.tools.build:gradle:2.1.0'
classpath 'com.github.dcendents:android-maven-gradle-plugin:1.3'
}
}
subprojects {
project.ext.set('compileSdkVersion', 23)
project.ext.set('buildToolsVersion', '23.0.3')
project.ext.set('minSdkVersion', 19)
project.ext.set('targetSdkVersion', 23)
project.ext.set('versionCode', 1)
project.ext.set('versionName', '1.0-SNAPSHOT')
project.ext.set('javaVersion', JavaVersion.VERSION_1_7)
group 'com.mycompany.myproject'
version = project.ext.get('versionName')
repositories {
mavenLocal()
mavenCentral()
}
}
I got this error after updating Android Studio. I found out that switching off Instant Run in Settings fixed it.
According to here, you'll need to jacocoagent.jar put on the classpath. In other words, you'll need to compile the same version of jacocoagent.jar in gradle.
First check the version code here(In your situation is version0.7.4.201502262128) and then download jars from here.
Put jacocoagent.jar in libs folder then add compile fileTree(dir: 'libs', include: ['jacocoagent.jar']) in your app's build.gradle.
bijang is correct. You need to add the jacocoagent.jar. Rather than including the jar directly, pull it down from maven. The version of the jacocoagent has to match the version of the jacocoplugin since the Offline.class package has a commmit hash. Here are my dependencies:
compile 'org.jacoco:jacoco-maven-plugin:0.7.9'
compile 'org.jacoco:org.jacoco.agent:0.7.9:runtime'
For Jacoco 0.8.7 i added the following to the app/build.gradle to resolve the issue
implementation 'org.jacoco:org.jacoco.agent:0.8.7'

Categories

Resources