Trying to execute the below code :
class MainActivity : AppCompatActivity() {
override fun onCreate(savedInstanceState: Bundle?) {
super.onCreate(savedInstanceState)
setContentView(R.layout.activity_main)
Test().list.contains(1)
}
}
public class Test {
ArrayList<Integer> list;
public ArrayList<Integer> getList() {
return list;
}
}
and compilation fails at Test().list.contains(1)
with message :
Task :app:compileDebugKotlin FAILED e: /Users/sreejithcr/Documents/MyApplication/app/src/main/java/com/wxample/myapplication/MainActivity.kt: (13, 31): Overload resolution ambiguity: public open fun contains(@Nullable element: Int!): Boolean defined in java.util.ArrayList public open fun contains(@Nullable element: Int!): Boolean defined in java.util.ArrayList
What i understand is compiler finds 2 contains() with exact same signature and not sure which one to call.
gradle config :
ext.kotlin_version = '1.3.41'
classpath 'com.android.tools.build:gradle:3.4.2'
It is an issue with Android Studios API 29 R2
https://issuetracker.google.com/issues/139041608#comment3
Go Tools -> SDK Manager -> Uninstall Android 9.+, then install it again as Google rolled back R2 so you'll be back to R1
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With