Android 上的 Meteor.loginWithGoogle 错误 10 [英] Meteor.loginWithGoogle error 10 on android

查看:76
本文介绍了Android 上的 Meteor.loginWithGoogle 错误 10的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我使用如下的 Meteor.loginWithGoogle 函数登录谷歌.它正在浏览器上运行,但是当我构建到 apk(由cordova)时它失败了(控制台日志是错误10).

handleLoginError(err, service) {控制台错误(错误);}Meteor.loginWithGoogle({}, (err) => {如果(错误){this.handleLoginError(err, 'google');} 别的 {this.handleLoginSuccess();}});

解决方案

刚刚在 https://forum.ionicframework.com/t/google-login-error-10/93230/4

就您而言,Cordova 未正确签署您的 APK.这就是错误只发生在 apk 中的原因.您可以通过创建一个有效的密钥库来解决这个问题,Cordova 可以使用它来对 apk 进行签名.

<小时>

选项 1

您可以使用例如创建密钥库此命令:keytool -genkey -v -keystore my-release-key.keystore -alias alias_name -keyalg RSA -keysize 2048 -validity 10000确保根据您的需要对其进行编辑.如果您想了解有关此命令的更多信息,可以阅读此答案.

接下来,您需要使用此命令从刚刚生成的密钥中获取 SHA1:keytool -exportcert -list -v -alias androiddebugkey -keystore ~/.android/debug.keystore>

您可以使用此 SHA1 从 https://developers.google.com/mobile/add?platform=android&cntapi=signin

使用命令 meteor build android --release 构建您的应用并生成 apk 文件.

最后,您可以使用命令 jarsigner -verbose -sigalg SHA1withRSA -digestalg SHA1 -keystore my-release-key.keystore HelloWorld-release-unsigned.apk alias_name 对生成的 apk 文件进行 jar 签名密钥库.

<小时>

选项 2

或者,您可以创建一个签名属性文件 platforms/android/debug-signing.properties,其中包含您的密钥库文件和密码,如下所示.示例:

keyAlias=yourkeyAlias密钥密码=您的密钥密码storeFile=theFileContainingTheKeystore商店密码=您的商店密码

<小时>

您可以在发布文档中获得更多相关信息:https://ionicframework.com/docs/v1/guide/publishing.html

I used the function Meteor.loginWithGoogle as below to login with google. It's working on browser but It's fail (the console log is error 10) when I build to apk (by cordova).

handleLoginError(err, service) {
   console.error(err);
}

Meteor.loginWithGoogle({}, (err) => {
  if (err) {
    this.handleLoginError(err, 'google');
  } else {
    this.handleLoginSuccess();
  }
});

解决方案

Just found the solution on https://forum.ionicframework.com/t/google-login-error-10/93230/4

In your case, Cordova is not signing your APK correctly. This is why the error only occurs in the apk. You can solve this by creating a valid keystore, which Cordova can use to sign the apk.


Option 1

You can create the keystore using e.g. this command: keytool -genkey -v -keystore my-release-key.keystore -alias alias_name -keyalg RSA -keysize 2048 -validity 10000 Make sure to edit it to your needs. If you want to know more about this command, you can read this answer.

Next, you neew to get the SHA1 from the key you just generated using this command: keytool -exportcert -list -v -alias androiddebugkey -keystore ~/.android/debug.keystore

You can use this SHA1 to get your token, IDs and keys from https://developers.google.com/mobile/add?platform=android&cntapi=signin

Use the command meteor build android --release to build your app and to generate an apk file.

Finally you can use the command jarsigner -verbose -sigalg SHA1withRSA -digestalg SHA1 -keystore my-release-key.keystore HelloWorld-release-unsigned.apk alias_name to jar sign the generated apk file with the keystore.


Option 2

Alternatively you can create a signing properties file platforms/android/debug-signing.properties containing your keystore file, password as shown below. Example:

keyAlias=yourkeyAlias
keyPassword=yourkeyPassword
storeFile=theFileContainingTheKeystore
storePassword=yourStorePassword


You can get more information about this in the publishing documentation: https://ionicframework.com/docs/v1/guide/publishing.html

这篇关于Android 上的 Meteor.loginWithGoogle 错误 10的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