gpt4 book ai didi

安卓 : Application crashes after its configured using progurad

转载 作者:行者123 更新时间:2023-11-29 02:00:49 29 4
gpt4 key购买 nike

我刚刚开发了我的应用程序并想发布,但在此之前我想删除日志和其他不必要的东西。我发现最好的方法是使用 Proguard .我正在使用命令行,所以我使用命令 ant release我的应用程序构建成功,在/bin 目录中生成的新 apk 文件是 <app-name>-release.apk .我在我的设备中安装了该 apk,但在几个屏幕之后它崩溃了,当我尝试重新启动我的应用程序并移动到其他选项卡时,它在某些时候崩溃了。

不知道为什么会这样。所以这是我的 project.properties 的内容文件 target=android-15
proguard.config=proguard-project.txt

这是我的 proguard-project.txt

-optimizationpasses 5
-dontusemixedcaseclassnames
-dontskipnonpubliclibraryclasses
-dontpreverify
-verbose
-optimizations !code/simplification/arithmetic,!field/*,!class/merging/*
-libraryjars smack.jar
-libraryjars libphonenumber-5.0v1.5.jar
#-keep class com.** { *; }
#-keep class org.** { *; }

-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

-keepclasseswithmembernames 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 class * extends android.app.Activity {
public void *(android.view.View);
}

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

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

错误日志:

10-08 07:25:18.356: E/AndroidRuntime(1733): FATAL EXCEPTION: Contact_sync_Service
10-08 07:25:18.356: E/AndroidRuntime(1733): java.lang.NoClassDefFoundError: com.google.i18n.phonenumbers.PhoneNumberUtil
10-08 07:25:18.356: E/AndroidRuntime(1733): at org.sipchat.sipua.ui.ai.run(Unknown
Source)
10-08 07:25:18.356: E/AndroidRuntime(1733): at java.lang.Thread.run(Thread.java:856)
10-08 07:26:26.756: E/dalvikvm(1751): Could not find class 'org.jivesoftware.smack.filter.MessageTypeFilter', referenced from method org.sipchat.sipua.ui.ConnectionService.a
10-08 07:26:26.786: E/dalvikvm(1751): Could not find class 'org.jivesoftware.smack.ConnectionConfiguration', referenced from method org.sipchat.sipua.ui.ConnectionService.onStartCommand
10-08 07:26:26.806: E/dalvikvm(1751): Could not find class 'org.jivesoftware.smack.ConnectionConfiguration', referenced from method org.sipchat.sipua.ui.af.run
10-08 07:26:26.956: E/AndroidRuntime(1751): FATAL EXCEPTION: main
10-08 07:26:26.956: E/AndroidRuntime(1751): java.lang.NoClassDefFoundError: org.jivesoftware.smack.ConnectionConfiguration
10-08 07:26:26.956: E/AndroidRuntime(1751): at org.sipchat.sipua.ui.ConnectionService.onStartCommand(Unknown Source)
10-08 07:26:26.956: E/AndroidRuntime(1751): at android.app.ActivityThread.handleServiceArgs(ActivityThread.java:2359)
10-08 07:26:26.956: E/AndroidRuntime(1751): at android.app.ActivityThread.access$1900(ActivityThread.java:123)
10-08 07:26:26.956: E/AndroidRuntime(1751): at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1210)
10-08 07:26:26.956: E/AndroidRuntime(1751): at android.os.Handler.dispatchMessage(Handler.java:99)
10-08 07:26:26.956: E/AndroidRuntime(1751): at android.os.Looper.loop(Looper.java:137)
10-08 07:26:26.956: E/AndroidRuntime(1751): at android.app.ActivityThread.main(ActivityThread.java:4424)
10-08 07:26:26.956: E/AndroidRuntime(1751): at java.lang.reflect.Method.invokeNative(Native Method)
10-08 07:26:26.956: E/AndroidRuntime(1751): at java.lang.reflect.Method.invoke(Method.java:511)
10-08 07:26:26.956: E/AndroidRuntime(1751): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:784)
10-08 07:26:26.956: E/AndroidRuntime(1751): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:551)
10-08 07:26:26.956: E/AndroidRuntime(1751): at dalvik.system.NativeStart.main(Native Method)

更新:

报错的包是我在proguard-project.txt中已经添加的jar文件包

如果我哪里出错了,请告诉我清楚吗?
谢谢

最佳答案

您试过 Dexguard 了吗?正如proguard网站上所说

ProGuard now has a sibling optimizer and obfuscator for Android: DexGuard. It is compatible with ProGuard, and it provides additional features like string encryption, class encryption, and hiding access to sensitive APIs. It directly targets Dalvik bytecode and streamlines the Android build process.

http://www.saikoa.com/dexguard

关于安卓 : Application crashes after its configured using progurad,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/12776300/

29 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com