将Google Play服务与Firebase

时间:2016-05-29 18:03:21

标签: android google-maps firebase maps google-play-services

我很快就这样做了,请帮助我。

当我将Firebase添加到我的应用程序时出现了这些错误,该应用程序已经有Google地图并且运行良好:

Information:Gradle tasks [:app:clean, :app:generateDebugSources, :app:generateDebugAndroidTestSources, :app:mockableAndroidJar, :app:prepareDebugUnitTestDependencies, :app:assembleDebug]
:app:clean
:app:buildInfoDebugLoader
:app:preBuild UP-TO-DATE
:app:preDebugBuild UP-TO-DATE
:app:checkDebugManifest
:app:preReleaseBuild UP-TO-DATE
:app:prepareComAndroidSupportAnimatedVectorDrawable2340Library
:app:prepareComAndroidSupportAppcompatV72340Library
:app:prepareComAndroidSupportConstraintConstraintLayout100Alpha1Library
:app:prepareComAndroidSupportDesign2340Library
:app:prepareComAndroidSupportMediarouterV72300Library
:app:prepareComAndroidSupportMultidex101Library
:app:prepareComAndroidSupportRecyclerviewV72340Library
:app:prepareComAndroidSupportSupportV42340Library
:app:prepareComAndroidSupportSupportVectorDrawable2340Library
:app:prepareComGoogleAndroidGmsPlayServices900Library
:app:prepareComGoogleAndroidGmsPlayServicesAds900Library
:app:prepareComGoogleAndroidGmsPlayServicesAdsLite900Library
:app:prepareComGoogleAndroidGmsPlayServicesAnalytics900Library
:app:prepareComGoogleAndroidGmsPlayServicesAnalyticsImpl900Library
:app:prepareComGoogleAndroidGmsPlayServicesAppindexing900Library
:app:prepareComGoogleAndroidGmsPlayServicesAppinvite900Library
:app:prepareComGoogleAndroidGmsPlayServicesAuth900Library
:app:prepareComGoogleAndroidGmsPlayServicesAuthBase900Library
:app:prepareComGoogleAndroidGmsPlayServicesBase900Library
:app:prepareComGoogleAndroidGmsPlayServicesBasement900Library
:app:prepareComGoogleAndroidGmsPlayServicesCast900Library
:app:prepareComGoogleAndroidGmsPlayServicesDrive900Library
:app:prepareComGoogleAndroidGmsPlayServicesFitness900Library
:app:prepareComGoogleAndroidGmsPlayServicesGames900Library
:app:prepareComGoogleAndroidGmsPlayServicesGcm900Library
:app:prepareComGoogleAndroidGmsPlayServicesIdentity900Library
:app:prepareComGoogleAndroidGmsPlayServicesIid900Library
:app:prepareComGoogleAndroidGmsPlayServicesLocation900Library
:app:prepareComGoogleAndroidGmsPlayServicesMaps900Library
:app:prepareComGoogleAndroidGmsPlayServicesNearby900Library
:app:prepareComGoogleAndroidGmsPlayServicesPanorama900Library
:app:prepareComGoogleAndroidGmsPlayServicesPlus900Library
:app:prepareComGoogleAndroidGmsPlayServicesSafetynet900Library
:app:prepareComGoogleAndroidGmsPlayServicesTagmanager900Library
:app:prepareComGoogleAndroidGmsPlayServicesTagmanagerApi900Library
:app:prepareComGoogleAndroidGmsPlayServicesTasks900Library
:app:prepareComGoogleAndroidGmsPlayServicesVision900Library
:app:prepareComGoogleAndroidGmsPlayServicesWallet900Library
:app:prepareComGoogleAndroidGmsPlayServicesWearable900Library
:app:prepareComGoogleFirebaseFirebaseAnalytics900Library
:app:prepareComGoogleFirebaseFirebaseAnalyticsImpl900Library
:app:prepareComGoogleFirebaseFirebaseAuth900Library
:app:prepareComGoogleFirebaseFirebaseAuthCommon900Library
:app:prepareComGoogleFirebaseFirebaseAuthModule900Library
:app:prepareComGoogleFirebaseFirebaseCommon900Library
:app:prepareComGoogleFirebaseFirebaseConfig900Library
:app:prepareComGoogleFirebaseFirebaseCrash900Library
:app:prepareComGoogleFirebaseFirebaseDatabase900Library
:app:prepareComGoogleFirebaseFirebaseDatabaseConnection900Library
:app:prepareComGoogleFirebaseFirebaseIid900Library
:app:prepareComGoogleFirebaseFirebaseMessaging900Library
:app:prepareComGoogleFirebaseFirebaseStorage900Library
:app:prepareComGoogleFirebaseFirebaseStorageCommon900Library
:app:prepareDebugDependencies
:app:compileDebugAidl
:app:compileDebugRenderscript
:app:generateDebugBuildConfig
:app:mergeDebugShaders
:app:compileDebugShaders
:app:generateDebugAssets
:app:mergeDebugAssets
:app:generateDebugResValues
:app:generateDebugResources
:app:mergeDebugResources
:app:processDebugManifest
:app:processDebugResources
:app:generateDebugSources
:app:preDebugAndroidTestBuild UP-TO-DATE
:app:prepareComAndroidSupportTestEspressoEspressoCore222Library
:app:prepareComAndroidSupportTestEspressoEspressoIdlingResource222Library
:app:prepareComAndroidSupportTestExposedInstrumentationApiPublish05Library
:app:prepareComAndroidSupportTestRules05Library
:app:prepareComAndroidSupportTestRunner05Library
:app:prepareDebugAndroidTestDependencies
:app:compileDebugAndroidTestAidl
:app:processDebugAndroidTestManifest
:app:compileDebugAndroidTestRenderscript
:app:generateDebugAndroidTestBuildConfig
:app:mergeDebugAndroidTestShaders
:app:compileDebugAndroidTestShaders
:app:generateDebugAndroidTestAssets
:app:mergeDebugAndroidTestAssets
:app:generateDebugAndroidTestResValues
:app:generateDebugAndroidTestResources
:app:mergeDebugAndroidTestResources
:app:processDebugAndroidTestResources
:app:generateDebugAndroidTestSources
:app:mockableAndroidJar UP-TO-DATE
:app:preDebugUnitTestBuild UP-TO-DATE
:app:prepareDebugUnitTestDependencies
:app:incrementalDebugJavaCompilationSafeguard
:app:compileDebugJavaWithJavac
:app:compileDebugJavaWithJavac - is not incremental (e.g. outputs have changed, no previous execution, etc.).
:app:compileDebugNdk UP-TO-DATE
:app:compileDebugSources
:app:transformClassesWithExtractJarsForDebug
:app:transformClassesWithInstantRunVerifierForDebug
:app:transformClassesWithJavaResourcesVerifierForDebug
:app:mergeDebugJniLibFolders
:app:transformNative_libsWithMergeJniLibsForDebug
:app:processDebugJavaRes UP-TO-DATE
:app:transformResourcesWithMergeJavaResForDebug
:app:transformResourcesAndNative_libsWithJavaResourcesVerifierForDebug UP-TO-DATE
:app:transformClassesWithInstantRunForDebug
:app:transformClasses_enhancedWithInstant+reloadDexForDebug UP-TO-DATE
:app:incrementalDebugTasks
:app:prePackageMarkerForDebug
:app:fastDeployDebugExtractor
:app:generateDebugInstantRunAppInfo
:app:transformClassesWithDexForDebug
Running dex as a separate process.
To run dex in process, the Gradle daemon needs a larger heap.
It currently has approximately 1433 MB.
For faster builds, increase the maximum heap size for the Gradle daemon to more than 1536 MB.
To do this set org.gradle.jvmargs=-Xmx1536M in the project gradle.properties.
For more information see https://docs.gradle.org/current/userguide/build_environment.html
Error:UNEXPECTED TOP-LEVEL ERROR:
Error:java.lang.OutOfMemoryError: Java heap space: failed reallocation of scalar replaced objects
:app:transformClassesWithDexForDebug FAILED
Error:Execution failed for task ':app:transformClassesWithDexForDebug'.
> com.android.build.api.transform.TransformException: com.android.ide.common.process.ProcessException: java.util.concurrent.ExecutionException: java.lang.UnsupportedOperationException
Information:BUILD FAILED
Information:Total time: 14 mins 26.008 secs
Information:3 errors
Information:0 warnings
Information:See complete output in console

