1

When i compile my app without Proguard it runs perfect.
When i compile it with Proguard it crashes on runtime when building the Activity.
I extended & implemented Application structure in order to use google analytics, and added logging at the beginning and on the end of it.
both logs are successfully written to log, but the logs i'm trying to print at the very beggining of the Activity's onCreate() never shown and all i get is this logcat output (which i tried to clear from irrelevant lines to not make it bigger than it is already).

Logcat output: (all my log tags are "MyLog")

    V/ApplicationPolicy(  808): isApplicationStateBlocked userId 0 pkgname com.xxx.MyApp.Core.MyApp
W/ActivityManager(  808): mDVFSHelper.acquire()
I/SurfaceFlinger(  275): id=1924 createSurf (16x16),-1 flag=20004, EimLayer
I/SurfaceFlinger(  275): id=1925 createSurf (16x16),-1 flag=20004, EimLayer
W/qdhwcomposer(  275): Excessive delay reading vsync: took 6150 ms
D/KeyguardViewMediator( 1173): setHidden false
D/KeyguardUpdateMonitor( 1173): sendKeyguardVisibilityChanged(true)
D/KeyguardUpdateMonitor( 1173): handleKeyguardVisibilityChanged(1)
W/ContextImpl(  808): Calling a method in the system process without a qualified user: android.app.ContextImpl.sendBroadcast:1482 com.android.server.am.ActivityStack.startPausingLocked:1006 com.android.server.am.ActivityStackSupervisor.pauseBackStacks:680 com.android.server.am.ActivityStack.resumeTopActivityLocked:1941 com.android.server.am.ActivityStackSupervisor.resumeTopActivitiesLocked:3102 
V/SmartFaceService - 3rd party pause(  808): onReceive [android.intent.action.ACTIVITY_STATE/com.sec.android.app.launcher/pause]
D/Launcher.HomeView( 1577): onPause
D/Launcher.Workspace( 1577): exitWidgetResizeMode State: NORMAL, newDragStarted: false
V/TaskCloserActivity(11035): TaskCloserActivity onReceive() - com.sec.android.intent.action.HOME_PAUSE
I/SELinux (12979): Function: selinux_android_load_priority [0], There is no sepolicy file.
I/SELinux (12979):  
I/SELinux (12979): Function: selinux_android_load_priority [1], There is no sepolicy version file.
I/SELinux (12979):  
I/SELinux (12979): Function: selinux_android_load_priority , loading version is VE=SEPF_SAMSUNG-SGH-I337_4.4.2_0011
I/SELinux (12979):  
I/SELinux (12979):  
I/SELinux (12979): selinux_android_seapp_context_reload: seapp_contexts file is loaded from /seapp_contexts
D/Launcher.HomeView( 1577): onStop
D/SurfaceWidgetClient$ISurfaceWidgetStub( 1847): [123491/1] Surface widget visibility changed visibility = false on instance = 1
D/SurfaceWidgetView( 1577): destroyHardwareResources():1141056656
D/KeyguardViewMediator( 1173): setHidden false
W/ContextImpl(  808): Calling a method in the system process without a qualified user: android.app.ContextImpl.sendBroadcast:1482 com.android.server.am.ActivityStackSupervisor.realStartActivityLocked:1164 com.android.server.am.ActivityStackSupervisor.attachApplicationLocked:598 com.android.server.am.ActivityManagerService.attachApplicationLocked:6026 com.android.server.am.ActivityManagerService.attachApplication:6086 
D/KeyguardViewMediator( 1173): setHidden false
D/KeyguardUpdateMonitor( 1173): sendKeyguardVisibilityChanged(true)
D/EnterpriseDeviceManager(  808): ContainerId: 0
D/STATUSBAR-StatusBarManagerService(  808): manageDisableList what=0x0 pkg=WindowManager.LayoutParams
W/ContextImpl(  808): Calling a method in the system process without a qualified user: android.app.ContextImpl.sendBroadcast:1468 com.android.internal.policy.impl.PhoneWindowManager.notifyToSSRM:5440 com.android.internal.policy.impl.PhoneWindowManager.access$200:167 com.android.internal.policy.impl.PhoneWindowManager$PolicyHandler.handleMessage:694 android.os.Handler.dispatchMessage:102 
D/Launcher( 1577): onTrimMemory. Level: 20
V/SmartFaceService - 3rd party pause(  808): onReceive [android.intent.action.ACTIVITY_STATE/com.xxx.MyApp.Core.MyApp/create]
D/SSRMv2:AirViewOnOff(  808): DeviceInfo:: 00000000000
D/KeyguardUpdateMonitor( 1173): handleKeyguardVisibilityChanged(1)
D/SurfaceWidgetView( 1577): destroyHardwareResources():1141056656
D/KeyguardViewMediator( 1173): setHidden false
D/KeyguardUpdateMonitor( 1173): sendKeyguardVisibilityChanged(true)
D/SSRMv2:AirViewOnOff(  808): SettingsAirViewInfo:: 100000000
I/dalvikvm(12979): Could not find method android.content.pm.PackageManager.getPackageInstaller, referenced from method com.google.android.gms.common.o.a
W/dalvikvm(12979): VFY: unable to resolve virtual method 554: Landroi    D/content/pm/PackageManager;.getPackageInstaller ()Landroi    D/content/pm/PackageInstaller;
D/dalvikvm(12979): VFY: replacing opcode 0x6e at 0x000b
I/GMPM    (12979): App measurement is starting up, version: 8487
I/GMPM    (12979): To enable debug logging run: adb shell setprop log.tag.GMPM VERBOSE
W/ApplicationPackageManager(12979): getCSCPackageItemText()
E/MyLog  (12979): --- start app --- v.0000  34
E/MyLog  (12979): --- end app ---  43
D/dalvikvm(12979): Trying to load lib /data/app-lib/com.xxx.MyApp.Core.MyApp-1/libVuforia.so 0x42e0a400
D/dalvikvm(12979): Added shared lib /data/app-lib/com.xxx.MyApp.Core.MyApp-1/libVuforia.so 0x42e0a400
W/dalvikvm(12979): Exception Ljava/lang/NoClassDefFoundError; thrown while initializing Lcom/v    D/MyApp/Cor    E/MyApp;
W/dalvikvm(12979): Class init failed in newInstance call (Lcom/v    D/MyApp/Cor    E/MyApp;)
D/AndroidRuntime(12979): Shutting down VM
W/dalvikvm(12979): threadid=1: thread exiting with uncaught exception (group=0x41c1ada0)
E/AndroidRuntime(12979): FATAL EXCEPTION: main
E/AndroidRuntime(12979): Process: com.xxx.MyApp.Core.MyApp, PID: 12979
E/AndroidRuntime(12979): java.lang.NoClassDefFoundError: java/util/UUID
E/AndroidRuntime(12979):    at java.lang.Runtime.nativeLoad(Native Method)
E/AndroidRuntime(12979):    at java.lang.Runtime.doLoad(Runtime.java:435)
E/AndroidRuntime(12979):    at java.lang.Runtime.loadLibrary(Runtime.java:363)
E/AndroidRuntime(12979):    at java.lang.System.loadLibrary(System.java:526)
E/AndroidRuntime(12979):    at com.xxx.MyApp.Core.MyApp.g(SourceFile:4512)
E/AndroidRuntime(12979):    at com.xxx.MyApp.Core.MyApp.<clinit>(SourceFile:711)
E/AndroidRuntime(12979):    at java.lang.Class.newInstanceImpl(Native Method)
E/AndroidRuntime(12979):    at java.lang.Class.newInstance(Class.java:1208)
E/AndroidRuntime(12979):    at android.app.Instrumentation.newActivity(Instrumentation.java:1079)
E/AndroidRuntime(12979):    at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2222)
E/AndroidRuntime(12979):    at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2363)
E/AndroidRuntime(12979):    at android.app.ActivityThread.access$900(ActivityThread.java:161)
E/AndroidRuntime(12979):    at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1265)
E/AndroidRuntime(12979):    at android.os.Handler.dispatchMessage(Handler.java:102)
E/AndroidRuntime(12979):    at android.os.Looper.loop(Looper.java:157)
E/AndroidRuntime(12979):    at android.app.ActivityThread.main(ActivityThread.java:5356)
E/AndroidRuntime(12979):    at java.lang.reflect.Method.invokeNative(Native Method)
E/AndroidRuntime(12979):    at java.lang.reflect.Method.invoke(Method.java:515)
E/AndroidRuntime(12979):    at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:1265)
E/AndroidRuntime(12979):    at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1081)
E/AndroidRuntime(12979):    at dalvik.system.NativeStart.main(Native Method)
E/AndroidRuntime(12979): Caused by: java.lang.NoClassDefFoundError: java/util/UUID
E/AndroidRuntime(12979):    ... 21 more
E/AndroidRuntime(12979): Caused by: java.lang.NoClassDefFoundError: com/qualcomm/ar/pl/RenderManager
E/AndroidRuntime(12979):    ... 21 more
E/AndroidRuntime(12979): Caused by: java.lang.NoClassDefFoundError: com/qualcomm/ar/pl/SystemTools
E/AndroidRuntime(12979):    ... 21 more
E/AndroidRuntime(12979): Caused by: java.lang.NoClassDefFoundError: com/qualcomm/ar/pl/SensorController
E/AndroidRuntime(12979):    ... 21 more
E/AndroidRuntime(12979): Caused by: java.lang.NoClassDefFoundError: com/qualcomm/ar/pl/SystemTools
E/AndroidRuntime(12979):    ... 21 more
E/AndroidRuntime(12979): Caused by: java.lang.NoClassDefFoundError: com/qualcomm/ar/pl/ARHttpClient
E/AndroidRuntime(12979):    ... 21 more
E/AndroidRuntime(12979): Caused by: java.lang.NoClassDefFoundError: com/qualcomm/ar/pl/FileTools
E/AndroidRuntime(12979):    ... 21 more
E/AndroidRuntime(12979): Caused by: java.lang.NoClassDefFoundError: javax/crypto/spec/SecretKeySpec
E/AndroidRuntime(12979):    ... 21 more
E/AndroidRuntime(12979): Caused by: java.lang.NoClassDefFoundError: com/qualcomm/ar/pl/CameraPreview
E/AndroidRuntime(12979):    ... 21 more
E/AndroidRuntime(12979): Caused by: java.lang.ClassNotFoundException: Didn't find class "com.qualcomm.ar.pl.CameraPreview" on path: DexPathList[[zip file "/data/app/com.xxx.MyApp.Core.MyApp-1.apk"],nativeLibraryDirectories=[/data/app-lib/com.xxx.MyApp.Core.MyApp-1, /vendor/lib, /system/lib]]
E/AndroidRuntime(12979):    at dalvik.system.BaseDexClassLoader.findClass(BaseDexClassLoader.java:67)
E/AndroidRuntime(12979):    at java.lang.ClassLoader.loadClass(ClassLoader.java:497)
E/AndroidRuntime(12979):    at java.lang.ClassLoader.loadClass(ClassLoader.java:457)
E/AndroidRuntime(12979):    ... 21 more
W/ActivityManager(  808):   Force finishing activity com.xxx.MyApp.Core.MyApp/com.xxx.MyApp.Core.MyApp
W/ContextImpl(  808): Calling a method in the system process without a qualified user: android.app.ContextImpl.sendBroadcast:1482 com.android.server.am.ActivityStack.startPausingLocked:1006 com.android.server.am.ActivityStack.finishActivityLocked:3162 com.android.server.am.ActivityStack.finishTopRunningActivityLocked:3005 com.android.server.am.ActivityStackSupervisor.finishTopRunningActivityLocked:3128 
D/CrashAnrDetector(  808): processName: com.xxx.MyApp.Core.MyApp
D/CrashAnrDetector(  808): broadcastEvent : com.xxx.MyApp.Core.MyApp data_app_crash
W/ApplicationPackageManager(  808): getCSCPackageItemText()
V/SmartFaceService - 3rd party pause(  808): onReceive [android.intent.action.ACTIVITY_STATE/com.xxx.MyApp.Core.MyApp/pause]
W/ContextImpl(  808): Calling a method in the system process without a qualified user: android.app.ContextImpl.sendBroadcast:1482 com.android.server.analytics.data.collection.application.CrashAnrDetector.broadcastEvent:296 com.android.server.analytics.data.collection.application.CrashAnrDetector.processDropBoxEntry:254 com.android.server.analytics.data.collection.application.CrashAnrDetector.access$100:60 com.android.server.analytics.data.collection.application.CrashAnrDetector$1.onReceive:102 
I/dumpstate(13004): begin
I/SpenGestureManager(  808): setFocusWindow0
D/EnterpriseDeviceManager(  808): ContainerId: 0
D/PointerIcon(  808): setMouseIconStyle1 pointerType: 1001iconType:101 flag:0
D/PointerIcon(  808): setMouseCustomIcon IconType is same.101
D/PointerIcon(  808): setHoveringSpenIconStyle1 pointerType: 10001iconType:1 flag:0
D/PointerIcon(  808): setHoveringSpenCustomIcon IconType is same.1
D/STATUSBAR-StatusBarManagerService(  808): manageDisableList what=0x0 pkg=WindowManager.LayoutParams
D/KeyguardViewMediator( 1173): setHidden false
D/KeyguardUpdateMonitor( 1173): sendKeyguardVisibilityChanged(true)
D/KeyguardViewMediator( 1173): setHidden false
D/KeyguardUpdateMonitor( 1173): sendKeyguardVisibilityChanged(true)
W/ContextImpl(  808): Calling a method in the system process without a qualified user: android.app.ContextImpl.sendBroadcast:1468 com.android.internal.policy.impl.PhoneWindowManager.notifyToSSRM:5440 com.android.internal.policy.impl.PhoneWindowManager.access$200:167 com.android.internal.policy.impl.PhoneWindowManager$PolicyHandler.handleMessage:694 android.os.Handler.dispatchMessage:102 
D/KeyguardUpdateMonitor( 1173): handleKeyguardVisibilityChanged(1)
D/KeyguardUpdateMonitor( 1173): handleKeyguardVisibilityChanged(1)
D/KeyguardViewMediator( 1173): setHidden false
D/KeyguardUpdateMonitor( 1173): sendKeyguardVisibilityChanged(true)
D/KeyguardUpdateMonitor( 1173): handleKeyguardVisibilityChanged(1)
D/KeyguardViewMediator( 1173): setHidden false
D/KeyguardUpdateMonitor( 1173): sendKeyguardVisibilityChanged(true)
D/SSRMv2:AirViewOnOff(  808): DeviceInfo:: 00000000000
D/SSRMv2:AirViewOnOff(  808): SettingsAirViewInfo:: 100000000
D/KeyguardUpdateMonitor( 1173): handleKeyguardVisibilityChanged(1)
D/KeyguardViewMediator( 1173): setHidden false
D/KeyguardUpdateMonitor( 1173): sendKeyguardVisibilityChanged(true)
D/KeyguardUpdateMonitor( 1173): handleKeyguardVisibilityChanged(1)
D/KeyguardViewMediator( 1173): setHidden false
D/KeyguardUpdateMonitor( 1173): sendKeyguardVisibilityChanged(true)
I/SurfaceFlinger(  275): id=1923 Removed Mauncher (7/15)
I/SurfaceFlinger(  275): id=1923 Removed Mauncher (-2/15)
V/WindowManager(  808): rotationForOrientationLw(orient=1, last=0); user=0  sensorRotation=-1 mLidState=-1 mDockMode=0 mHdmiPlugged=false mAccelerometerDefault=false gripRotationLock=false
W/ContextImpl(  808): Calling a method in the system process without a qualified user: android.app.ContextImpl.sendBroadcast:1482 com.android.server.am.ActivityStack.resumeTopActivityLocked:2182 com.android.server.am.ActivityStack.resumeTopActivityLocked:1763 com.android.server.am.ActivityStackSupervisor.resumeTopActivitiesLocked:3104 com.android.server.am.ActivityStack.completePauseLocked:1231 
D/MenuAppsGridFragment( 1577): onResume
V/SmartFaceService - 3rd party pause(  808): onReceive [android.intent.action.ACTIVITY_STATE/com.sec.android.app.launcher/resume]
I/ActivityManager(  808): RTCC_TRIGGER_MSG, ASYNC.
D/SurfaceWidgetClient$ISurfaceWidgetStub( 1847): [123491/1] Surface widget visibility changed visibility = true on instance = 1
D/Mms/UIEventReceiver( 9242): ui event
I/Process (12979): Sending signal. PID: 12979 SIG: 9
I/ActivityManager(  808): Process com.xxx.MyApp.Core.MyApp (pid 12979) (adj 11) has died.

