当我使用jsoup构建签名的APK时,应用程序崩溃了 [英] App crashed when i build a signed APK with jsoup

查看:81
本文介绍了当我使用jsoup构建签名的APK时,应用程序崩溃了的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

当我构建签名的apk时,我的android应用程序崩溃了.我进行调试时看不到崩溃. build.gradle文件是这样的:

My android app was crashing when i build a signed apk. The crash was not seen when i did a debug build. The build.gradle file is like this:

buildTypes {
       release {
          minifyEnabled true
          proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
          signingConfig signingConfigs.config
    }
    debug {
        debuggable true
    }
}

推荐答案

minifyEnabled设置为false并不是正确的解决方案,在构建发行版本时会禁用proguard

setting minifyEnabled to false is not the correct solution, that would disable proguard while building the release version

设置minifyEnabled起作用的原因是因为proguard可能混淆了jsoup. 因此,您应该将minifyEnabled保留为true,并在proguard-rules.txt文件中包含这些jsoup规则,以防止应用崩溃:

The reason why setting minifyEnabled is working is because proguard might be obfuscating jsoup. So, you should keep minifyEnabled as true and include these rules for jsoup in your proguard-rules.txt file to prevent the app from crashing :

-keep public class org.jsoup.** {
    public *;
}

这篇关于当我使用jsoup构建签名的APK时,应用程序崩溃了的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