Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

调用.registerCallbacks(new OnFloatCallbacks(){方法一直编译报错 #14

Closed
fengzhous opened this issue Sep 10, 2019 · 3 comments
Closed

Comments

@fengzhous
Copy link

错误: 无法访问Function1
.registerCallbacks(new OnFloatCallbacks() {
^
找不到kotlin.jvm.functions.Function1的类文件

怎么弄都报这个,奇怪

@princekin-f
Copy link
Owner

  • 这是一个重载方法,在纯Java中确实报这个错,如果项目支持kotlin就正常;
  • 我很迷茫,正在想办法解决...

@princekin-f
Copy link
Owner

这个问题和Gradle版本有关,可能是方法重载时的特殊处理,导致的异常情况。

我们可以从下面几个方面着手:

  • 1,使用低版本Gradle构造工具,实测正常使用;
  • 2,为项目配置kotlin语言,Tools ->Kotlin ->Configure Kotlin in Project,实测正常使用;
  • 3,registerCallbacks不使用方法重载,使用两个不同的方法名,没有测试,但应该可以。

比较推荐方案2,毕竟我们早晚要入kotlin的坑...

@fengzhous
Copy link
Author

感谢耐心解答,我项目使用了你这个库就好像必须配置Kotlin,所以应该是已经配置过Kotlin的,再按你2所说的步骤去配置点击提示:All moudules with Kotlin files are configured,但是还是会报这个错误,然后我修改了这个重构的方法名字,就可以了

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants