在Eclipse到Android工作室:为什么proguard.cfg使用时不会释放建设? [英] From Eclipse to Android Studio: Why is proguard.cfg used when NOT building Release?

查看:248
本文介绍了在Eclipse到Android工作室:为什么proguard.cfg使用时不会释放建设?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

所以,我一直在试图应用迁移多项目的开发(Eclipse项目即是)到Android工作室(V1.1)。

So, I have been trying to migrate the development of a multi-project (eclipse projects that is) app to Android Studio (v1.1).

通过文件导入>导入项目是很容易去无事。

Importing via File > Import Project was really easy and went without incident.

然而,当我试图拨打/重建项目,我遇到了无数的惊喜。第一,不ProGuard的相关,曾与源文件编码(最初在Windows 1252)的事,但我很快就发现用这个的 Windows的1252>刷新> UTF-8>转换答案。

However, when I tried Make/Rebuild project I encountered numerous surprises. The first, not Proguard-related, had to do with source file encoding (originally in Windows-1252), but I quickly found a solution using this Windows-1252 > Reload > UTF-8 > Convert answer.

那么,错误:无法找到符号类为 com.comp.mod.X 类矿井。然后,我通过访问模块(Android Studio中的模块就是previously Eclipse项目),其中包含该类解决它,并添加到其 proguard.cfg 以下内容:

Then, "error: cannot find symbol class" for a com.comp.mod.X class of mine. I then solved it by going to the module (Android Studio module that is, previously an Eclipse project) that contains that class and added to its proguard.cfg the following:

-keep public class com.comp.mod.X

这给我留下了一个错误:无法找到符号变量在上述类中定义一个const BB。我通过添加解决了这个相同的 proguard.cfg 以下内容:

-keepclassmembers class com.comp.mod.X {
    public static final boolean BB;
}

这给我留下了只有一个错误:无法找到符号方法来获取preferenceX()。我解决这个问题,加入到同一个 -keepclassmembers 的方法,使上述现在看起来:

That left me with only one "error: cannot find symbol method getPreferenceX()". I solve this by adding to the same -keepclassmembers that method, so that the above now looks:

-keepclassmembers class com.comp.mod.X {
    public static final boolean BB;
    public static java.lang.String getPreferenceX();
}

我想我做的,但我失望的是,当我试图重建项目,我在该项目得到来自其他模块的许多额外的错误,所有类型为错误:无法找到符号类/变量/方法和相关的一些 proguard.cfg

我还可以继续屠杀为每一个模块,但在这一点上,我开始怀疑我在做某种根本性错误的proguard.cfg文件,因为这些文件proguard.cfg在Eclipse的工作完美。因此,

I could have continued butchering the proguard.cfg files for each and every module but at this point I am beginning to suspect that I am doing something fundamentally wrong, because those proguard.cfg files work perfectly under Eclipse. So,


  1. 为什么突然之间,这些都不再是很好的为Android工作室?

  2. 如果 ProGuard的,当你建立的发布您的应用程序只能运行模式,为什么是Android工作室基于构建抱怨无法找到符号由于Proguard的的混淆?

我是什么失踪?

注意:我的不可以未遂生成APK签名。我所要做的就是重建工程。

Note: I have not attempted "Generate Signed APK". All I do is "Rebuild Project".

推荐答案

目前(截至2015年4月24日), minifyEnabled 的默认值所有生成类型是不正确的多模块的项目,其中一些模块(包括应用程序)是的依赖的其它模块。这是由于 BUG#52962 导致构建类型的不可以传播到库 - 他们总是建成RELEASE

Currently (as of 2015-04-24), minifyEnabled's default value of false for all build types is incorrect for multi-module projects, in which some modules (app included) are dependent on other modules. This is due to bug #52962 that causes build types to not propagate to libraries -- they are always built as RELEASE.

建议来解决此bug或者其修复的通知是最欢迎的。

Suggestions to work around this bug or notifications of its fix are most welcome.

这篇关于在Eclipse到Android工作室:为什么proguard.cfg使用时不会释放建设?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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