android - ConnectivityManager ClassCastException with Google Analytics v4 and ProGuard -



android - ConnectivityManager ClassCastException with Google Analytics v4 and ProGuard -

i'm having troubles compiling app uses proguard , google analytics v4. single other thread seems similar here, except there aren't many details.

i've tried next no avail:

doing keep com.google.** { *; } doing -keep android.support.** { *; } package. error continues crop every other bit of obfuscated code, if joining newly obfuscated code pre-obfuscated google analytics code causes errors. using -keepattributes signature in case there's issue generics. using obfuscated dictionary of four-letter words (such rnqp, sslq) in case android dexing causes pre-obfuscated google analytics classes conflict obfuscated project files.

here exception:

11-08 22:45:01.644 2206-2226/com.example.helloworld e/gav3﹕ thread[gathread,5,main]: error on gathread: java.lang.classcastexception: android.net.connectivitymanager cannot cast android.support.v4.d.a @ com.google.a.a.a.at.a(unknown source) @ com.google.a.a.a.am.a(unknown source) @ com.google.a.a.a.s.h(unknown source) @ com.google.a.a.a.s.g(unknown source) @ com.google.a.a.a.s.a(unknown source) @ com.google.a.a.a.u.run(unknown source) @ com.google.a.a.a.ab.run(unknown source) 11-08 22:45:01.644 2206-2226/com.example.helloworld e/gav3﹕ thread[gathread,5,main]: google analytics shutting down.

proguard configuration file (99.9% vanilla):

# configuration file proguard. # http://proguard.sourceforge.net/index.html#manual/usage.html # optimizations: if don't want optimize, utilize # proguard-android.txt configuration file instead of one, # turns off optimization flags. adding optimization introduces # risks, since illustration not optimizations performed # proguard works on versions of dalvik. next flags turn # off various optimizations known have issues, list may not # finish or date. (the "arithmetic" optimization can # used if targeting android 2.0 or later.) create sure # test thoroughly if go route. #-optimizations !code/simplification/cast,!field/*,!class/merging/* #-optimizationpasses 5 #-allowaccessmodification #-dontpreverify # remainder of file identical non-optimized version # of proguard configuration file (except other file has # flags turn off optimization). -dontusemixedcaseclassnames -dontskipnonpubliclibraryclasses -verbose -keepattributes *annotation* -keep public class com.google.vending.licensing.ilicensingservice -keep public class com.android.vending.licensing.ilicensingservice # native methods, see http://proguard.sourceforge.net/manual/examples.html#native -keepclasseswithmembernames class * { native <methods>; } # maintain setters in views animations can still work. # see http://proguard.sourceforge.net/manual/examples.html#beans -keepclassmembers public class * extends android.view.view { void set*(***); *** get*(); } # want maintain methods in activity used in xml attribute onclick -keepclassmembers class * extends android.app.activity { public void *(android.view.view); } # enumeration classes, see http://proguard.sourceforge.net/manual/examples.html#enumerations -keepclassmembers enum * { public static **[] values(); public static ** valueof(java.lang.string); } -keep class * implements android.os.parcelable { public static final android.os.parcelable$creator *; } -keepclassmembers class **.r$* { public static <fields>; } # back upwards library contains references newer platform versions. # don't warn in case app linking against older # platform version. know them, , safe. -dontwarn android.support.** -keepattributes signature

it seems you're using re-create of proguard-android-optimize.txt (a more mutual approach refer original, maintained file in android sdk). can seek disabling optimization:

-dontoptimize

if indeed avoids problem, can study issue in proguard's bug tracker or me directly.

make sure using latest version of proguard (version 5.1 @ time of writing) , latest version of gms library.

(i developer of proguard)

android google-analytics proguard

Comments

Popular posts from this blog

formatting - SAS SQL Datepart function returning odd values -

c++ - Apple Mach-O Linker Error(Duplicate Symbols For Architecture armv7) -

php - Yii 2: Unable to find a class into the extension 'yii2-admin' -