MultiDexApplication无法识别 [英] MultiDexApplication not recognized

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

问题描述



这是我的build.gradle文件:

  apply plugin:'com.android.application'

android {
compileSdkVersion 21
buildToolsVersion '21 .0.1'
defaultConfig {
applicationId'com.myapp'
minSdkVersion 10
targetSdkVersion 21
versionCode 115
versionName '4.8'
}

buildTypes {
debug {
debuggable true
runProguard false
proguardFiles getDefaultProguardFile('proguard-android.txt' ),'proguard-rules.pro'
}
release {
debuggable false
runProguard true
zipAlign true
proguardFiles getDefaultProguardFile('proguard-android。 txt'),'pr oguard-rules.pro'
}
}

packagingOptions {
排除'META-INF / LICENSE.txt'
排除'META-INF / NOTICE.txt'
}

lintOptions {
checkReleaseBuilds false
}
}

依赖关系{
编译fileTree(dir:'libs',include:['* .jar'])

编译'com.google.android.gms:play-services:6.1.11'

compile'c​​om.android.support:appcompat-v7:21.0.0'

compile'c​​om.nineoldandroids:library:2.4.0'
compile'c​​om.viewpagerindicator:library: 2.4.1@aar'
编译项目(':facebook')
}



<您可以看到,我正在编译21,使用最新的编译工具,以及最新的Google Play服务和支持库。



有没有人得到这个工作?

解决方案

MultiDexApplication类不属于appcompat-v7 l ibrary。它是在一个单独的jar(称为android-support-multidex)中发布的。



找到 android-support-multidex.jar 强大的/sdk/extras/Android/support/multidex/library/ibs (可从支持库的第21版获得)并将其复制到项目的 libs 文件夹中。 b
$ b

更新(2014年11月5日)

该jar现已在中央存储库中提供:

 依赖关系{
...
compile'c​​om.android.support:multidex:1.0.0'
}

有关更多信息,请参阅这里


Trying to use MultiDexApplication in my app, but the class is not recognized when I try to extend my application activity with it.

Here is my build.gradle file:

apply plugin: 'com.android.application'

android {
    compileSdkVersion 21
    buildToolsVersion '21.0.1'
    defaultConfig {
        applicationId 'com.myapp'
        minSdkVersion 10
        targetSdkVersion 21
        versionCode 115
        versionName '4.8'
    }

    buildTypes {
        debug {
            debuggable true
            runProguard false
            proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
        }
        release {
            debuggable false
            runProguard true
            zipAlign true
            proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
        }
    }

    packagingOptions {
        exclude 'META-INF/LICENSE.txt'
        exclude 'META-INF/NOTICE.txt'
    }

    lintOptions {
        checkReleaseBuilds false
    }
}

dependencies {
    compile fileTree(dir: 'libs', include: ['*.jar'])

    compile 'com.google.android.gms:play-services:6.1.11'

    compile 'com.android.support:appcompat-v7:21.0.0'

    compile 'com.nineoldandroids:library:2.4.0'
    compile 'com.viewpagerindicator:library:2.4.1@aar'
    compile project(':facebook')
}

You can see that I'm compiling on 21, using the latest build tools, and the latest google play services and support library.

Has anyone gotten this to work?

解决方案

MultiDexApplication class is not part of appcompat-v7 library. It is being shipped in a separate jar (called android-support-multidex).

Find the android-support-multidex.jar under /sdk/extras/android/support/multidex/library/libs (available from revision 21 of support library) and copy it to your project's libs folder.

Update (11/5/2014):
The jar is now available in central repository:

dependencies {
  ...
  compile 'com.android.support:multidex:1.0.0'
}

For more info, see here.

这篇关于MultiDexApplication无法识别的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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