Android Proguard - 运行时崩溃(未达到“onCreate()”)

时间:2016-04-06 12:26:47

标签: java android proguard android-proguard

当我在没有Proguard的情况下编译我的应用程序时,它运行完美 当我用Proguard编译它时,它会在构建Activity时在运行时崩溃 我扩展了&已实施Application结构以使用google analytics,并在其开头和结尾添加了日志记录。
两个日志都成功写入日志,但是我试图在Activity的{​​{1}}的初始化时打印的日志从未显示过,而我得到的只是这个logcat输出(我尝试过从不相关的线条中清除,使其不比已经更大。)

Logcat输出: (我的所有日​​志标记都是“ MyLog ”)

onCreate()

我的 proguard-rules.pro

    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.

我的猜测是因为-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 *; } ,但我搜索了它并在配置文件中添加了java.lang.NoClassDefFoundError: java/util/UUID行,但结果却相同。
好像它很好地通过了-libraryjars <java.home>/lib/rt.jar部分,但在尝试构建Application时失败了 - 甚至没有到达Activity

任何帮助任何人?

1 个答案:

答案 0 :(得分:0)

根据这个(How to keep/exclude a particular package path when using proguard?)回答,您可以通过向您添加更多规则来修复它,如下所示:

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

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

同时在这里查看有关同一错误https://developer.vuforia.com/forum/android/proguard-problems-release-version-android-market

的一些高通论坛