使用Proguard发行的Android App崩溃

使用Proguard发行的Android App崩溃,第1张

概述创建发行版本时,我的应用程序崩溃.该应用程序运行正常,突然之间发生了这种情况.我在BaseActivity.java MultiDex.install(this)中有这行;我尝试了SO的多种选择,但是没有一个起作用.错误也没有提供足够的详细信息,或者我无法找到发生此问题的位置.任何帮助将不胜感激.这是堆栈跟踪.E/AndroidRuntime: FATAL

创建发行版本时,我的应用程序崩溃.该应用程序运行正常,突然之间发生了这种情况.我在BaseActivity.java MultIDex.install(this)中有这行;我尝试了SO的多种选择,但是没有一个起作用.错误也没有提供足够的详细信息,或者我无法找到发生此问题的位置.任何帮助将不胜感激.

这是堆栈跟踪.

E/AndroIDRuntime: FATAL EXCEPTION: main    Process: com.packagename,PID: 10136    java.lang.VerifyError: VerifIEr rejected class androID.support.multIDex.MultIDex: voID androID.support.multIDex.MultIDex.<init>() Failed to verify: voID androID.support.multIDex.MultIDex.<init>(): [0x0] Constructor returning without calling superclass constructor (declaration of 'androID.support.multIDex.MultIDex' appears in /data/app/com.packagename-4uitso2MKAahWwylc8ZTtA==/base.apk!classes2.dex)        at androID.support.multIDex.MultIDex.install(MultIDex.java:95)        at com.packagename.baseactivity.BaseActivity.attachBaseContext(BaseActivity.java:43)        at androID.app.Application.attach(Application.java:224)        at androID.app.Instrumentation.newApplication(Instrumentation.java:1128)        at androID.app.LoadedApk.makeApplication(LoadedApk.java:1162)        at androID.app.ActivityThread.handleBindApplication(ActivityThread.java:6607)        at androID.app.ActivityThread.access00(ActivityThread.java:268)        at androID.app.ActivityThread$H.handleMessage(ActivityThread.java:1995)        at androID.os.Handler.dispatchMessage(Handler.java:109)        at androID.os.Looper.loop(Looper.java:207)        at androID.app.ActivityThread.main(ActivityThread.java:7539)        at java.lang.reflect.Method.invoke(Native Method)        at com.androID.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:524)        at com.androID.internal.os.ZygoteInit.main(ZygoteInit.java:958)

这是我的build.gradle