my proguard-rules.pro

-optimizationpasses 5
-dontusemixedcaseclassnames


-dontpreverify
-verbose
-optimizations !code/simplification/arithmetic,!field/*,!class/merging/*

-dontwarn android.support.**

-dontwarn com.squareup.okhttp.**
-dontwarn com.qualcomm.**
-dontwarn com.google.android.**
-dontwarn pl.droidsonroids.**
-dontwarn okio.Okio.**
-dontwarn java.nio.file.**
-dontwarn org.codehaus.**

-dontwarn org.mockito.**
-dontwarn sun.reflect.**
-dontwarn android.test.**
-dontwarn com.facebook.**
-dontwarn com.jwetherell.**
#-dontwarn android.support.v4.**

-libraryjars  <java.home>/lib/rt.jar

-keep public class * extends android.app.Activity
-keep public class * extends android.app.Application
-keep public class * extends android.app.Service
-keep public class * extends android.content.BroadcastReceiver
-keep public class * extends android.content.ContentProvider
-keep public class * extends android.app.backup.BackupAgentHelper
-keep public class * extends android.preference.Preference
-keep public class com.android.vending.licensing.ILicensingService

-keep public class com.xxx.MyApp.Core.**
-keep public class com.xxx.utils.**
-keep public class com.xxx.security.**

-keepclasseswithmembers class * {
    native <methods>;
}

-keepclasseswithmembers class * {
    public <init>(android.content.Context, android.util.AttributeSet);
}

-keepclasseswithmembers class * {
    public <init>(android.content.Context, android.util.AttributeSet, int);
}

-keepclassmembers enum * {
    public static **[] values();
    public static ** valueOf(java.lang.String);
}

-keep class * implements android.os.Parcelable {
  public static final android.os.Parcelable$Creator *;
}

my guess is that it is because of the java.lang.NoClassDefFoundError: java/util/UUID but i searched for that and added the -libraryjars <java.home>/lib/rt.jar row in the config file, but yet same result.
it seems like it passes the Application section well, but fails when trying to build the Activity - not even getting to onCreate().

any help anyone??

RedHat
  • 167
  • 11

1 Answers1

0

as per this (How to keep/exclude a particular package path when using proguard?) answer you probable can fix it by adding some more rules to your as follows:

-keep public class com.qualcomm.ar.pl.** {
  public protected *;
}

-keep public class javax.crypto.spec.** {
  public protected *;
}

also check here for some qualcomm forums on the same error https://developer.vuforia.com/forum/android/proguard-problems-release-version-android-market

Community
  • 1
  • 1
Budius
  • 39,391
  • 16
  • 102
  • 144
  • thanks for the quick reply! i made the changes as you shown and suggesged, but i still get the `java.lang.NoClassDefFoundError: java/util/UUID` exception – RedHat Apr 06 '16 at 14:27
  • ProGuard is not my specially, but it seems you should also add the same lines for the `java.util.UUID`. That's what the exceptions `NoClassDefFoundError` and `ClassNotFoundException` means, that it couldn't find the class, so it means, ProGuard removed those classes, so you should add rules to keep them. – Budius Apr 06 '16 at 14:28