【问题标题】:separating proguard files in android studio windows 10 failing在android studio windows 10中分离proguard文件失败
【发布时间】:2018-03-02 09:54:04
【问题描述】:

我在Android StudioMac 上创建了一个android 项目。但是,当我尝试在windows 10 中使用android studio 创建一个版本apk 时,似乎不包括proguard 文件。由于应用程序在运行时由于混淆了一些根据我的 proguard 设置应该跳过的类而崩溃。

请注意,此配置在 Mac 环境下运行良好。

初始配置:

    buildTypes {
    release {
        minifyEnabled true
        proguardFile 'proguard-eventbus-3.pro'
        proguardFile 'proguard-acra.pro'
        proguardFile 'proguard-glide.pro'
        proguardFile 'proguard-gson.pro'
        proguardFile 'proguard-square-retrofit2.pro'
        proguardFile 'proguard-project-app.pro'
        testProguardFile 'proguard-project-test.pro'
        proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
    }
}

我还尝试将所有 proguard 文件移动到单个文件夹中并对其进行测试并遇到以下构建错误:

更新配置:

buildTypes {
        release {
            minifyEnabled true
            proguardFiles fileTree(dir: "proguard", include: ["*.pro"]).asList().toArray()
            testProguardFile 'proguard-project-test.pro'
            proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
        }
}

错误:

【问题讨论】:

  • 使用proguardFiles fileTree(dir: 'proguard', include: ['*.pro']).asList().toArray()怎么样?
  • @ישואוהבאותך 请阅读 OP 的第二部分。 更新配置
  • 您应该从我的评论中看到,您更新的配置有所不同。您使用的是",在我的评论中它使用的是'
  • 你检查过你的progaurd规则吗?您可能必须将 -dontwarn 添加到警告类。
  • @ישואוהבאותך 谢谢你是对的。如果您愿意,请将其添加为答案,以便我将其标记为正确答案。谢谢

标签: android android-studio proguard obfuscation


【解决方案1】:

你可以使用:

proguardFiles fileTree(dir: 'proguard', include: ['*.pro']).asList().toArray()

注意'的用法

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2018-09-19
    • 2015-11-26
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多