Warning: file_get_contents(/data/phpspider/zhask/data//catemap/3/android/184.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Android 禁用即时运行时未加载应用程序类_Android_Android Studio_Android Gradle Plugin_Android Instant Run - Fatal编程技术网

Android 禁用即时运行时未加载应用程序类

Android 禁用即时运行时未加载应用程序类,android,android-studio,android-gradle-plugin,android-instant-run,Android,Android Studio,Android Gradle Plugin,Android Instant Run,我正在做一个示例项目,在这个项目中,我同时使用google play服务和FireBase来实现位置和FCM 我正在使用android studio 2.1.1和gradle:2.1.0 所以我得到的原始版本是: java.lang.NoClassDefFoundError:解析失败: Lcom/android/tools/fd/runtime/AppInfo 在 BootstrapApplication.(BootstrapApplication.java:126) 为此,我找到了禁用inst

我正在做一个示例项目,在这个项目中,我同时使用google play服务和FireBase来实现位置和FCM

我正在使用android studio 2.1.1和gradle:2.1.0

所以我得到的原始版本是:

java.lang.NoClassDefFoundError:解析失败: Lcom/android/tools/fd/runtime/AppInfo
在 BootstrapApplication.(BootstrapApplication.java:126)

为此,我找到了禁用instant run的解决方案,于是我就这么做了。 现在我得到了
DexOverflowException
,所以我从依赖项中排除了几个模块,一切都很好。但是现在我的应用程序类中的代码无法工作。未调用应用程序类
onCreate()
方法

万一有人怀疑我是否将应用程序类引用放在清单中,我就放了

<application
    android:name=".HHApplication"
    android:allowBackup="true"
    android:icon="@mipmap/ic_launcher"
    android:label="@string/app_name"
    android:supportsRtl="true"
    android:theme="@style/AppTheme">
这是应用程序
的build.gradle

buildscript {
    repositories {
        jcenter()
    }

    dependencies {
        classpath 'com.android.tools.build:gradle:2.1.0'
        classpath 'com.google.gms:google-services:3.0.0'
        // NOTE: Do not place your application dependencies here; they belong
        // in the individual module build.gradle files
    }
}
apply plugin: 'com.android.application'

android {
    compileSdkVersion 23
    buildToolsVersion "23.0.3"

    defaultConfig {
        applicationId "xxxxxxxxxxx"
        minSdkVersion 14
        targetSdkVersion 23
        versionCode 1
        versionName "1.0"
    }
}

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

    compile 'com.google.code.gson:gson:2.3'
    compile 'com.android.support:appcompat-v7:23.4.0'
    compile 'com.android.support:design:23.4.0'
    compile ('com.google.android.gms:play-services-location:9.0.2') {
        exclude module: 'support-v4'
        exclude module: 'support-annotations'
        exclude module: 'firebase-common'
    }
    compile ('com.google.firebase:firebase-messaging:9.0.0') {
        exclude module: 'play-services-base'
        exclude module: 'play-services-basement'
        exclude module: 'play-services-task'
        exclude module: 'support-v4'
        exclude module: 'support-annotations'
    }
    compile files('libs/android-query.0.26.7.jar')
}

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

我用com.android.tools.build:gradle:2.1.3将studio更新为2.13,将gradle更新为2.14.1,这解决了原来的问题-

java.lang.NoClassDefFoundError:解析失败:Lcom/android/tools/fd/runtime/AppInfo; 位于com.android.tools.fd.runtime.BootstrapApplication.(BootstrapApplication.java:126)


禁用instant run对我仍然不起作用。

我使用com.android.tools将studio更新为2.13,将gradle更新为2.14.1。构建:gradle:2.1.3,这解决了最初的问题-

java.lang.NoClassDefFoundError:解析失败:Lcom/android/tools/fd/runtime/AppInfo; 位于com.android.tools.fd.runtime.BootstrapApplication.(BootstrapApplication.java:126)


禁用instant run对我来说仍然不起作用。

有趣的是,这只会在应用程序第一次运行时发生。之后,应用程序工作正常。你使用的是什么版本的gradle/gradle包装器?您是否尝试过
使缓存无效/重新启动
,然后
清除
项目?好的,我尝试过
使缓存无效/重新启动
清除
,但都不起作用。我正在使用
distributionUrl=https\://services.gradle.org/distributions/gradle-2.10-all.zip
你能用
com.android.tools.build:gradle:2.1.3
和gradle
2.14.1
试试吗?我也试过了,但没用(有趣的是,这只发生在应用程序第一次运行时。之后,该应用程序工作正常。您使用的gradle/gradle包装器的版本是什么?您是否尝试过
使缓存无效/重新启动
,然后
清除
项目?好的,我尝试过
使缓存无效/重新启动
清除
,但都不起作用。我是usi。)ng
distributionUrl=https\://services.gradle.org/distributions/gradle-2.10-all.zip
你能用
com.android.tools.build:gradle:2.1.3
和gradle
2.14.1
试试吗?我也试过了,但没用(