手动创建API后,错误删除的Firebase凭据API无法工作



突然我的应用程序开始在这里抛出一个错误:

{
"error": {
"code": 400,
"message": "API key expired. Please renew the API key.",
"errors": [{
"message": "API key expired. Please renew the API key.",
"domain": "global",
"reason": "badRequest"
}],
"status": "INVALID_ARGUMENT"
}
}

我成功地解决了这个问题

然后我从安卓工作室创建了一个签名的apk,然后我再次出现错误,这是由于sha1指纹不在firebase中。我也成功地解决了这个问题。

但是。。。突然间,我的应用程序无法工作,就像我无法登录一样,控制台上也没有红线。我不知道原因。我的应用程序已完成,但在最后一刻登录不起作用,就像它没有调用failureListener一样,但也没有调用success。

我已经做了这些事情。

  1. 将firebase谷歌服务JSON文件与我的项目中的文件匹配(完全相同(
  2. 从谷歌云控制台检查了API,它们匹配正确(完全相同(
  3. 已检查生成。渐变文件实现是正确的
  4. 检查了android清单文件和项目id以及其他内容与firebase JSON文件和firebase设置中的内容相同
  5. 谷歌云控制台有一个由firebase自动生成的API
  6. 谷歌可以控制台有我使用sha1指纹创建的2 o auth客户端id,用于调试和发布
  7. 还使IDE无效并重新启动
  8. 还检查了其他设备
  9. 此外,检查了不同的互联网连接

我的项目太大,无法移动到另一个android项目,我不希望出现其他问题,如果我在移动文件时出错,可能会出现这些问题。

Firebase Assistant表示,存在用于存储、分析、crashlytics等的连接。。。以下是当我点击登录按钮时,来自android工作室的最新控制台报告。

V/FA: Recording user engagement, ms: 14026
V/FA: Connecting to remote service
V/FA: onActivityCreated
V/FA: Activity paused, time: 1888755682
D/PhoneWindow: DEBUG_ALIENSCREEN:getRotation mRotation=0
I/DecorView: setWindowBackground mBackgroundPadding = Rect(0, 0 - 0, 0), mFramePadding = Rect(0, 0 - 0, 0), pkg = com.example.lifejournalpersonaldiary
V/PhoneWindow: DecorView setVisiblity: visibility = 4, Parent = null, this = DecorView@1bf912d[]
D/WindowClient: Add to mViews: DecorView@1bf912d[SignInHubActivity], this = android.view.WindowManagerGlobal@cc54b61
D/ViewRootImpl[SignInHubActivity]: hardware acceleration = true , fakeHwAccelerated = false, sRendererDisabled = false, forceHwAccelerated = false, sSystemRendererDisabled = false
V/PhoneWindow: DecorView setVisiblity: visibility = 0, Parent = ViewRoot{9759c4f com.example.lifejournalpersonaldiary/com.google.android.gms.auth.api.signin.internal.SignInHubActivity,ident = 3}, this = DecorView@1bf912d[SignInHubActivity]
I/TouchMotionHandler: handler onAttached
E/: nFreeSize: 32784990208
D/Surface: Surface::connect(this=0x77b8df7000,api=1)
D/Surface: Surface::allocateBuffers(this=0x77b8df7000)
V/FA: Connection attempt already in progress
V/FA: Activity resumed, time: 1888755756
D/GraphicBuffer: register, handle(0x77bc0a9580) (w:720 h:1436 s:736 f:0x1 u:b00)
D/SurfaceExt: callingApp: com.example.lifejournalpersonaldiary
D/SurfaceExt: ENABLE_WHITE_LIST: false,isInWhiteList: false
D/Surface: lockCanvas
Surface::connect(this=0x77b8dfe000,api=2)
D/GraphicBuffer: register, handle(0x77b93cbb40) (w:1 h:1 s:32 f:0x1 u:933)
D/SurfaceExt: callingApp: com.example.lifejournalpersonaldiary
D/SurfaceExt: ENABLE_WHITE_LIST: false,isInWhiteList: false
D/Surface: lockCanvas
Surface::connect(this=0x77b8df8000,api=2)
D/GraphicBuffer: register, handle(0x77b93cbb40) (w:720 h:84 s:736 f:0x1 u:933)
D/GraphicBuffer: register, handle(0x77bc0a9a00) (w:720 h:1436 s:736 f:0x1 u:b00)
D/SurfaceExt: callingApp: com.example.lifejournalpersonaldiary
ENABLE_WHITE_LIST: false,isInWhiteList: false
D/Surface: lockCanvas
E/: nFreeSize: 32784990208
D/GraphicBuffer: register, handle(0x77b93cbb40) (w:1 h:1 s:32 f:0x1 u:933)
D/SurfaceExt: callingApp: com.example.lifejournalpersonaldiary
D/SurfaceExt: ENABLE_WHITE_LIST: false,isInWhiteList: false
D/Surface: lockCanvas
D/GraphicBuffer: register, handle(0x77b93cbb40) (w:720 h:84 s:736 f:0x1 u:933)
V/FA: Connection attempt already in progress
V/FA: Connection attempt already in progress
V/FA: Screen exposed for less than 1000 ms. Event not sent. time: 75
V/FA: Connection attempt already in progress
V/FA: Activity paused, time: 1888755837
D/FA: Connected to remote service
V/FA: Processing queued up service tasks: 5
E/: nFreeSize: 32784986112
E/: nFreeSize: 32784977920
V/FA: Activity resumed, time: 1888757941
V/PhoneWindow: DecorView setVisiblity: visibility = 0, Parent = ViewRoot{b04e448 com.example.lifejournalpersonaldiary/com.example.lifejournalpersonaldiary.BackupRestore,ident = 1}, this = DecorView@a36c565[BackupRestore]
D/Surface: Surface::disconnect(this=0x77b8df7000,api=1)
D/GraphicBuffer: unregister, handle(0x77bc0a7e40) (w:720 h:1436 s:736 f:0x1 u:b00)
D/GraphicBuffer: unregister, handle(0x77bc0a8200) (w:720 h:1436 s:736 f:0x1 u:b00)
D/SurfaceExt: callingApp: com.example.lifejournalpersonaldiary
ENABLE_WHITE_LIST: false,isInWhiteList: false
D/Surface: lockCanvas
D/SurfaceExt: callingApp: com.example.lifejournalpersonaldiary
D/SurfaceExt: ENABLE_WHITE_LIST: false,isInWhiteList: false
D/Surface: lockCanvas
I/TouchMotionHandler: handler onDetached
D/View: [Warning] assignParent to null: this = DecorView@1bf912d[SignInHubActivity]
D/Surface: Surface::disconnect(this=0x77b8df8000,api=2)
D/GraphicBuffer: unregister, handle(0x77b8ca5140) (w:720 h:84 s:736 f:0x1 u:933)
D/GraphicBuffer: unregister, handle(0x77ba3c1040) (w:720 h:84 s:736 f:0x1 u:933)
D/Surface: Surface::disconnect(this=0x77b8dfe000,api=2)
D/GraphicBuffer: unregister, handle(0x77cd4e1d80) (w:1 h:1 s:32 f:0x1 u:933)
D/GraphicBuffer: unregister, handle(0x77ba3c1100) (w:1 h:1 s:32 f:0x1 u:933)
D/WindowClient: Remove from mViews: DecorView@1bf912d[SignInHubActivity], this = android.view.WindowManagerGlobal@cc54b61
E/: nFreeSize: 32784973824
V/FA: Inactivity, disconnecting from the service

步骤-1。解决方案是从项目中删除firebase依赖项,然后使缓存无效,然后清除项目。重新启动android工作室。

步骤-2。你必须从渐变文件中删除一些行,也从项目设置中删除->模块->删除其中包含的每一个firebase名称。

步骤-3。之后,将你的项目从防火区中删除,它将显示一个危险的警告。重新启动android工作室后,从工具菜单连接firebase。添加项目中需要的插件,如数据库、存储、身份验证、crashlytics等。

步骤-4。然后在firebase的项目设置中再次添加SHA密钥(同时使用SHA 256调试和释放这两个密钥(,否则你将再次陷入困境。

TIPS:不要更改项目名称或类似的东西,因为这无关紧要,这样做可能会造成问题。这一次不要从console.cloud.google.com中删除API密钥,实际上,你不应该干扰API,因为我们不需要这样做。Firebase会自动创建密钥,并且工作非常正常。

最新更新