java - Google Analytics throws NoClassDefFoundError at runtime -


when compiling project, works fine when run throws runtime exception

java.lang.noclassdeffounderror: com.fiz.analyticstrackers$1 

everything configured added google analytics dependency in gradle file

dependencies {     compile filetree(dir: 'libs', include: ['*.jar'])     compile 'com.android.support:appcompat-v7:22.2.0'     compile 'com.google.android.gms:play-services-analytics:7.3.0' } 

permission in manifest file

<uses-permission android:name="android.permission.internet" /> <uses-permission android:name="android.permission.access_network_state" /> 

initialization , trigger event code base

analyticstrackers analyticstrackers = analyticstrackers.getinstance(); tracker tracker = analyticstrackers.gettracker(); tracker.send(new hitbuilders.eventbuilder().setcategory(category).setaction(action).setlabel(label).build()); 

here analyticstrackers custom class contains common googleanalytics functionality.

enable multidex support solve problem. here how configure it.

in build gradle file

 defaultconfig {         multidexenabled true  }  compile 'com.android.support:multidex:1.0.1' 

in application class

public class myapplication extends application {      @override     protected void attachbasecontext(context base) {         super.attachbasecontext(base);         multidex.install(this);     } } 

Comments

Popular posts from this blog

scala - 'wrong top statement declaration' when using slick in IntelliJ -

c# - DevExpress.Wpf.Grid.InfiniteGridSizeException was unhandled -

PySide and Qt Properties: Connecting signals from Python to QML -