【问题标题】:Application not responding after adding Firebase添加 Firebase 后应用程序没有响应
【发布时间】:2016-06-04 02:26:08
【问题描述】:

我想将 Firebase 集成到我的 Android 应用程序中。当我这样做时,我需要将 com.google.gms.google-services 版本 9 添加到我的应用程序 gradle 中。

在测试了几次并打开我的应用几次后,有时我的应用在启动后没有响应(甚至还没有创建视图)。

因此,我尝试将 com.google.gms.google-services 恢复到 7.5 版,这是我在添加 Firebase 之前使用的版本。然后,我的应用程序就像以前一样正常工作。

这是我的应用程序的 gradle 模块文件(恢复到 gms 版本 7.5 后)

apply plugin: 'com.android.application'
//apply plugin: 'com.google.gms.google-services'

android {
//    compileSdkVersion 23
//    buildToolsVersion '23.0.0'
    compileSdkVersion 22
buildToolsVersion '22.0.0'

defaultConfig {
    applicationId "com.pasarumah.androidapp"
    minSdkVersion 15
    targetSdkVersion 22
    versionCode 7
    versionName "1.6"
    multiDexEnabled true
}

buildTypes {
    release {
        minifyEnabled true
        proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
        zipAlignEnabled true
    }
}

packagingOptions {
    exclude 'META-INF/DEPENDENCIES.txt'
    exclude 'META-INF/LICENSE.txt'
    exclude 'META-INF/NOTICE.txt'
    exclude 'META-INF/NOTICE'
    exclude 'META-INF/LICENSE'
    exclude 'META-INF/DEPENDENCIES'
    exclude 'META-INF/notice.txt'
    exclude 'META-INF/license.txt'
    exclude 'META-INF/dependencies.txt'
    exclude 'META-INF/LGPL2.1'
  }
}

dependencies {
    compile fileTree(dir: 'libs', include: ['*.jar'])
    compile 'com.mcxiaoke.volley:library:1.0.7'
    compile 'org.apache.httpcomponents:httpmime:4.3.5'
//    compile 'com.android.support:support-v4:23.2.0'
    compile 'com.android.support:support-v4:22.2.0'
    compile files('libs/httpcore-4.3.3.jar')
//    compile 'com.google.android.gms:play-services:9.0.0'
    compile 'com.google.android.gms:play-services:7.5.0'
    compile 'com.android.support:multidex:1.0.1'
    compile files('libs/universal-image-loader-1.9.4.jar')
}

我已经搜索过,似乎有人和我有同样的问题: Android app not responding

【问题讨论】:

  • 你还在遇到这个问题吗?

标签: android firebase


【解决方案1】:

你需要这个你的项目成绩

buildscript {
    // ...
    dependencies {
        // ...
        classpath 'com.google.gms:google-services:3.0.0'
    }
}

这在你模块 gradle 的底部

apply plugin: 'com.android.application'

android {
  // ...
}

dependencies {
  // ...
  compile 'com.google.firebase:firebase-core:9.0.2'
}

// ADD THIS AT THE BOTTOM
apply plugin: 'com.google.gms.google-services'

在您的代码中,您的依赖项之后没有应用插件

【讨论】:

  • 我已经完成了你的建议,但我仍然遇到同样的事情。我尝试打开和关闭我的应用几次,但应用仍然没有响应。
猜你喜欢
  • 2021-01-25
  • 1970-01-01
  • 1970-01-01
  • 2020-10-18
  • 1970-01-01
  • 1970-01-01
  • 2020-04-17
  • 1970-01-01
  • 2013-07-18
相关资源
最近更新 更多