Warning: file_get_contents(/data/phpspider/zhask/data//catemap/3/android/192.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Android 使用ProGuard的某些设备上的本机崩溃_Android_Crash_Android Proguard - Fatal编程技术网

Android 使用ProGuard的某些设备上的本机崩溃

Android 使用ProGuard的某些设备上的本机崩溃,android,crash,android-proguard,Android,Crash,Android Proguard,编辑:对于未来可能遭受同样问题困扰的开发人员,恐怕我没有多大用处。这个问题显然在未来版本的应用程序中自行解决,但我无法确定原因 我一直在通过GooglePlay封闭测试系统测试一个应用程序,使用我的朋友作为测试人员。在使用ProGuard对.apk进行模糊更新之后,两名测试人员开始报告崩溃。这些事故是不可预测的、偶发的,他们无法确定造成这些事故的任何原因或模式。更糟糕的是,我在开发人员控制台中得到的崩溃报告根本不包含任何信息,只是声明“本地崩溃(无可用位置)”,没有堆栈跟踪,甚至没有任何设备信息

编辑:对于未来可能遭受同样问题困扰的开发人员,恐怕我没有多大用处。这个问题显然在未来版本的应用程序中自行解决,但我无法确定原因

我一直在通过GooglePlay封闭测试系统测试一个应用程序,使用我的朋友作为测试人员。在使用ProGuard对.apk进行模糊更新之后,两名测试人员开始报告崩溃。这些事故是不可预测的、偶发的,他们无法确定造成这些事故的任何原因或模式。更糟糕的是,我在开发人员控制台中得到的崩溃报告根本不包含任何信息,只是声明“本地崩溃(无可用位置)”,没有堆栈跟踪,甚至没有任何设备信息

我通过询问测试人员了解设备信息,这两种设备都是索尼手机、Xperia Z3和Xperia Z3 Compact。然而,我也有一个Z3紧凑型可供测试,并且在运行相同的模糊apk时无法再现崩溃。我们也运行相同的操作系统版本

我已经发送了一个测试人员和未混淆的apk,他无法重现运行该版本的崩溃。这一点,以及崩溃首先发生在引入ProGuard模糊处理的补丁之后的事实,使我相信这是原因

首先,我只使用SDK中的默认配置文件运行ProGuard:

# This is a configuration file for ProGuard.
# LINK REMOVED

-dontusemixedcaseclassnames
-dontskipnonpubliclibraryclasses
-verbose

# Optimization is turned off by default. Dex does not like code run
# through the ProGuard optimize and preverify steps (and performs some
# of these optimizations on its own).
-dontoptimize
-dontpreverify
# Note that if you want to enable optimization, you cannot just
# include optimization flags in your own project configuration file;
# instead you will need to point to the
# "proguard-android-optimize.txt" file instead of this one from your
# project.properties file.

-keepattributes *Annotation*
-keep public class com.google.vending.licensing.ILicensingService
-keep public class com.android.vending.licensing.ILicensingService

# For native methods, see LINK REMOVED
-keepclasseswithmembernames class * {
    native <methods>;
}

# keep setters in Views so that animations can still work.
# see http://proguard.sourceforge.net/manual/examples.html#beans
-keepclassmembers public class * extends android.view.View {
   void set*(***);
   *** get*();
}

# We want to keep methods in Activity that could be used in the XML attribute onClick
-keepclassmembers class * extends android.app.Activity {
   public void *(android.view.View);
}

# For enumeration classes, see http://proguard.sourceforge.net/manual/examples.html#enumerations
-keepclassmembers enum * {
    public static **[] values();
    public static ** valueOf(java.lang.String);
}

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

-keepclassmembers class **.R$* {
    public static <fields>;
}

# The support library contains references to newer platform versions.
# Don't warn about those in case this app is linking against an older
# platform version.  We know about them, and they are safe.
-dontwarn android.support.**
这些添加内容的上半部分(带注释)直接来自GooglePlay服务的自述,作为使用该库时添加的建议。其余的部分是我在尝试研究和调试问题时添加的

如果有人注意到我的ProGuard配置中有任何遗漏或其他故障迹象,我很乐意知道。对于如何进一步调试这个问题的任何建议,我也将不胜感激。请记住,在这种情况下,一次只对一个模块进行模糊处理的完整模块测试是不可能的,因为我没有能够重现问题的设备,我不能要求自愿测试人员安装30多个不同版本的.apk并播放,直到它崩溃或确信不会崩溃为止

-keep class * extends java.util.ListResourceBundle {
    protected java.lang.Object[][] getContents();
}

# Keep SafeParcelable value, needed for reflection. This is required to support backwards
# compatibility of some classes.
-keep public class com.google.android.gms.common.internal.safeparcel.SafeParcelable {
    public static final *** NULL;
}

# Keep the names of classes/members we need for client functionality.
-keepnames @com.google.android.gms.common.annotation.KeepName class *
-keepclassmembernames class * {
    @com.google.android.gms.common.annotation.KeepName *;
}

# Needed for Parcelable/SafeParcelable Creators to not get stripped
-keepnames class * implements android.os.Parcelable {
    public static final ** CREATOR;
}

# Needed when building against the Marshmallow SDK
-dontwarn org.apache.http.**

# Needed when building against pre-Marshmallow SDK.
-dontwarn android.security.NetworkSecurityPolicy

-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
-libraryjars D:/Docs/Android/spaceprog/spaceprogr/libs/android-support-v4.jar
-keep class com.viewpagerindicator.** { *; }
-keep class com.google.android.gms.** { *; }
-keep class com.google.example.games.basegameutils.** { *; }
-printmapping out.map
-renamesourcefileattribute SourceFile
-keepattributes SourceFile,LineNumberTable