英文:
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 'com.google.android.recaptcha:recaptcha:18.2.1'
When I implement the code, it does not recognize the recaptcha classes and cannot import
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) {
// Handle communication errors ...
// See "Handle communication errors" 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.
通过集体智慧和协作来改善编程学习和解决问题的方式。致力于成为全球开发者共同参与的知识库,让每个人都能够通过互相帮助和分享经验来进步。
评论