如何在安卓上实施reCAPTCHA Enterprise。

huangapple go评论110阅读模式
英文:

How to implement reCAPTCHA Enterprise on android

问题

我在实现reCAPTCHA Enterprise时遇到了问题。即使在build.gradle中添加了implementation 'com.google.android.recaptcha:recaptcha:18.2.1',但在实现代码时,它无法识别reCAPTCHA类并且无法导入。

private void initializeRecaptchaClient() {
    Recaptcha
      .getTasksClient(getApplication(), "YOUR_SITE_KEY")
      .addOnSuccessListener(
          this,
          new OnSuccessListener<RecaptchaTasksClient>() {
            @Override
            public void onSuccess(RecaptchaTasksClient client) {
              MainActivity.this.recaptchaTasksClient = client;
            }
          })
      .addOnFailureListener(
          this,
          new OnFailureListener() {
            @Override
            public void onFailure(@NonNull Exception e) {
              // 处理通信错误...
              // 请参考“处理通信错误”部分
            }
          });
}
英文:

I'm having trouble implementing reCAPTCHA Enterprise. Even adding in build.gradle implementation &#39;com.google.android.recaptcha:recaptcha:18.2.1&#39;

When I implement the code, it does not recognize the recaptcha classes and cannot import

private void initializeRecaptchaClient() {
    Recaptcha
      .getTasksClient(getApplication(), &quot;YOUR_SITE_KEY&quot;)
      .addOnSuccessListener(
          this,
          new OnSuccessListener&lt;RecaptchaTasksClient&gt;() {
            @Override
            public void onSuccess(RecaptchaTasksClient client) {
              MainActivity.this.recaptchaTasksClient = client;
            }
          })
      .addOnFailureListener(
          this,
          new OnFailureListener() {
            @Override
            public void onFailure(@NonNull Exception e) {
              // Handle communication errors ...
              // See &quot;Handle communication errors&quot; section
            }
          });
  }

答案1

得分: 1

你可以在recaptcha包中检查类文件。如果文件显示关于Kotlin编译器ABI版本的问题,你可以检查你的Kotlin编译器ABI版本(文件->设置->搜索Kotlin),看它是否低于所需版本。我应该更改Kotlin编译器ABI版本,然后我发现我的Android Studio版本是3.5.3,它仅支持API版本1.3。如果你想支持API版本1.8,你应该下载新的Android Studio。你可以从kotlin官网找到正确的Android版本。

英文:

You can check class file in recaptcha package. If the files shows some problem about kotlin compiler abi version, you check your kotlin compiler abi version(File->Settings-> search kotlin) whether it is lower than needed. I should change kotlin compiler abi version, and then i find my android studio version is 3.5.3 and it is just support api version 1.3. If you want to support api version 1.8, you should download new android studio. You can find the correct android version from kotilin.

huangapple
  • 本文由 发表于 2023年6月8日 23:09:52
  • 转载请务必保留本文链接:https://go.coder-hub.com/76433299.html
匿名

发表评论

匿名网友

:?: :razz: :sad: :evil: :!: :smile: :oops: :grin: :eek: :shock: :???: :cool: :lol: :mad: :twisted: :roll: :wink: :idea: :arrow: :neutral: :cry: :mrgreen:

确定