apply plugin: 'com.androID.application'androID {    signingConfigs {        release {            keyAlias 'packagename'            keyPassword 'packagename'            storefile file('E:/Projects/packagenamefile')            storePassword 'packagename'        }        deBUG {            keyAlias 'packagename'            keyPassword 'packagename'            storefile file('E:/Projects/packagenamefile')            storePassword 'packagename'        }    }    compileSdkVersion 28    defaultConfig {        applicationID "com.packagename"        minSdkVersion 14        targetSdkVersion 28        versionCode 15        versionname "4.2.3.5"        multIDexEnabled true        manifestPlaceholders = [onesignal_app_ID               : "d4d19a49b4f3b96",// Project number pulled from dashboard,local value is ignored.                                onesignal_Google_project_number: "10977637306"]    }    dexOptions {        javaMaxHeapSize "4g"    }    buildTypes {        release {            multIDexEnabled true            MinifyEnabled true            proguardfiles getDefaultProguardfile('proguard-androID-optimize.txt'),'proguard-rules.pro'            deBUGgable false            jnIDeBUGgable false            signingConfig signingConfigs.release            renderscriptDeBUGgable false            pseudolocalesEnabled false        }        deBUG {            multIDexEnabled true            MinifyEnabled true            proguardfiles getDefaultProguardfile('proguard-androID-optimize.txt'),'proguard-rules.pro'            signingConfig signingConfigs.release        }    }}dependencIEs {    implementation 'com.androID.support.constraint:constraint-layout:1.1.3'    implementation 'com.androID.support:appcompat-v7:28.0.0'    implementation 'com.Google.androID.gms:play-services-maps:16.1.0'    implementation 'com.androID.support:recyclervIEw-v7:28.0.0'    implementation 'com.androID.support:design:28.0.0'    // below 3 libs are for one Signal    implementation 'com.onesignal:Onesignal:3.+@aar'    implementation 'com.Google.androID.gms:play-services-gcm:16.1.0'    implementation 'com.Google.androID.gms:play-services-location:16.0.0'    //SMS auto retrIEver API    implementation "com.Google.androID.gms:play-services-auth:16.0.1"    //firebase analytics    implementation "com.Google.firebase:firebase-core:16.0.8"    //Network calls    implementation 'com.squareup.okhttp3:okhttp:3.12.1'    //pdf Reader    implementation 'com.github.barteksc:androID-pdf-vIEwer:2.4.0'    //for creating demos.    implementation 'uk.co.samuelwall:material-tap-target-prompt:2.0.1'    //displays charts.    implementation project(':MPChartlib')    //Kotlin    implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlin_version"    // sql Cipher    implementation 'net.zetetic:android-database-sqlcipher:4.1.3@aar'}apply plugin: 'com.Google.gms.Google-services'apply plugin: 'kotlin-androID'apply plugin: 'kotlin-android-extensions'

使用Proguard规则更新

# Add project specific ProGuard rules here.# You can control the set of applIEd configuration files using the# proguardfiles setting in build.gradle.## For more details,see#   http://developer.androID.com/guIDe/develoPing/tools/proguard.HTML# If your project uses WebVIEw with Js,uncomment the following# and specify the fully qualifIEd class name to the JavaScript interface# class:#-keepclassmembers class fqcn.of.JavaScript.interface.for.webvIEw {#   public *;#}# Uncomment this to preserve the line number information for# deBUGging stack traces.-keepattributes Sourcefile,lineNumbertable# If you keep the line number information,uncomment this to# hIDe the original source file name.-dontpreverify-repackageclasses ''-allowaccessmodification-optimizations !code/simplification/arithmetic-keepattributes *Annotation*-keepattributes EnclosingMethod-keepattributes InnerClasses-dontwarn org.xmlpull.v1.**-dontwarn androID-support-v4.**-dontwarn  com.crashlytics.**-keep class com.Google.androID.gms.** { *; }-dontwarn com.Google.androID.gms.**-keep public class com.Google.** {*;}-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-keepattributes Signature-keepattributes Sourcefile,lineNumbertable-dontwarn androID.support.v7.**-keep class androID.support.v7.** { *; }-keep interface androID.support.v7.** { *; }-dontwarn androID.support.design.**-keep class androID.support.design.** { *; }-keep interface androID.support.design.** { *; }-keep public class androID.support.design.R$* { *; }-keep class androID.support.design.Widget.** { *; }-keep interface androID.support.design.Widget.** { *; }-dontwarn androID.support.design.**-keep class yourpakganame.itemdecorator-keep public class * extends androID.support.v7.Widget.RecyclerVIEw.Itemdecoration-keep class androID.support.v7.Widget.RecyclerVIEw-assumenosIDeeffects class androID.util.Log{*;}#1 to-assumenosIDeeffects class * implements Interface {    public <init>();    public Object interfacemethod(); # May concern methods with same signature in other Objects}#end-keep class net.sqlcipher.** { *; }-dontwarn net.sqlcipher.**-dontwarn OnesignalSDK.**-dontwarn com.amazon.**-dontwarn  com.crashlytics.**-keep class androID.support.** { *; }-dontnote androID.support.**-dontwarn androID.support.**-keep class com.firebase.** { *; }-keep class org.apache.** { *; }-keepnames class com.fasterxml.jackson.** { *; }-keepnames class javax.servlet.** { *; }-keepnames class org.IEtf.jgss.** { *; }-dontwarn okhttp3.**-dontwarn okio.**-keep class okhttp3.**{ *;}-dontwarn org.apache.**-dontwarn org.w3c.dom.**-dontwarn org.joda.time.**-dontwarn org.shaded.apache.**-keep class com.crashlytics.** { *; }-keep class com.shockwave.**-keepclassmembers class com.shockwave.** { *; }-keep class com.Google.firebase.example.fireeats.model.** { *; }-keepclassmembers class com.getbase.floatingactionbutton.floatingActionsMenu$RotatingDrawable {   voID set*(***);   *** get*();}
最佳答案从here

从您的proguard文件中删除以下几行

#1 to-assumenosIDeeffects class * implements Interface {    public <init>();    public Object interfacemethod(); # May concern methods with same signature in other Objects}#end

并更换

-assumenosIDeeffects class androID.util.Log{*;}

-assumenosIDeeffects class androID.util.Log {   public static *** v(...);   public static *** d(...);   public static *** i(...);   public static *** w(...);   public static *** e(...);   public static *** wtf(...);

} 总结

以上是内存溢出为你收集整理的使用Proguard发行的Android App崩溃 全部内容,希望文章能够帮你解决使用Proguard发行的Android App崩溃 所遇到的程序开发问题。

如果觉得内存溢出网站内容还不错,欢迎将内存溢出网站推荐给程序员好友。

欢迎分享,转载请注明来源:内存溢出

原文地址: http://outofmemory.cn/web/1145079.html

(0)
打赏 微信扫一扫 微信扫一扫 支付宝扫一扫 支付宝扫一扫
上一篇 2022-05-31
下一篇 2022-05-31

发表评论

登录后才能评论

评论列表(0条)

保存