Android - MultiDex安装 [英] Android - MultiDex Install

查看:246
本文介绍了Android - MultiDex安装的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

通过导入外部库,我已经超过了65k方法限制。我已经启用ProGuard,但仍然收到相同的错误。

I have exceeded the 65k method limit, by importing an external library. I have enabled ProGuard, but still get the same error.

[2015-01-12 15:13:39 - Dex Loader] Unable to execute dex: method ID not in [0, 0xffff]: 65536
[2015-01-12 15:13:39 - MyFirstGame] Conversion to Dalvik format failed: Unable to execute dex: method ID not in [0, 0xffff]: 65536

阅读官方Google文档后,似乎应该配置MultiDex支持。我使用Eclipse Indigo IDE构建我的项目,没有build.gradle文件。使用SDK管理器我已经安装了Android支持资源库第11版和Android支持库修订版21.0.3。我已经添加了

After reading the official Google documentation, it seems I should configure a MultiDex support. I am building my project using the Eclipse Indigo IDE, and do not have a build.gradle file. Using the SDK Manager I have installed 'Android Support Repository' Rev. 11 and 'Android Support Library' Rev. 21.0.3. I have added the

android:name="android.support.multidex.MultiDexApplication"

属性到我的清单文件,现在正在尝试实现

attribute to my manifest file, and am now trying to implement

@Override
    protected void attachBaseContext(Context newBase) {
        super.attachBaseContext(newBase);
        MultiDex.install(this);
    }

但是,MultiDex类无法解析。根据Google官方文档,该jar应该位于/ extras / android / support / multidex / / support / directory下没有/ multidex /目录。

However, the 'MultiDex' class cannot be resolved. According to the Official Google Documentation, this jar should be located /extras/android/support/multidex/ There is no /multidex/ directory under the /support/ directory.

如何下​​载和安装MulitDex支持库?

How might I download and install the MulitDex Support Library?

推荐答案


使用SDK管理器我已经安装了Android支持资源库Rev. 11

Using the SDK Manager I have installed 'Android Support Repository' Rev. 11

这是为开发人员使用Android Studio或其他使用Gradle for Android的工具。它的内容不会被标准的Eclipse使用。

That is for developers using Android Studio or other tools that use Gradle for Android. Its contents will not be presently used by standard Eclipse.


根据官方Google文档,该jar应该位于/ extras / android /支持/ multidex /

According to the Official Google Documentation, this jar should be located /extras/android/support/multidex/

尝试以下方法之一:


  1. 按照添加说明使用资源的支持库,使用< sdk> / extras / android / support / multidex / library /

复制< sdk> /extras/android/support/multidex/library/libs/android-support-multidex.jar JAR到你的项目的 libs / 目录(由于上述的Android库项目似乎只包含这个JAR,没有别的)

Copy the <sdk>/extras/android/support/multidex/library/libs/android-support-multidex.jar JAR into your project's libs/ directory (since the aforementioned Android library project seems to only contain this JAR and nothing else)

不要同时做这两个。一个或另一个。

Do not do both. Do one or the other.

更新

这是一个截图< sdk> / extras / android / support / ,显示 multidex / 文档说的应该是:

Here is a screenshot of my <sdk>/extras/android/support/, showing multidex/ right where the docs say it should be:

这篇关于Android - MultiDex安装的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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