首页
学习
活动
专区
工具
TVP
发布
社区首页 >问答首页 >错误:无法将请求的类放入提供主索引列表的单个索引file.Try中。#方法: 72477 > 65536

错误:无法将请求的类放入提供主索引列表的单个索引file.Try中。#方法: 72477 > 65536
EN

Stack Overflow用户
提问于 2018-01-14 20:34:34
回答 13查看 409.9K关注 0票数 435

我想添加融合的位置服务,但它显示了一些错误。帮帮我。

代码语言:javascript
复制
apply plugin: 'com.android.application'

android {
    compileSdkVersion 26
    buildToolsVersion "27.0.1"
    defaultConfig {
        applicationId "com.example.adil.bloodbankapplication"
        minSdkVersion 15
        targetSdkVersion 26
        versionCode 1
        versionName "1.0"
        testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
    }
    buildTypes {
        release {
            minifyEnabled false
            proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
        }
    }
}

dependencies {
    compile fileTree(include: ['*.jar'], dir: 'libs')
    compile 'com.android.support:appcompat-v7:26.1.0'
    compile 'com.android.support.constraint:constraint-layout:1.0.2'
    compile 'com.google.firebase:firebase-auth:11.8.0'
    compile 'com.google.firebase:firebase-database:11.8.0'
    compile 'com.android.support:support-v4:26.1.0'
    compile 'junit:junit:4.12'
    compile 'com.android.support:design:26.1.0'
    compile 'com.github.joielechong:countrycodepicker:2.1.5'
    compile 'com.jaredrummler:material-spinner:1.2.4'
    compile 'hanks.xyz:htextview-library:0.1.5'
    compile 'com.firebaseui:firebase-ui-database:1.2.0'
    compile 'com.google.android.gms:play-services:11.8.0'
}


apply plugin: 'com.google.gms.google-services'
EN

回答 13

Stack Overflow用户

发布于 2018-04-04 16:15:52

他们给你的答案没有一个是详尽的。问题出在Multidex上。您必须在app gradle中添加库:

代码语言:javascript
复制
implementation 'com.android.support:multidex:1.0.3'

之后,添加应用gradle的defaultConfig:

代码语言:javascript
复制
multiDexEnabled true

您的应用程序必须是Multidex类型。您必须将其写入清单中:

代码语言:javascript
复制
android:name=".MyApplication"

"MyApplication“必须是Multidex类,或者必须扩展它。

票数 583
EN

Stack Overflow用户

发布于 2018-12-03 00:46:54

你可以关注this

Android 5.0 (API level 21)之前的平台版本使用Dalvik运行时来执行应用程序代码。默认情况下,Dalvik将应用程序限制为每个APK只有一个classes.dex字节码文件。为了绕过这个限制,您可以将multidex支持库添加到您的项目中:

代码语言:javascript
复制
dependencies {
  implementation 'com.android.support:multidex:1.0.3'
}

如果minSdkVersion设置为21或更高,则只需在模块级build.gradle文件中将multiDexEnabled设置为true,如下所示:

代码语言:javascript
复制
android {
    defaultConfig {
        ...
        minSdkVersion 21 
        targetSdkVersion 28
        multiDexEnabled true
    }
    ...
}
票数 57
EN

Stack Overflow用户

发布于 2018-08-24 00:55:03

在Gradle构建文件中,添加依赖项:

代码语言:javascript
复制
implementation 'com.android.support:multidex:1.0.2'

代码语言:javascript
复制
implementation 'com.android.support:multidex:1.0.3'

代码语言:javascript
复制
implementation 'com.android.support:multidex:2.0.0'

然后在"defaultConfig“部分中添加:

代码语言:javascript
复制
multiDexEnabled true

在targetSdkVersion下

代码语言:javascript
复制
minSdkVersion 17
targetSdkVersion 27
multiDexEnabled true

现在,如果您遇到此错误

错误:无法解析: multidex-instrumentation打开文件

您需要将gradle更改为3.0.1

代码语言:javascript
复制
classpath 'com.android.tools.build:gradle:3.0.1'

并将以下代码放入gradle-wrapper.properties文件中

distributionUrl=https://services.gradle.org/distributions/gradle-4.1-all.zip

最后

在项目中添加类应用,并将其引入到MultiDexApplication扩展的AndroidManifest中

代码语言:javascript
复制
public class App extends MultiDexApplication {

    @Override
    public void onCreate( ) {
        super.onCreate( );
    }
}

首先运行项目以创建错误,然后清除项目

最后,重新启动项目并享受它

票数 17
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/48249633

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档