android-studio - Android Studio-导入的库太多,即使它们未在依赖项中进行编译也无法投影

标签 android-studio gradle firebase

我正在使用Firebase创建一个新的Android应用程序。我按照goolge指南将Firebase SDK添加到我的项目中。
以下是我的项目gradle:

buildscript {
    repositories {
        jcenter(){
            url "http://jcenter.bintray.com/"
        }
        mavenCentral()
    }
    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
    }
}

allprojects {
    repositories {
        jcenter()
    }
}

和应用程序build.gradle
....
dependencies {
    compile fileTree(include: ['*.jar'], dir: 'libs')
    /* For Google Play Services */
    //Firebase
    //addd firebase notification - messaging.
    //add firbaes dynamic link:
    compile 'com.android.support:appcompat-v7:23.4.0'
    compile 'com.android.support:design:23.4.0'
    compile 'com.android.support:support-v4:23.4.0'
    compile 'com.android.support:cardview-v7:23.4.0'
    compile 'com.google.android.gms:play-services-safetynet:9.0.2'
    compile 'com.google.android.gms:play-services-auth:9.0.2'
    compile 'com.firebaseui:firebase-ui:0.2.2'
    compile 'com.google.firebase:firebase-messaging:9.0.2'
    compile 'com.google.firebase:firebase-invites:9.0.2'
    compile 'com.google.android.gms:play-services:9.0.2'
}
// ADD THIS AT THE BOTTOM
apply plugin: 'com.google.gms.google-services'

我 checkin 了我的项目的外部库。我不需要太多的库,例如:play-service-location-9.0.2,play-service-maps-9.0.2,play-service--nearby-9.0.2 ...
enter image description here

您能解释一下并帮助我减少未添加到项目中的未使用的库吗?

最佳答案

尝试通过从build.gradle逐个删除依赖项来删除不需要的依赖项,如果在删除其中一个依赖项后出现错误,请添加刚刚删除的依赖项。

只要在删除不需要的依赖项时没有任何错误或问题,一切都会好起来的。

关于android-studio - Android Studio-导入的库太多,即使它们未在依赖项中进行编译也无法投影,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/37832459/

相关文章:

java - 基本 Activity 抽象类方法不在其他 Activity 中执行

java - Android Studio Apply Changes非静态方法无法引用,但方法是静态的

java - 在 NetBeans IDE 中使用 gradle 和 tomcat 运行多个 war

android - 如何检查Android应用程序中依赖项的大小?

android - 在 Android Studio 中用 C++ 编写应用程序?

java - 尝试运行 Weld Se 应用程序时出错 - 无法初始化 Weld SE 容器 - 找不到 bean 文件

android - 如何解决flutter中 'Object of type XXXXX is not registered inside GetIt'的问题?

iphone - 使用 Alamofire 检索图像时遇到问题,有些图像加载,有些则不加载 (SWIFT)

android - Crashlytics 需要 Firebase Analytics

android - 我找不到在 Android Studios 项目 View 中显示 lint 错误的方法