我正在为我的Android应用程序使用Firebase身份验证和数据库。一切都在仿真器上运行(Nexus 5X API 26,Nexus 6 API 26,Galaxy Nexus API 24)。当我在我的个人Galaxy S6 Edge API 24上启动应用程序时,我的Firebase相关项目都不起作用。
这是从真正的android启动时的Logcat:
09-17 18:22:06.547 21928-21928/? E/Zygote: v2
09-17 18:22:06.547 21928-21928/? I/libpersona: KNOX_SDCARD checking this for 10081
09-17 18:22:06.547 21928-21928/? I/libpersona: KNOX_SDCARD not a persona
09-17 18:22:06.548 21928-21928/? E/Zygote: accessInfo : 0
09-17 18:22:06.548 21928-21928/? W/SELinux: SELinux selinux_android_compute_policy_index : Policy Index[2], Con:u:r:zygote:s0 RAM:SEPF_SECMOBILE_7.0_0005, [-1 -1 -4 -1 0 1]
09-17 18:22:06.550 21928-21928/? I/SELinux: SELinux: seapp_context_lookup: seinfo=untrusted, level=s0:c512,c768, pkgname=co.williamdev.cl
09-17 18:22:06.553 21928-21928/? I/art: Late-enabling -Xcheck:jni
09-17 18:22:06.577 21928-21928/? D/TimaKeyStoreProvider: TimaKeyStore is not enabled: cannot add TimaSignature Service and generateKeyPair Service
09-17 18:22:06.614 21928-21928/co.williamdev.cl W/ActivityThread: Application co.williamdev.cl can be debugged on port 8100...
09-17 18:22:06.625 21928-21928/co.williamdev.cl W/System: ClassLoader referenced unknown path: /data/app/co.williamdev.cl-1/lib/arm64
09-17 18:22:06.688 21928-21953/co.williamdev.cl W/DynamiteModule: Local module descriptor class for com.google.firebase.auth not found.
09-17 18:22:06.692 21928-21953/co.williamdev.cl W/DynamiteModule: Local module descriptor class for com.google.firebase.auth not found.
09-17 18:22:06.728 21928-21928/co.williamdev.cl D/FirebaseApp: com.google.firebase.crash.FirebaseCrash is not linked. Skipping initialization.
09-17 18:22:06.735 21928-21928/co.williamdev.cl I/FA: App measurement is starting up, version: 10084
09-17 18:22:06.736 21928-21928/co.williamdev.cl I/FA: To enable debug logging run: adb shell setprop log.tag.FA VERBOSE
09-17 18:22:06.736 21928-21928/co.williamdev.cl D/FA: Debug-level message logging enabled
09-17 18:22:06.736 21928-21928/co.williamdev.cl D/FA: AppMeasurement singleton hash: 76751607
09-17 18:22:06.743 21928-21928/co.williamdev.cl V/FA: Collection enabled
09-17 18:22:06.743 21928-21928/co.williamdev.cl V/FA: App package, google app id: co.williamdev.cl, 1:414579005472:android:c605a1af30f21ce2
09-17 18:22:06.744 21928-21928/co.williamdev.cl I/FA: To enable faster debug mode event logging run:
adb shell setprop debug.firebase.analytics.app co.williamdev.cl
09-17 18:22:06.749 21928-21928/co.williamdev.cl V/FA: Registered activity lifecycle callback
09-17 18:22:06.750 21928-21928/co.williamdev.cl I/FirebaseInitProvider: FirebaseApp initialization successful
09-17 18:22:06.759 21928-21963/co.williamdev.cl V/FA: Using measurement service
09-17 18:22:06.760 21928-21963/co.williamdev.cl V/FA: Connecting to remote service
09-17 18:22:06.778 21928-21928/co.williamdev.cl W/art: Before Android 4.1, method android.graphics.PorterDuffColorFilter android.support.graphics.drawable.VectorDrawableCompat.updateTintFilter(android.graphics.PorterDuffColorFilter, android.content.res.ColorStateList, android.graphics.PorterDuff$Mode) would have incorrectly overridden the package-private method in android.graphics.drawable.Drawable
09-17 18:22:06.781 21928-21928/co.williamdev.cl V/FA: onActivityCreated
09-17 18:22:06.788 21928-21928/co.williamdev.cl W/DynamiteModule: Failed to load module via fast routecom.google.android.gms.dynamite.DynamiteModule$zza: V2 version check failed
09-17 18:22:06.791 21928-21928/co.williamdev.cl I/DynamiteModule: Considering local module com.google.android.gms.firebase_database:4 and remote module com.google.android.gms.firebase_database:6
09-17 18:22:06.791 21928-21928/co.williamdev.cl I/DynamiteModule: Selected remote version of com.google.android.gms.firebase_database, version >= 6
09-17 18:22:06.821 21928-21928/co.williamdev.cl W/System: ClassLoader referenced unknown path:
09-17 18:22:06.840 21928-21928/co.williamdev.cl W/System: ClassLoader referenced unknown path: /data/user_de/0/com.google.android.gms/app_chimera/m/0000002a/n/arm64-v8a
09-17 18:22:06.911 21928-21928/co.williamdev.cl D/TextView: setTypeface with style : 0
09-17 18:22:06.912 21928-21928/co.williamdev.cl D/TextView: setTypeface with style : 0
09-17 18:22:06.919 21928-21928/co.williamdev.cl D/TextView: setTypeface with style : 0
09-17 18:22:06.920 21928-21928/co.williamdev.cl D/TextView: setTypeface with style : 0
09-17 18:22:06.922 21928-21928/co.williamdev.cl D/TextView: setTypeface with style : 0
09-17 18:22:06.923 21928-21928/co.williamdev.cl D/TextView: setTypeface with style : 0
09-17 18:22:06.932 21928-21963/co.williamdev.cl V/FA: Using measurement service
09-17 18:22:06.932 21928-21963/co.williamdev.cl V/FA: Connection attempt already in progress
09-17 18:22:06.932 21928-21963/co.williamdev.cl V/FA: Activity resumed, time: 77667465
09-17 18:22:06.941 21928-21928/co.williamdev.cl D/ViewRootImpl@a269bcf[MainActivity]: ThreadedRenderer.create() translucent=false
09-17 18:22:06.944 21928-21928/co.williamdev.cl D/InputTransport: Input channel constructed: fd=62
09-17 18:22:06.944 21928-21928/co.williamdev.cl D/ViewRootImpl@a269bcf[MainActivity]: setView = DecorView@703995c[MainActivity] touchMode=true
09-17 18:22:06.947 21928-21928/co.williamdev.cl D/MainActivity: onAuthStateChanged:signed_in:a1uQCuf3RBT69ierqbhApFat3Ky2
09-17 18:22:06.960 21928-21928/co.williamdev.cl D/ViewRootImpl@a269bcf[MainActivity]: dispatchAttachedToWindow
09-17 18:22:06.976 21928-21928/co.williamdev.cl D/TextView: setTypeface with style : 0
09-17 18:22:06.980 21928-21928/co.williamdev.cl D/TextView: setTypeface with style : 0
09-17 18:22:06.981 21928-21928/co.williamdev.cl D/TextView: setTypeface with style : 0
09-17 18:22:06.989 21928-21928/co.williamdev.cl D/TextView: setTypeface with style : 0
09-17 18:22:06.990 21928-21928/co.williamdev.cl D/TextView: setTypeface with style : 0
09-17 18:22:07.025 21928-21928/co.williamdev.cl D/AbsListView: Get MotionRecognitionManager
09-17 18:22:07.027 21928-21928/co.williamdev.cl D/MotionRecognitionManager: mSContextService = com.samsung.android.hardware.context.ISemContextService$Stub$Proxy@bb55fdb
09-17 18:22:07.031 21928-21928/co.williamdev.cl D/MotionRecognitionManager: motionService = com.samsung.android.gesture.IMotionRecognitionService$Stub$Proxy@dd0ba78
09-17 18:22:07.031 21928-21928/co.williamdev.cl D/MotionRecognitionManager: motionService = com.samsung.android.gesture.IMotionRecognitionService$Stub$Proxy@dd0ba78
09-17 18:22:07.068 21928-21928/co.williamdev.cl D/TextView: setTypeface with style : 0
09-17 18:22:07.069 21928-21928/co.williamdev.cl I/TextInputLayout: EditText added is not a TextInputEditText. Please switch to using that class instead.
09-17 18:22:07.101 21928-21928/co.williamdev.cl D/ViewRootImpl@a269bcf[MainActivity]: Relayout returned: oldFrame=[0,0][0,0] newFrame=[0,0][1440,2560] result=0x7 surface={isValid=true 510201823232} surfaceGenerationChanged=true
09-17 18:22:07.101 21928-21928/co.williamdev.cl D/ViewRootImpl@a269bcf[MainActivity]: mHardwareRenderer.initialize() mSurface={isValid=true 510201823232} hwInitialized=true
09-17 18:22:07.122 21928-21965/co.williamdev.cl D/libEGL: loaded /vendor/lib64/egl/libGLES_mali.so
09-17 18:22:07.141 21928-21965/co.williamdev.cl I/OpenGLRenderer: Initialized EGL, version 1.4
09-17 18:22:07.141 21928-21965/co.williamdev.cl D/OpenGLRenderer: Swap behavior 1
09-17 18:22:07.146 21928-21965/co.williamdev.cl D/mali_winsys: EGLint new_window_surface(egl_winsys_display*, void*, EGLSurface, EGLConfig, egl_winsys_surface**, egl_color_buffer_format*, EGLBoolean) returns 0x3000, [1440x2560]-format:1
09-17 18:22:07.188 21928-21928/co.williamdev.cl D/AbsListView: onsize change
09-17 18:22:07.278 21928-21928/co.williamdev.cl D/ViewRootImpl@a269bcf[MainActivity]: MSG_RESIZED_REPORT: ci=Rect(0, 96 - 0, 0) vi=Rect(0, 96 - 0, 0) or=1
09-17 18:22:07.278 21928-21928/co.williamdev.cl D/ViewRootImpl@a269bcf[MainActivity]: MSG_WINDOW_FOCUS_CHANGED 1
09-17 18:22:07.278 21928-21928/co.williamdev.cl D/ViewRootImpl@a269bcf[MainActivity]: mHardwareRenderer.initializeIfNeeded()#2 mSurface={isValid=true 510201823232}
09-17 18:22:07.299 21928-21928/co.williamdev.cl D/SEM_CLIP_SemClipboardManager: isCocktailBarDisplayed : false
09-17 18:22:07.299 21928-21928/co.williamdev.cl V/InputMethodManager: Starting input: tba=android.view.inputmethod.EditorInfo@a45ad61 nm : co.williamdev.cl ic=null
09-17 18:22:07.299 21928-21928/co.williamdev.cl I/InputMethodManager: [IMM] startInputInner - mService.startInputOrWindowGainedFocus
09-17 18:22:07.302 21928-21963/co.williamdev.cl D/FA: Connected to remote service
09-17 18:22:07.302 21928-21963/co.williamdev.cl V/FA: Processing queued up service tasks: 2
09-17 18:22:07.303 21928-21941/co.williamdev.cl D/InputTransport: Input channel constructed: fd=74
09-17 18:22:07.309 21928-21928/co.williamdev.cl V/InputMethodManager: Starting input: tba=android.view.inputmethod.EditorInfo@e092f12 nm : co.williamdev.cl ic=null
09-17 18:22:12.329 21928-21963/co.williamdev.cl V/FA: Inactivity, disconnecting from the service
09-17 18:22:45.273 21928-21953/co.williamdev.cl W/DynamiteModule: Local module descriptor class for com.google.firebase.auth not found.
09-17 18:22:49.077 21928-21953/co.williamdev.cl W/DynamiteModule: Local module descriptor class for com.google.firebase.auth not found.
09-17 18:22:49.079 21928-21953/co.williamdev.cl W/DynamiteModule: Local module descriptor class for com.google.firebase.auth not found.
09-17 18:22:59.163 21928-21953/co.williamdev.cl W/DynamiteModule: Local module descriptor class for com.google.firebase.auth not found.
09-17 18:23:05.775 21928-21953/co.williamdev.cl W/DynamiteModule: Local module descriptor class for com.google.firebase.auth not found.
09-17 18:23:05.777 21928-21953/co.williamdev.cl W/DynamiteModule: Local module descriptor class for com.google.firebase.auth not found.
09-17 18:23:24.611 21928-21953/co.williamdev.cl W/DynamiteModule: Local module descriptor class for com.google.firebase.auth not found.
没有崩溃错误。
这是来自工作模拟器的Logcat:
09-17 18:31:12.950 5373-5373/? I/zygote: Not late-enabling -Xcheck:jni (already on)
09-17 18:31:13.135 5373-5373/? W/zygote: Unexpected CPU variant for X86 using defaults: x86
09-17 18:31:13.812 5373-5384/co.williamdev.cl I/zygote: Background concurrent copying GC freed 9975(2MB) AllocSpace objects, 0(0B) LOS objects, 79% free, 388KB/1924KB, paused 14.209ms total 332.236ms
09-17 18:31:13.893 5373-5394/co.williamdev.cl W/DynamiteModule: Local module descriptor class for com.google.firebase.auth not found.
09-17 18:31:14.028 5373-5373/co.williamdev.cl D/FirebaseApp: com.google.firebase.crash.FirebaseCrash is not linked. Skipping initialization.
09-17 18:31:14.066 5373-5373/co.williamdev.cl I/FA: App measurement is starting up, version: 10084
09-17 18:31:14.067 5373-5373/co.williamdev.cl I/FA: To enable debug logging run: adb shell setprop log.tag.FA VERBOSE
09-17 18:31:14.067 5373-5373/co.williamdev.cl D/FA: Debug-level message logging enabled
09-17 18:31:14.067 5373-5373/co.williamdev.cl D/FA: AppMeasurement singleton hash: 33108808
09-17 18:31:14.169 5373-5373/co.williamdev.cl V/FA: Collection enabled
09-17 18:31:14.169 5373-5373/co.williamdev.cl V/FA: App package, google app id: co.williamdev.cl, 1:414579005472:android:c605a1af30f21ce2
09-17 18:31:14.170 5373-5373/co.williamdev.cl I/FA: To enable faster debug mode event logging run:
adb shell setprop debug.firebase.analytics.app co.williamdev.cl
09-17 18:31:14.204 5373-5373/co.williamdev.cl V/FA: Registered activity lifecycle callback
09-17 18:31:14.211 5373-5373/co.williamdev.cl I/FirebaseInitProvider: FirebaseApp initialization successful
09-17 18:31:14.347 5373-5373/co.williamdev.cl V/FA: onActivityCreated
09-17 18:31:14.348 5373-5404/co.williamdev.cl V/FA: Using measurement service
09-17 18:31:14.349 5373-5404/co.williamdev.cl V/FA: Connecting to remote service
09-17 18:31:14.421 5373-5373/co.williamdev.cl I/DynamiteModule: Considering local module com.google.android.gms.firebase_database:4 and remote module com.google.android.gms.firebase_database:6
09-17 18:31:14.421 5373-5373/co.williamdev.cl I/DynamiteModule: Selected remote version of com.google.android.gms.firebase_database, version >= 6
09-17 18:31:14.424 5373-5373/co.williamdev.cl W/zygote: Skipping duplicate class check due to unrecognized classloader
09-17 18:31:14.449 5373-5373/co.williamdev.cl W/zygote: Skipping duplicate class check due to unrecognized classloader
09-17 18:31:14.509 5373-5380/co.williamdev.cl W/zygote: Suspending all threads took: 37.690ms
09-17 18:31:14.595 5373-5394/co.williamdev.cl W/DynamiteModule: Local module descriptor class for com.google.firebase.auth not found.
09-17 18:31:14.679 5373-5412/co.williamdev.cl D/NetworkSecurityConfig: No Network Security Config specified, using platform default
09-17 18:31:14.837 5373-5404/co.williamdev.cl V/FA: Using measurement service
09-17 18:31:14.837 5373-5404/co.williamdev.cl V/FA: Connection attempt already in progress
09-17 18:31:14.838 5373-5404/co.williamdev.cl V/FA: Activity resumed, time: 1920104
09-17 18:31:14.871 5373-5414/co.williamdev.cl D/OpenGLRenderer: HWUI GL Pipeline
09-17 18:31:14.903 5373-5373/co.williamdev.cl D/MainActivity: onAuthStateChanged:signed_in:RY1vRHRecNN6qMbgw0h9bcxAEnj2
09-17 18:31:15.084 5373-5378/co.williamdev.cl I/zygote: Do partial code cache collection, code=25KB, data=24KB
09-17 18:31:15.087 5373-5378/co.williamdev.cl I/zygote: After code cache collection, code=24KB, data=24KB
09-17 18:31:15.087 5373-5378/co.williamdev.cl I/zygote: Increasing code cache capacity to 128KB
09-17 18:31:15.088 5373-5378/co.williamdev.cl I/zygote: Do partial code cache collection, code=24KB, data=42KB
09-17 18:31:15.088 5373-5378/co.williamdev.cl I/zygote: After code cache collection, code=24KB, data=42KB
09-17 18:31:15.088 5373-5378/co.williamdev.cl I/zygote: Increasing code cache capacity to 256KB
09-17 18:31:15.088 5373-5378/co.williamdev.cl I/zygote: JIT allocated 71KB for compiled code of void android.widget.TextView.<init>(android.content.Context, android.util.AttributeSet, int, int)
09-17 18:31:15.089 5373-5378/co.williamdev.cl I/zygote: Compiler allocated 4MB to compile void android.widget.TextView.<init>(android.content.Context, android.util.AttributeSet, int, int)
09-17 18:31:15.167 5373-5373/co.williamdev.cl I/TextInputLayout: EditText added is not a TextInputEditText. Please switch to using that class instead.
09-17 18:31:15.470 5373-5414/co.williamdev.cl I/OpenGLRenderer: Initialized EGL, version 1.4
09-17 18:31:15.470 5373-5414/co.williamdev.cl D/OpenGLRenderer: Swap behavior 1
09-17 18:31:15.470 5373-5414/co.williamdev.cl W/OpenGLRenderer: Failed to choose config with EGL_SWAP_BEHAVIOR_PRESERVED, retrying without...
09-17 18:31:15.470 5373-5414/co.williamdev.cl D/OpenGLRenderer: Swap behavior 0
09-17 18:31:15.487 5373-5414/co.williamdev.cl D/EGL_emulation: eglCreateContext: 0xa4475920: maj 2 min 0 rcv 2
09-17 18:31:15.492 5373-5414/co.williamdev.cl D/EGL_emulation: eglMakeCurrent: 0xa4475920: ver 2 0 (tinfo 0xa3f24fe0)
[ 09-17 18:31:15.584 5373: 5414 D/ ]
SurfaceInterface::setAsyncMode: set async mode 1
09-17 18:31:15.703 5373-5373/co.williamdev.cl I/Choreographer: Skipped 38 frames! The application may be doing too much work on its main thread.
09-17 18:31:15.760 5373-5414/co.williamdev.cl D/EGL_emulation: eglMakeCurrent: 0xa4475920: ver 2 0 (tinfo 0xa3f24fe0)
09-17 18:31:16.075 5373-5404/co.williamdev.cl D/FA: Connected to remote service
09-17 18:31:16.075 5373-5404/co.williamdev.cl V/FA: Processing queued up service tasks: 2
09-17 18:31:16.601 5373-5378/co.williamdev.cl I/zygote: Do full code cache collection, code=124KB, data=75KB
09-17 18:31:16.603 5373-5378/co.williamdev.cl I/zygote: After code cache collection, code=116KB, data=47KB
09-17 18:31:16.630 5373-5378/co.williamdev.cl I/zygote: Do partial code cache collection, code=116KB, data=53KB
09-17 18:31:16.631 5373-5378/co.williamdev.cl I/zygote: After code cache collection, code=116KB, data=53KB
09-17 18:31:16.631 5373-5378/co.williamdev.cl I/zygote: Increasing code cache capacity to 512KB
09-17 18:31:21.240 5373-5404/co.williamdev.cl V/FA: Inactivity, disconnecting from the service
09-17 18:31:22.042 5373-5378/co.williamdev.cl I/zygote: Do full code cache collection, code=249KB, data=142KB
09-17 18:31:22.042 5373-5378/co.williamdev.cl I/zygote: After code cache collection, code=154KB, data=99KB
09-17 18:31:22.510 5373-5380/co.williamdev.cl W/zygote: Suspending all threads took: 13.159ms
09-17 18:31:25.758 5373-5394/co.williamdev.cl W/DynamiteModule: Local module descriptor class for com.google.firebase.auth not found.
抱歉这么长的日志,我似乎无法弄清楚这个问题。如果您发现错误,或者我可以使用调试过程,请告诉我。我是Android的新手。
我的应用程序级别bundle.gradle如果有帮助
apply plugin: 'com.android.application'
android {
compileSdkVersion 26
buildToolsVersion "25.0.3"
defaultConfig {
applicationId "co.williamdev.cl"
minSdkVersion 16
targetSdkVersion 26
versionCode 1
versionName "1.0"
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
vectorDrawables.useSupportLibrary = true
resConfigs "auto"
}
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.0.2'
compile 'com.android.support:design:26.0.2'
compile 'com.android.support:support-vector-drawable:26.0.2'
compile 'com.android.support:animated-vector-drawable:26.0.2'
compile 'com.gelitenight.waveview:waveview:1.0.0'
compile 'com.android.support:customtabs:26.0.2'
compile 'com.android.support:cardview-v7:26.0.2'
compile 'com.google.firebase:firebase-core:10.0.0'
compile 'com.google.firebase:firebase-auth:10.0.0'
compile 'com.google.firebase:firebase-database:10.0.0'
compile 'com.firebaseui:firebase-ui-database:1.1.1'
compile 'com.android.support.constraint:constraint-layout:1.0.2'
compile 'com.mxn.soul:flowingdrawer-core:2.0.0'
compile 'com.nineoldandroids:library:2.4.0'
testCompile 'junit:junit:4.12'
}
apply plugin: 'com.google.gms.google-services'
apply plugin: 'com.android.application'
Android Studio SDK: Google Play服务:v44 Google信息库:v58
Firebase测试实验室的机器人测试也没有加载Firebase数据的问题(Galaxy S6 Edge,API Level 22)
编辑:
好的,我终于解决了这个问题。这个问题确实已经过时了Firebase库。我将所有firebase依赖项更新为最新版本(现在为11.2.2)。
compile 'com.google.firebase:firebase-core:11.2.2'
compile 'com.google.firebase:firebase-auth:11.2.2'
compile 'com.google.firebase:firebase-database:11.2.2'
compile 'com.firebaseui:firebase-ui-database:2.3.0'
然后我收到了这些错误:
从模拟器发布 -
co.williamdev.cl E/FA: Discarding data. Failed to send app launch
co.williamdev.cl E/FA: Failed to get app instance id
co.williamdev.cl E/FA: Failed to send current screen to service
co.williamdev.cl E/FA: Discarding data. Failed to send event to service
co.williamdev.cl E/FA: Discarding data. Failed to send event to service
从真实设备发布 -
? E/Zygote: v2
? E/Zygote: accessInfo : 0
通过重新安装新的模拟器解决,通过我的模拟器更新Google Play服务 - &gt;更多(侧栏上的...按钮)或扩展控件 - &gt; Google Play - &gt;更新。通过SDK管理器更新没有帮助。我还在手机上卸载了现有的应用程序,因此可能已经清除了缓存的数据。
无论如何,谢谢你们的帮助。
答案 0 :(得分:0)
更新:检查&#34;规则&#34;在您的firebase的控制台中,然后在数据库中。并改为:
{
"rules": {
".read": true,
".write":true
}
}
第一篇文章
查看Google Play服务版本。另外,对于功能参考,请发布您的代码。
来自Firebase
确保,
更新您的图书馆
compile 'com.google.firebase:firebase-core:11.2.2' compile 'com.google.firebase:firebase-auth:11.2.2' compile 'com.google.firebase:firebase-database:11.2.2' compile 'com.firebaseui:firebase-ui-database:2.3.0'
Google Play服务:
https://play.google.com/store/apps/details?id=com.google.android.gms&hl=en
答案 1 :(得分:0)
它不能在设备上工作但在仿真器上工作的原因是因为仿真器不能使用仿真器。需要在gradle构建中使用Google Play服务,因为在运行应用程序模拟器时,create会添加自己的库。