Android应用:谷歌地图+ Firebase =应用程序崩溃

时间:2017-09-25 00:08:45

标签: android google-maps firebase

  

编辑:我的应用程序现在在模拟器中正常运行。但是,当我在真实设备中运行它时,我得到了同样的错误。它崩溃了。我还添加了一个logcat(见下图)。

我真的无法运行我的应用,因为每当我在程序中添加firebase代码时它总会崩溃。我尝试删除firebase的代码行,应用程序运行正常。

我的应用程序看起来像没有firebase代码行。 enter image description here

现在,使用firebase代码行,它看起来像这样。 enter image description here

这是我的活动计划。

package com.example.rej.aiemergeprototype2;

import android.Manifest;
import android.content.Context;
import android.content.pm.PackageManager;
import android.location.Location;
import android.location.LocationListener;
import android.location.LocationManager;
import android.net.wifi.WifiInfo;
import android.net.wifi.WifiManager;
import android.os.Build;
import android.support.v4.app.ActivityCompat;
import android.support.v4.app.FragmentActivity;
import android.os.Bundle;
import android.util.Log;
import android.view.View;
import android.widget.Button;

import com.google.android.gms.maps.CameraUpdateFactory;
import com.google.android.gms.maps.GoogleMap;
import com.google.android.gms.maps.OnMapReadyCallback;
import com.google.android.gms.maps.SupportMapFragment;
import com.google.android.gms.maps.model.LatLng;
import com.google.android.gms.maps.model.MarkerOptions;
import com.google.firebase.database.DatabaseReference;
import com.google.firebase.database.FirebaseDatabase;

import java.util.HashMap;
import java.util.Map;
import java.util.Random;


public class AmbulanceActivity extends FragmentActivity implements OnMapReadyCallback {

    private GoogleMap mMap;
    private LocationManager locationManager;
    private LocationListener locationListener;
    private LatLng userLocation;

    DatabaseReference mRootRef = FirebaseDatabase.getInstance().getReference();



    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_ambulance);
        // Obtain the SupportMapFragment and get notified when the map is ready to be used.
        SupportMapFragment mapFragment = (SupportMapFragment) getSupportFragmentManager()
                .findFragmentById(R.id.map);
        mapFragment.getMapAsync(this);
    }

    /**
     * Manipulates the map once available.
     * This callback is triggered when the map is ready to be used.
     * This is where we can add markers or lines, add listeners or move the camera. In this case,
     * we just add a marker near Sydney, Australia.
     * If Google Play services is not installed on the device, the user will be prompted to install
     * it inside the SupportMapFragment. This method will only be triggered once the user has
     * installed Google Play services and returned to the app.
     */
    @Override
    public void onMapReady(GoogleMap googleMap) {
        mMap = googleMap;
        locationManager = (LocationManager) this.getSystemService(Context.LOCATION_SERVICE);
        locationListenerCall();
        checkPermission();
    }

    public void locationListenerCall() {

        locationListener = new LocationListener() {
            @Override
            public void onLocationChanged(Location location) {
                updateMap(location);
            }

            @Override
            public void onStatusChanged(String s, int i, Bundle bundle) {

            }

            @Override
            public void onProviderEnabled(String s) {

            }

            @Override
            public void onProviderDisabled(String s) {

            }
        };

    }

    private void updateMap(Location location) {
       userLocation = new LatLng(location.getLatitude(), location.getLongitude());
       mMap.clear();
       mMap.moveCamera(CameraUpdateFactory.newLatLng(userLocation));
       mMap.addMarker(new MarkerOptions().position(userLocation).title("Your Location"));
    }

    private void checkPermission() {
        if (Build.VERSION.SDK_INT < 23) {
            locationManager.requestLocationUpdates(LocationManager.GPS_PROVIDER, 0, 0, locationListener);
        } else{
            if (ActivityCompat.checkSelfPermission(this, Manifest.permission.ACCESS_FINE_LOCATION) != PackageManager.PERMISSION_GRANTED && ActivityCompat.checkSelfPermission(this, Manifest.permission.ACCESS_COARSE_LOCATION) != PackageManager.PERMISSION_GRANTED) {
                // TODO: Consider calling
                //    ActivityCompat#requestPermissions
                // here to request the missing permissions, and then overriding
                //   public void onRequestPermissionsResult(int requestCode, String[] permissions,
                //                                          int[] grantResults)
                // to handle the case where the user grants the permission. See the documentation
                // for ActivityCompat#requestPermissions for more details.
                ActivityCompat.requestPermissions(this, new String[]{Manifest.permission.ACCESS_FINE_LOCATION}, 1);

            } else{
                locationManager.requestLocationUpdates(LocationManager.GPS_PROVIDER, 0, 0, locationListener);
                Location lastKnownLocation = locationManager.getLastKnownLocation(LocationManager.GPS_PROVIDER);

                if (lastKnownLocation != null){
                    updateMap(lastKnownLocation);
                }
            }
        }
    }

    @Override
    public void onRequestPermissionsResult(int requestCode, String[] permissions, int[] grantResults) {
        super.onRequestPermissionsResult(requestCode, permissions, grantResults);

        if (requestCode == 1) {
            if (grantResults.length > 0 && grantResults[0] == PackageManager.PERMISSION_GRANTED) {
                if (ActivityCompat.checkSelfPermission(this, Manifest.permission.ACCESS_FINE_LOCATION) != PackageManager.PERMISSION_GRANTED && ActivityCompat.checkSelfPermission(this, Manifest.permission.ACCESS_COARSE_LOCATION) != PackageManager.PERMISSION_GRANTED) {
                    locationManager.requestLocationUpdates(LocationManager.GPS_PROVIDER, 0, 0, locationListener);
                    Location lastKnownLocation = locationManager.getLastKnownLocation(LocationManager.GPS_PROVIDER);

                    updateMap(lastKnownLocation);
                }

            }
        }
    }



    public void sendEmergencySignal(View view){
       // Write a message to the database

//        For testing only
        Random rand = new Random();
        int deviceID = rand.nextInt(30) + 1;
        String deviceIDString = Integer.toString(deviceID);

////        WifiManager manager = (WifiManager) getSystemService(Context.WIFI_SERVICE);
//        WifiManager manager = (WifiManager) this.getSystemService(Context.WIFI_SERVICE);
//        WifiInfo info = manager.getConnectionInfo();
//        String macAddress = info.getMacAddress();

        DatabaseReference mDeviceRef = mRootRef.child(deviceIDString);

        Map ambulanceDevice = new HashMap();

        ambulanceDevice.put("ID", "2345");
        ambulanceDevice.put("Location", userLocation.toString());
        mDeviceRef.setValue(ambulanceDevice);

        Log.i("Info", userLocation.toString());

    }




}