我的build.gradle是:

apply plugin: 'com.android.application'

android {
    compileSdkVersion 23
    buildToolsVersion "23.0.2"
    defaultConfig {
        applicationId "petersamir.elmasna3"
        minSdkVersion 14
        targetSdkVersion 23
        versionCode 1
        versionName "1.0"
        testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
    }
    buildTypes {
        release {
            minifyEnabled false
            multiDexEnabled true
            proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
        }
    }
    packagingOptions {
        exclude 'META-INF/LICENSE'
        exclude 'META-INF/LICENSE-FIREBASE.txt'
        exclude 'META-INF/NOTICE'

    }
}

dependencies {
    compile fileTree(dir: 'libs', include: ['*.jar'])
    compile 'com.android.support:appcompat-v7:23.4.0'
    compile 'com.android.support.constraint:constraint-layout:1.0.0-alpha1'
    compile 'com.google.android.gms:play-services:9.0.0'
    compile 'com.firebase:firebase-client-android:2.4.0'
    compile 'com.android.support:design:23.4.0'
    testCompile 'junit:junit:4.12'
    androidTestCompile 'com.android.support.test.espresso:espresso-core:2.2.2'
    androidTestCompile 'com.android.support.test:runner:0.5'
    androidTestCompile 'com.android.support:support-annotations:23.4.0'
    compile 'com.android.support:multidex:1.0.1'
}

