The error happens if you use try,catch inside btn.setOnClickListener on 123.67
``
public fun handleDownloadRecursiveOpml(){
var btn = findView<Button>(R.id.tryout_download_recursive_opml_btn)
btn.setOnClickListener {
var req: String?
val url = “http://opmlviewer.com/Content/Directories.opml”
try{
req = HttpRequest.get(url)?.body()
}
catch(e: HttpRequestException){
var ex = e.getCause()
Log.d(TAG, “Error in downloading OPML $url”)
toastee(“Error in downloading OPML from $url”)
}
val opml = transformFromXml(req)
if(opml.isTrue()){
toastee(“Opml parsing is Great”)
} else{
toastee(“Error in parsing opml ${opml.exception?.getMessage()}”)
}
}
}
public fun OnClickListener(action: (View?) -> Unit): OnClickListener {
return object : OnClickListener {
public override fun onClick(p0: View?) {
action(p0)
}
}
}
public fun View.setOnClickListener(action: (View?) -> Unit): Unit {
setOnClickListener(OnClickListener(action))
}
Error:[AndroidRivers] EXCEPTION FROM SIMULATION: Error:[AndroidRivers] local 0002: invalid Error:[AndroidRivers] ...at bytecode offset 00000063 Error:[AndroidRivers] locals[0000]: Lcom/silverkeytech/android_rivers/TryOutActivity$handleDownloadRecursiveOpml$1; Error:[AndroidRivers] locals[0001]: Landroid/view/View; Error:[AndroidRivers] locals[0002]: <invalid> Error:[AndroidRivers] locals[0003]: Ljava/lang/String; Error:[AndroidRivers] locals[0004]: <invalid> Error:[AndroidRivers] locals[0005]: <invalid> Error:[AndroidRivers] stack[top0]: Lcom/silverkeytech/android_rivers/TryOutActivity; Error:[AndroidRivers] ...while working on block 0063 Error:[AndroidRivers] ...while working on method invoke:(Landroid/view/View;)V Error:[AndroidRivers] ...while processing invoke (Landroid/view/View;)V Error:[AndroidRivers] ...while processing C:/Users/Dody/Documents/GitHub/AndroidRivers/out/production/AndroidRivers/com/silverkeytech/android_rivers/TryOutActivity$handleDownloadRecursiveOpml$1.class Error:[AndroidRivers] 1 error; aborting