IntelliJ IDEA的Andr​​oid的项目,包括在APK未watned文件 [英] IntelliJ Idea Android Projects including un-watned files in apk

查看:320
本文介绍了IntelliJ IDEA的Andr​​oid的项目,包括在APK未watned文件的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个复杂的应用程序结构,主要项目有哪些有自己的Andr​​oid库和jar文件的android库。

I have a complex app structure, main project has android libraries which have their own android libraries and jars.

主项目

  • 利布斯
    • 的Andr​​oid库项目中
      • 的Andr​​oid库为项目B
      • Libs
        • Android Lib project A
          • Jars
          • Android Lib project B

          有关澄清,我有一个Android库项目,有一个ActionBarSherlock依赖和Facebook的依赖,我使用了一些类似的应用程序之间的库项目。

          For clarification I have an android library project which has an ActionBarSherlock dependency and Facebook dependency, I use this library project between a few similar apps.

          在过去,我能够只添加库的依赖关系,它会只建了Android相关的文件(SRC / RES),但现在它的一切,包括在路径(测试,文档,例如文件夹,网站)。

          In the past I was able to just add the libraries as dependencies and it would build only the android related files (src/res) but now it is including everything in the path (tests, docs, example folders, websites).

          我不知道是什么改变了,但我的apk现在被塞满了大量的文件,我不想要的,我不知道在哪里指定不包括它们。

          I'm not sure what changed but my apks are now being stuffed with a lot of files I don't want and I'm not sure where to specify to not include them.

          请注意:我之所以不能只是删除的无用文件是因为我克隆下来的回购与子模块

          note: The reason why I can't just "remove" the unwanted files is because I'm cloning down the repos with submodules.

          我用的IntelliJ IDEA 11.1.2和Android R20

          I'm using IntelliJ Idea 11.1.2 and android r20

          更新: 这里的问题是我有一个样本项目: HTTP://dl.dropbox。 COM / U / 713581 / TestDependency.zip

          Update: Here is a sample project of the problem I'm having: http://dl.dropbox.com/u/713581/TestDependency.zip

          推荐答案

          这是因为你保持你的模块中指定的目录默认情况下是专为本地库(通常的.so 文件)。构建项目时从目录中包含的目标的所有文件 APK 文件。

          This happens because you keep your modules in the directory named libs which is by default designed for the native libraries (usually .so files). When building the project all the files from the libs directory are included in the target apk file.

          要解决这个问题,去到项目结构,选择测试依赖模块,打开机器人面设置,更改本机库目录设置为其他路径(如库_ 而不是)。重复同样的 TESTLIB 模块,重新生成项目。现在,最后的 APK 尺寸〜486KB和文件从文件夹不包括在内。

          To fix the problem go to the Project Structure, select Test Dependency module, open Android facet settings, change Native libs directory setting to some other path (like libs_ instead of libs). Repeat the same for the TestLib module, rebuild the project. Now the final apk size is ~486KB and files from libs folders are not included.

          这篇关于IntelliJ IDEA的Andr​​oid的项目,包括在APK未watned文件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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