以下类的超types无法解析

我有android app在kotlin这是给我这个错误.. 错误:以下类的超types无法解析。 请确保您在类路径中具有所需的依赖关系:com.google.firebase.auth.FirebaseAuth,未解析的超types:com.google.android.gms.internal.aad 和这个 错误:执行任务’:app:compileDebugKotlin’失败。 编译错误。 查看日志了解更多详情 这是我的应用程序模块 apply plugin: ‘com.android.application’ apply plugin: ‘kotlin-android’ apply plugin: ‘kotlin-android-extensions’ android { compileSdkVersion 26 defaultConfig { applicationId “appname” minSdkVersion 15 targetSdkVersion 26 versionCode 1 versionName “1.0” testInstrumentationRunner “android.support.test.runner.AndroidJUnitRunner” } buildTypes { release { minifyEnabled false proguardFiles getDefaultProguardFile(‘proguard-android.txt’), ‘proguard-rules.pro’ } } } dependencies { implementation fileTree(dir: ‘libs’, include: […]

从Fragment调用Anko toast()方法会导致java.lang.NoSuchMethodError

当我从Android Fragment调用toast(“Toast的消息文本”)时出现以下错误: java.lang.NoSuchMethodError:无虚方法getActivity()Landroid / app / Activity; 在类Landroid / support / v4 / app / Fragment中; 或者它的超类(“android.support.v4.app.Fragment”声明出现在文件类名索引中) 我使用的是Anko v0.9.1和Kotlin 1.0.6 什么可能是这次崩溃的原因? 标准的Android吐司工作得很好。 另外Toast()函数在Activity内工作。

Kotlin从Recyclerview新的片段

我试图从当前片段的RecyclerView适配器打开一个新的片段。但我不知道如何设置onClickListener ..这是我的代码 internal class ContentAdapter constructor (private var dataList: ArrayList) : RecyclerView.Adapter(), View.OnClickListener { override fun onClick(v: View?) { val manager = activity.supportFragmentManager // I cannot resolve activity here val transaction = manager.beginTransaction() val book = IndividualBook() transaction.add(android.R.id.content, book, “IndividualBook”) transaction.addToBackStack(null) transaction.commit() } override fun getItemCount(): Int = dataList.size override fun onCreateViewHolder(parent: ViewGroup?, viewType: Int): […]

你如何设置Kotlin,Gradle和Web框架的Spring Loaded?

我是JVM的新手,有兴趣尝试Kotlin进行REST风格的Web开发。 热重新加载是我习惯于从Python,Ruby和JavaScript等动态脚本语言开发的function。 玩,Dropwizard和Spring Boot都显得有吸引力。 我会愿意使用上述任何一种,但是我一直无法得到一个简单的“保存文件,重新加载网页”的工作流与任何上述设置。 这怎么能做到呢?

使用OkHttp上传到预先签署的S3 URL失败

当我尝试使用OkHttp 3.9.1将文件上传到Amazon S3的预签名URL时,出现SSLexception: SSLException: Write error: ssl=0xa0b73280: I/O error during system call, Connection reset by peer 这是同样的问题,在另一个SO问题,但在我的情况下,它总是失败。 我只上传大小超过1MiB的文件,我还没有尝试过小文件。 正如我在这个问题的答案中提到的,切换到Java的HttpURLConnection解决了这个问题,上传完美。 这里是我的RequestBody实现(在Kotlin)从Android的Uri上传文件,我使用OkHttp的.put()方法: class UriRequestBody(private val file: Uri, private val contentResolver: ContentResolver, private val mediaType: MediaType = MediaType.parse(“application/octet-stream”)!!): RequestBody() { override fun contentLength(): Long = -1L override fun contentType(): MediaType? = mediaType override fun writeTo(sink: BufferedSink) { Okio.source((contentResolver.openInputStream(file))).use […]

JFoenix:JFXPopup周围不需要的填充

我创建了一个JavaFX应用程序,使用JFoenix库进行样式设计,使其具有Material Design的外观和感觉。 在右上角有一个类似Android的菜单。 打开时显示一个JFXPopup。 但是,有不希望的填充? 在它周围,我无法删除(按钮上方的白色空间更精确)。 看到下面的图片: 在内部,有一个包含JFXHamburger的JFXRippler。 菜单项以及菜单/popup窗口的打开是通过以下(Kotlin)代码以编程方式完成的: // Create list items val list = JFXListView() for (i in 1..4) list.items.add(“Item ” + i) // Create the popup and open it when the menu item is clicked val popup = JFXPopup(list) ripplerMenu.setOnMouseClicked { popup.show(ripplerMenu, PopupVPosition.TOP, PopupHPosition.RIGHT) } 我已经尝试了以下的东西: 使用ripplerMenu.background = Background.EMPTY设置JFXRippler组件的ripplerMenu.background = Background.EMPTY 通过CSS我试图设置jfx-popup-container和jfx-list-view类的背景 […]

生成的类未find

使用Dagger2和Kotlin,当其他调用代码存在时,我的组件类实现不会被生成。 当没有调用代码存在时,生成实现。 例如 val comp = DaggerMyComponent.create() 导致构建失败, DaggerMyComponent不会生成,因此无法find // val comp = DaggerMyComponent.create() DaggerMyComponent类是生​​成的,可以在磁盘上查看,构建成功。 我试过了Dagger 2.0.1,2.0.2,2.1-Snapshot,使用Kotlin beta-1103。 如果需要,我可以发布我的gradle文件,源代码或堆栈跟踪。 有没有人遇到过这个问题?

如何使圆角的ImageView?

在Android中,默认情况下ImageView是一个矩形。 我怎样才能使它在ImageView中的一个圆角的矩形(剪切掉我的位图的所有四个角落是圆角矩形)?

如何更改SearchView上的默认图标,以在Android上的操作栏中使用?

我在自定义SearchView中的搜索图标时遇到了一些麻烦。 在我看来,图标可以在Item属性中更改,对吧? 只要检查下面的代码 有人能告诉我我做错了什么吗? 这是我正在使用的菜单,我的自定义搜索图标icn_lupa 。 但是,当我运行的应用程序,我总是得到默认的搜索图标… 提前致谢。

读取一个txt文件并在Android中输出为TextView

我正在尝试读取已保存在我的目录中的文本文件,并将其作为TextView打印在屏幕上。 这是迄今为止的代码。 但是,当我运行应用程序,它会创建一个说“错误读取文件”的吐司。 我在这里做错了什么? public class sub extends Activity { private TextView text; protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.text); //text = (TextView) findViewById(R.id.summtext); //File file = new File(“inputNews.txt”); //StringBuilder text = new StringBuilder(); try { InputStream in = openFileInput(“inputNews.txt”); if(in != null){ InputStreamReader reader = new InputStreamReader(in); BufferedReader br = new BufferedReader(reader); StringBuilder text […]