kotlin-android-extensions

Error:(1, 0) Plugin with id 'kotlin-android-extensions' not found

懵懂的女人 提交于 2019-11-30 21:26:09
问题 apply plugin: 'kotlin-android-extensions'. When i add this extensions in android studio preview, give me this error "Error:(1, 0) Plugin with id 'kotlin-android-extensions' not found.". My build gradle apply plugin: 'com.android.application' android { compileSdkVersion 26 buildToolsVersion "26.0.1" defaultConfig { applicationId "com.example.mohamed_elbaz.myapplication" minSdkVersion 15 targetSdkVersion 26 versionCode 1 versionName "1.0" testInstrumentationRunner "android.support.test.runner

Out-projected type 'ArrayList<*>' prohibits the use of 'public open fun add(index: Int, element: E): Unit defined in java.util.ArrayList'

不打扰是莪最后的温柔 提交于 2019-11-30 11:14:21
I have this snippets: class RecyclerViewAdapter internal constructor( val clazz: Class<out RecyclerViewViewHolder>, val layout: Int, var dataList: MutableList<*>) ... ... ... fun RecyclerView.getDataList() : ArrayList<*> { return (adapter as RecyclerViewAdapter).dataList as ArrayList<*> } ... ... ... then I use that on this: recyclerView.getDataList().add(Person("Lem Adane", "41 years old", 0)) but I get this error: Error:(19, 31) Out-projected type 'ArrayList<*>' prohibits the use of 'public open fun add(index: Int, element: E): Unit defined in java.util.ArrayList' Kotlin star-projections are

com.android.tools.r8.errors.CompilationError: Program type already present: androidx.annotation.AnimRes

China☆狼群 提交于 2019-11-30 00:41:06
问题 I'm trying to rebuild my project which I've written in kotlin but it has constantly failed with the error Program type already present: androidx.annotation.AnimRes I've tried Invalidating cache cleaning and rebuilding using ./gradlew build --stacktrace --info command but without success. Exception is org.gradle.api.tasks.TaskExecutionException: Execution failed for task ':app:transformClassesWithMultidexlistForDebug' Stack trace is Caused by: java.lang.RuntimeException: com.android.build.api

Can't set visibility on constraint group

試著忘記壹切 提交于 2019-11-29 02:55:53
When i try to set the visibility of the group on button click,it doesn't affect the view's visibility.Using com.android.support.constraint:constraint-layout:1.1.0-beta4. I've tried setting it element-wise without problems,but no success with the group. My MainActivity.kt private fun toggleLoginUI(show: Boolean) { if (show) { group.visibility = VISIBLE } else { group.visibility = INVISIBLE } } fun onClick(view: View) { when (view.id) { R.id.button -> toggleLoginUI(true) R.id.button4 -> toggleLoginUI(false) } } My activity_main.xml <android.support.constraint.ConstraintLayout.. <TextView android

Accidental override: The following declarations have the same JVM signature

*爱你&永不变心* 提交于 2019-11-28 21:04:18
I'm getting this error in Kotlin in this part: class GitHubRepoAdapter(private val context: Context, private val values: List<GithubRepo>) : ArrayAdapter<GithubRepo>(context, R.layout.list_item, values) { private val context: Context in log it says: Error:(14, 25) Accidental override: The following declarations have the same JVM signature (getContext()Landroid/content/Context;): fun (): Context fun getContext(): Context! I'm not able to see what is causing the problem. This happens because the Kotlin compiler tries to generate a getter for val context declared in your class primary constructor

Kotlin synthetic in Adapter or ViewHolder

我们两清 提交于 2019-11-28 18:05:32
I am new in kotlin. I have found and tried to use synthetic method instead of annoying method findViewById in my Activity class, but I have found "If we want to call the synthetic properties on View (useful in adapter classes), we should also import kotlinx.android.synthetic.main.view.*." But I can't figure out how it exactly works? Is there any examples? Simple example from https://github.com/antoniolg/Kotlin-for-Android-Developers import kotlinx.android.synthetic.item_forecast.view.* class ForecastListAdapter() : RecyclerView.Adapter<ForecastListAdapter.ViewHolder>() { class ViewHolder(view:

Program type already present: org.intellij.lang.annotations.Flow

对着背影说爱祢 提交于 2019-11-28 10:46:09
I am getting this error whenever I try to run a program in Kotlin. My gradle files are like this: Project Level Gradle buildscript { ext.kotlin_version = '1.2.30' repositories { google() jcenter() } dependencies { classpath 'com.android.tools.build:gradle:3.1.1' classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version" classpath 'com.google.gms:google-services:3.2.0' } } allprojects { repositories { google() jcenter() } } task clean(type: Delete) { delete rootProject.buildDir } And App Level Gradle apply plugin: 'com.android.application' apply plugin: 'kotlin-android' apply plugin:

Can't set visibility on constraint group

久未见 提交于 2019-11-27 17:09:18
问题 When i try to set the visibility of the group on button click,it doesn't affect the view's visibility.Using com.android.support.constraint:constraint-layout:1.1.0-beta4. I've tried setting it element-wise without problems,but no success with the group. My MainActivity.kt private fun toggleLoginUI(show: Boolean) { if (show) { group.visibility = VISIBLE } else { group.visibility = INVISIBLE } } fun onClick(view: View) { when (view.id) { R.id.button -> toggleLoginUI(true) R.id.button4 ->

Accidental override: The following declarations have the same JVM signature

泄露秘密 提交于 2019-11-27 13:25:13
问题 I'm getting this error in Kotlin in this part: class GitHubRepoAdapter(private val context: Context, private val values: List<GithubRepo>) : ArrayAdapter<GithubRepo>(context, R.layout.list_item, values) { private val context: Context in log it says: Error:(14, 25) Accidental override: The following declarations have the same JVM signature (getContext()Landroid/content/Context;): fun (): Context fun getContext(): Context! I'm not able to see what is causing the problem. 回答1: This happens

Unresolved reference: kotlinx

 ̄綄美尐妖づ 提交于 2019-11-27 11:51:46
I am trying to try out Kotlin and the Kotlin Android extensions in Android Studio. I have tried this both in Android Studio v 1.5.1 on Ubuntu 14.04, and in Android Studio v 1.5.1 on OS X El Capitan with the same result. Here is what I am doing: I install the Kotlin plugin 1.0.0-beta-35950-IJ141-11 Create a new blank Android project Convert the MainActivity file to Kotlin (via help->findaction->convert file to kotlin) Configure the project for Kotlin I then go into the generated content_main.xml file and add an id (hello) for the "Hello World!" TextView. <?xml version="1.0" encoding="utf-8"?>