这是activity_layout

<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
tools:context=".AmbulanceActivity" >

    <fragment xmlns:android="http://schemas.android.com/apk/res/android"
        xmlns:map="http://schemas.android.com/apk/res-auto"
        xmlns:tools="http://schemas.android.com/tools"
        android:id="@+id/map"
        android:name="com.google.android.gms.maps.SupportMapFragment"
        android:layout_width="match_parent"
        android:layout_height="412dp"
        tools:context="com.example.rej.aiemergeprototype2.AmbulanceActivity" />

    <Button
        android:id="@+id/emergencyButton"
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:layout_alignParentBottom="true"
        android:layout_alignParentStart="true"
        android:layout_below="@+id/map"
        android:background="@android:color/holo_red_light"
        android:onClick="sendEmergencySignal"
        android:text="TAP FOR EMERGENCY"
        android:textColor="@color/common_google_signin_btn_text_dark_default"
        android:textSize="30sp" />

</RelativeLayout>

这是我的build.gradle:

 apply plugin: 'com.android.application'

    android {
        compileSdkVersion 26
        buildToolsVersion "26.0.1"
        defaultConfig {
            applicationId "com.example.rej.aiemergeprototype2"
            minSdkVersion 23
            targetSdkVersion 26
            versionCode 1
            versionName "1.0"
            multiDexEnabled true
            testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"

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

    dependencies {
        compile fileTree(dir: 'libs', include: ['*.jar'])
        androidTestCompile('com.android.support.test.espresso:espresso-core:2.2.2', {
            exclude group: 'com.android.support', module: 'support-annotations'
        })
        compile 'com.android.support:appcompat-v7:26.+'
        compile 'com.android.support.constraint:constraint-layout:1.0.2'
        compile 'com.google.android.gms:play-services-maps:11.0.4'
        compile 'com.google.firebase:firebase-core:11.0.4'
        compile 'com.google.firebase:firebase-database:11.0.4'
    //    compile 'com.adnroid.support:multidex'
        testCompile 'junit:junit:4.12'
    }


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

这是我的清单文件

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

    <!--
         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" />

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

                <category android:name="android.intent.category.LAUNCHER" />
            </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=".AmbulanceActivity"
            android:label="@string/title_activity_ambulance"></activity>
    </application>

</manifest>

这是我的logcat:

2017-09-25 19:33:02,102 [39297913]   INFO -            #com.android.ddmlib - Opening a debugger listener at port 8684 for client with pid 8611 
2017-09-25 19:33:02,345 [39298156]   INFO - idea.run.AndroidProcessHandler - Adding device asus-asus_z010d-G1AXB705T855Y93 to monitor for launched app: com.example.rej.aiemergeprototype2 
2017-09-25 19:33:02,865 [39298676]   INFO - .firebase.logs.FirebaseLogTask - Processing Firebase log with tag FirebaseApp 
2017-09-25 19:33:02,865 [39298676]   INFO - .firebase.logs.FirebaseLogTask - Processing Firebase log with tag FirebaseApp 
2017-09-25 19:33:02,865 [39298676]   INFO - .firebase.logs.FirebaseLogTask - Processing Firebase log with tag FirebaseApp 
2017-09-25 19:33:02,865 [39298676]   INFO - .firebase.logs.FirebaseLogTask - Processing Firebase log with tag FirebaseApp 
2017-09-25 19:33:02,865 [39298676]   INFO - .firebase.logs.FirebaseLogTask - Processing Firebase log with tag FirebaseApp 
2017-09-25 19:33:02,865 [39298676]   INFO - .firebase.logs.FirebaseLogTask - Processing Firebase log with tag FirebaseApp 
2017-09-25 19:33:02,865 [39298676]   INFO - .firebase.logs.FirebaseLogTask - Processing Firebase log with tag FirebaseApp 
2017-09-25 19:33:02,972 [39298783]   INFO - .firebase.logs.FirebaseLogTask - Processing Firebase log with tag FirebaseApp 
2017-09-25 19:33:02,972 [39298783]   INFO - .firebase.logs.FirebaseLogTask - Processing Firebase log with tag FirebaseApp 
2017-09-25 19:33:02,972 [39298783]   INFO - .firebase.logs.FirebaseLogTask - Processing Firebase log with tag FirebaseApp 
2017-09-25 19:33:02,972 [39298783]   INFO - .firebase.logs.FirebaseLogTask - Processing Firebase log with tag FirebaseApp 
2017-09-25 19:33:02,972 [39298783]   INFO - .firebase.logs.FirebaseLogTask - Processing Firebase log with tag FirebaseApp 
2017-09-25 19:33:02,972 [39298783]   INFO - .firebase.logs.FirebaseLogTask - Processing Firebase log with tag FirebaseApp 
2017-09-25 19:33:02,972 [39298783]   INFO - .firebase.logs.FirebaseLogTask - Processing Firebase log with tag FirebaseApp 
2017-09-25 19:33:03,817 [39299628]   INFO - .firebase.logs.FirebaseLogTask - Processing Firebase log with tag FirebaseApp 
2017-09-25 19:33:03,817 [39299628]   INFO - .firebase.logs.FirebaseLogTask - Processing Firebase log with tag FirebaseApp 
2017-09-25 19:33:03,817 [39299628]   INFO - .firebase.logs.FirebaseLogTask - Processing Firebase log with tag FirebaseApp 
2017-09-25 19:33:03,817 [39299628]   INFO - .firebase.logs.FirebaseLogTask - Processing Firebase log with tag FirebaseApp 
2017-09-25 19:33:03,817 [39299628]   INFO - .firebase.logs.FirebaseLogTask - Processing Firebase log with tag FirebaseApp 
2017-09-25 19:33:03,817 [39299628]   INFO - .firebase.logs.FirebaseLogTask - Processing Firebase log with tag FirebaseApp 
2017-09-25 19:33:03,817 [39299628]   INFO - .firebase.logs.FirebaseLogTask - Processing Firebase log with tag FirebaseApp 
2017-09-25 19:33:03,869 [39299680]   INFO - .firebase.logs.FirebaseLogTask - Processing Firebase log with tag FirebaseApp 
2017-09-25 19:33:03,869 [39299680]   INFO - .firebase.logs.FirebaseLogTask - Processing Firebase log with tag FirebaseApp 
2017-09-25 19:33:03,869 [39299680]   INFO - .firebase.logs.FirebaseLogTask - Processing Firebase log with tag FirebaseApp 
2017-09-25 19:33:03,869 [39299680]   INFO - .firebase.logs.FirebaseLogTask - Processing Firebase log with tag FirebaseApp 
2017-09-25 19:33:03,869 [39299680]   INFO - .firebase.logs.FirebaseLogTask - Processing Firebase log with tag FirebaseApp 
2017-09-25 19:33:03,869 [39299680]   INFO - .firebase.logs.FirebaseLogTask - Processing Firebase log with tag FirebaseApp 
2017-09-25 19:33:03,869 [39299680]   INFO - .firebase.logs.FirebaseLogTask - Processing Firebase log with tag FirebaseApp 
2017-09-25 19:33:17,738 [39313549]   INFO -            #com.android.ddmlib - Opening a debugger listener at port 8684 for client with pid 8992 
2017-09-25 19:33:18,805 [39314616]   INFO - .firebase.logs.FirebaseLogTask - Processing Firebase log with tag FirebaseApp 
2017-09-25 19:33:18,805 [39314616]   INFO - .firebase.logs.FirebaseLogTask - Processing Firebase log with tag FirebaseApp 
2017-09-25 19:33:18,805 [39314616]   INFO - .firebase.logs.FirebaseLogTask - Processing Firebase log with tag FirebaseApp 
2017-09-25 19:33:18,805 [39314616]   INFO - .firebase.logs.FirebaseLogTask - Processing Firebase log with tag FirebaseApp 
2017-09-25 19:33:18,806 [39314617]   INFO - .firebase.logs.FirebaseLogTask - Processing Firebase log with tag FirebaseApp 
2017-09-25 19:33:18,806 [39314617]   INFO - .firebase.logs.FirebaseLogTask - Processing Firebase log with tag FirebaseApp 
2017-09-25 19:33:18,806 [39314617]   INFO - .firebase.logs.FirebaseLogTask - Processing Firebase log with tag FirebaseApp 
2017-09-25 19:33:18,831 [39314642]   INFO - .firebase.logs.FirebaseLogTask - Processing Firebase log with tag FirebaseApp 
2017-09-25 19:33:18,831 [39314642]   INFO - .firebase.logs.FirebaseLogTask - Processing Firebase log with tag FirebaseApp 
2017-09-25 19:33:18,831 [39314642]   INFO - .firebase.logs.FirebaseLogTask - Processing Firebase log with tag FirebaseApp 
2017-09-25 19:33:18,831 [39314642]   INFO - .firebase.logs.FirebaseLogTask - Processing Firebase log with tag FirebaseApp 
2017-09-25 19:33:18,831 [39314642]   INFO - .firebase.logs.FirebaseLogTask - Processing Firebase log with tag FirebaseApp 
2017-09-25 19:33:18,831 [39314642]   INFO - .firebase.logs.FirebaseLogTask - Processing Firebase log with tag FirebaseApp 
2017-09-25 19:33:18,831 [39314642]   INFO - .firebase.logs.FirebaseLogTask - Processing Firebase log with tag FirebaseApp 
2017-09-25 19:44:20,365 [39976176]   INFO -                    #InstantRun - Build timestamps: Local: 1506339167876, Device: 1506339167876 
2017-09-25 19:44:20,386 [39976197]   INFO -                    #InstantRun - Ping sent and replied successfully, application seems to be running. Foreground=false 
2017-09-25 19:44:21,243 [39977054]   INFO - ools.idea.fd.InstantRunBuilder - BuildCause: USER_REQUESTED_COLDSWAP, BuildMode: COLD 
2017-09-25 19:44:21,243 [39977054]   INFO - ild.invoker.GradleBuildInvoker - About to execute Gradle tasks: [:app:assembleDebug] 
2017-09-25 19:44:21,252 [39977063]   INFO - s.plugins.gradle.GradleManager - Instructing gradle to use java from /Applications/Android Studio.app/Contents/jre/jdk/Contents/Home 
2017-09-25 19:44:21,274 [39977085]   INFO - ild.invoker.GradleBuildInvoker - Build command line options: [--configure-on-demand, -Pandroid.injected.invoked.from.ide=true, -Pandroid.injected.build.api=23, -Pandroid.injected.build.density=xhdpi, -Pandroid.injected.build.abi=arm64-v8a,armeabi-v7a,armeabi, -Pandroid.injected.restrict.variant.name=debug, -Pandroid.injected.restrict.variant.project=:app, -Pandroid.optional.compilation=INSTANT_DEV,RESTART_ONLY, -Pandroid.injected.coldswap.mode=MULTIAPK, --init-script, /private/var/folders/9w/xs6fl_cd2j79g035c1_1jvbh0000gp/T/asLocalRepo1028.gradle] 
2017-09-25 19:44:21,274 [39977085]   INFO - xecution.GradleExecutionHelper - Passing command-line args to Gradle Tooling API: [--configure-on-demand, -Pandroid.injected.invoked.from.ide=true, -Pandroid.injected.build.api=23, -Pandroid.injected.build.density=xhdpi, -Pandroid.injected.build.abi=arm64-v8a,armeabi-v7a,armeabi, -Pandroid.injected.restrict.variant.name=debug, -Pandroid.injected.restrict.variant.project=:app, -Pandroid.optional.compilation=INSTANT_DEV,RESTART_ONLY, -Pandroid.injected.coldswap.mode=MULTIAPK, --init-script, /private/var/folders/9w/xs6fl_cd2j79g035c1_1jvbh0000gp/T/asLocalRepo1028.gradle] 
2017-09-25 19:44:21,925 [39977736]   INFO - pl.ProjectRootManagerComponent - project roots have changed 
2017-09-25 19:44:21,949 [39977760]   INFO - a.gradle.run.MakeBeforeRunTask - Gradle invocation complete, success = true 
2017-09-25 19:44:22,042 [39977853]   INFO - .diagnostic.PerformanceWatcher - Pushing properties took 1ms; general responsiveness: ok; EDT responsiveness: ok 
2017-09-25 19:44:22,053 [39977864]   INFO - .diagnostic.PerformanceWatcher - Indexable file iteration took 11ms; general responsiveness: ok; EDT responsiveness: ok 
2017-09-25 19:44:22,053 [39977864]   INFO - indexing.UnindexedFilesUpdater - Unindexed files update started: 1 files to update 
2017-09-25 19:44:22,116 [39977927]   INFO - .diagnostic.PerformanceWatcher - Unindexed files update took 63ms; general responsiveness: ok; EDT responsiveness: ok 
2017-09-25 19:44:22,132 [39977943]   INFO -                    #InstantRun - No changes 
2017-09-25 19:44:23,670 [39979481]   INFO - idea.run.AndroidProcessHandler - Adding device asus-asus_z010d-G1AXB705T855Y93 to monitor for launched app: com.example.rej.aiemergeprototype2 
2017-09-25 19:44:59,666 [40015477]   INFO - attrs.AttributeDefinitionsImpl - Found tag with unknown parent: AndroidManifest.AndroidManifestSupportsInput 
2017-09-25 19:44:59,666 [40015477]   INFO - attrs.AttributeDefinitionsImpl - Found tag with unknown parent: AndroidManifest.AndroidManifestCompatibleScreens 
2017-09-25 19:48:58,198 [40254009]   INFO -            #com.android.ddmlib - Opening a debugger listener at port 8684 for client with pid 9518 
2017-09-25 19:48:59,214 [40255025]   INFO -            #com.android.ddmlib - Opening a debugger listener at port 8684 for client with pid 9518 
2017-09-25 19:48:59,244 [40255055]   INFO - .firebase.logs.FirebaseLogTask - Processing Firebase log with tag FirebaseApp 
2017-09-25 19:48:59,244 [40255055]   INFO - .firebase.logs.FirebaseLogTask - Processing Firebase log with tag FirebaseApp 
2017-09-25 19:48:59,244 [40255055]   INFO - .firebase.logs.FirebaseLogTask - Processing Firebase log with tag FirebaseApp 
2017-09-25 19:48:59,245 [40255056]   INFO - .firebase.logs.FirebaseLogTask - Processing Firebase log with tag FirebaseApp 
2017-09-25 19:48:59,245 [40255056]   INFO - .firebase.logs.FirebaseLogTask - Processing Firebase log with tag FirebaseApp 
2017-09-25 19:48:59,245 [40255056]   INFO - .firebase.logs.FirebaseLogTask - Processing Firebase log with tag FirebaseApp 
2017-09-25 19:48:59,245 [40255056]   INFO - .firebase.logs.FirebaseLogTask - Processing Firebase log with tag FirebaseApp 
2017-09-25 19:48:59,245 [40255056]   INFO - .firebase.logs.FirebaseLogTask - Processing Firebase log with tag FirebaseApp 
2017-09-25 19:48:59,274 [40255085]   INFO - .firebase.logs.FirebaseLogTask - Processing Firebase log with tag FirebaseApp 
2017-09-25 19:48:59,274 [40255085]   INFO - .firebase.logs.FirebaseLogTask - Processing Firebase log with tag FirebaseApp 
2017-09-25 19:48:59,274 [40255085]   INFO - .firebase.logs.FirebaseLogTask - Processing Firebase log with tag FirebaseApp 
2017-09-25 19:48:59,274 [40255085]   INFO - .firebase.logs.FirebaseLogTask - Processing Firebase log with tag FirebaseApp 
2017-09-25 19:48:59,274 [40255085]   INFO - .firebase.logs.FirebaseLogTask - Processing Firebase log with tag FirebaseApp 
2017-09-25 19:48:59,274 [40255085]   INFO - .firebase.logs.FirebaseLogTask - Processing Firebase log with tag FirebaseApp 
2017-09-25 19:48:59,274 [40255085]   INFO - .firebase.logs.FirebaseLogTask - Processing Firebase log with tag FirebaseApp 
2017-09-25 19:48:59,274 [40255085]   INFO - .firebase.logs.FirebaseLogTask - Processing Firebase log with tag FirebaseApp 
2017-09-25 19:51:16,341 [40392152]   INFO -            #com.android.ddmlib - Opening a debugger listener at port 8684 for client with pid 9680 
2017-09-25 19:51:17,374 [40393185]   INFO - .firebase.logs.FirebaseLogTask - Processing Firebase log with tag FirebaseApp 
2017-09-25 19:51:17,374 [40393185]   INFO - .firebase.logs.FirebaseLogTask - Processing Firebase log with tag FirebaseApp 
2017-09-25 19:51:17,374 [40393185]   INFO - .firebase.logs.FirebaseLogTask - Processing Firebase log with tag FirebaseApp 
2017-09-25 19:51:17,374 [40393185]   INFO - .firebase.logs.FirebaseLogTask - Processing Firebase log with tag FirebaseApp 
2017-09-25 19:51:17,374 [40393185]   INFO - .firebase.logs.FirebaseLogTask - Processing Firebase log with tag FirebaseApp 
2017-09-25 19:51:17,374 [40393185]   INFO - .firebase.logs.FirebaseLogTask - Processing Firebase log with tag FirebaseApp 
2017-09-25 19:51:17,374 [40393185]   INFO - .firebase.logs.FirebaseLogTask - Processing Firebase log with tag FirebaseApp 
2017-09-25 19:51:17,374 [40393185]   INFO - .firebase.logs.FirebaseLogTask - Processing Firebase log with tag FirebaseApp 
2017-09-25 19:51:17,403 [40393214]   INFO - .firebase.logs.FirebaseLogTask - Processing Firebase log with tag FirebaseApp 
2017-09-25 19:51:17,403 [40393214]   INFO - .firebase.logs.FirebaseLogTask - Processing Firebase log with tag FirebaseApp 
2017-09-25 19:51:17,403 [40393214]   INFO - .firebase.logs.FirebaseLogTask - Processing Firebase log with tag FirebaseApp 
2017-09-25 19:51:17,403 [40393214]   INFO - .firebase.logs.FirebaseLogTask - Processing Firebase log with tag FirebaseApp 
2017-09-25 19:51:17,403 [40393214]   INFO - .firebase.logs.FirebaseLogTask - Processing Firebase log with tag FirebaseApp 
2017-09-25 19:51:17,403 [40393214]   INFO - .firebase.logs.FirebaseLogTask - Processing Firebase log with tag FirebaseApp 
2017-09-25 19:51:17,403 [40393214]   INFO - .firebase.logs.FirebaseLogTask - Processing Firebase log with tag FirebaseApp 
2017-09-25 19:51:17,403 [40393214]   INFO - .firebase.logs.FirebaseLogTask - Processing Firebase log with tag FirebaseApp 

1 个答案:

答案 0 :(得分:0)

您已启用multiDexEnabled true但我看不到您是否配置了它。可能会导致崩溃

尝试在课程中添加以下课程

    public class App extends MultiDexApplication {


    @Override
    protected void attachBaseContext(Context base) {
        super.attachBaseContext(base);
        MultiDex.install(this);   
    }

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

    }

}

并在name代码

中将此类添加到您的清单application
<application
    android:name=".App"
    android:allowBackup="true"
    android:icon="@mipmap/ic_launcher"
    android:label="@string/app_name"
    android:roundIcon="@mipmap/ic_launcher_round"
    android:supportsRtl="true"
    android:theme="@style/AppTheme">