我的清单文件是:

<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
    package="petersamir.elmasna3">

    <!--
         The ACCESS_COARSE/FINE_LOCATION permissions are not required to use
         Google Maps Android API v2, but you must specify either coarse or fine
         location permissions for the 'MyLocation' functionality.
    -->
    <uses-permission android:name="android.permission.ACCESS_FINE_LOCATION" />
    <uses-permission android:name="android.permission.INTERNET" />

    <application
        android:allowBackup="true"
        android:icon="@mipmap/ic_launcher"
        android:label="@string/app_name"
        android:supportsRtl="true"
        android:theme="@style/AppTheme"
        android:name="android.support.multidex.MultiDexApplication">
        <activity android:name=".MainActivity">
            <intent-filter>
                <action android:name="android.intent.action.MAIN" />

                <category android:name="android.intent.category.DEFAULT" />
            </intent-filter>
        </activity>
        <!--
             The API key for Google Maps-based APIs is defined as a string resource.
             (See the file "res/values/google_maps_api.xml").
             Note that the API key is linked to the encryption key used to sign the APK.
             You need a different API key for each encryption key, including the release key that is used to
             sign the APK for publishing.
             You can define the keys for the debug and release targets in src/debug/ and src/release/.
        -->
        <meta-data
            android:name="com.google.android.geo.API_KEY"
            android:value="@string/google_maps_key" />

        <activity
            android:name=".MapsActivity"
            android:label="@string/title_activity_maps">
            <meta-data
                android:name="android.support.PARENT_ACTIVITY"
                android:value="petersamir.elmasna3.MainActivity" />
        </activity>
        <activity android:name=".SplashActivity">
            <intent-filter>
                <action android:name="android.intent.action.MAIN" />

                <category android:name="android.intent.category.LAUNCHER" />
            </intent-filter>
        </activity>
        <activity
            android:name=".EditActivity"
            android:label="@string/title_activity_edit"
            android:theme="@style/AppTheme.NoActionBar"></activity>
    </application>

</manifest>

我很快就这样做了。再次,请帮助我

1 个答案:

答案 0 :(得分:0)

当我删除基本活动附带的设计依赖项时,问题就解决了,而现在的依赖关系是:

oControl