Execution failed for task


#1

Hi!

I’am following the basic Android tutorial but writing in kotiln instead.

Trying to build the app, i get the following error:

Error:Execution failed for task ':app:compileDebugJavaWithJavac'.> Unable to read class file: 'D:\Development\Java\MyApp\app\build\tmp\kotlin-classes\debug\de\domain\appname\DisplayMessageActivity$onCreate$message$1.class'

MainActivity

import android.content.Intent
import android.support.v7.app.AppCompatActivity
import android.os.Bundle
import android.view.View
import kotlinx.android.synthetic.main.activity_main.*

class MainActivity : AppCompatActivity() {
    companion object {
        const val EXTRA_MESSAGE:String = "de.domain.appname.MESSAGE"
    }

    override fun onCreate(savedInstanceState: Bundle?) {
        super.onCreate(savedInstanceState)
        setContentView(R.layout.activity_main)
    }

    fun sendMessage(view: View?){
        val myIntent = Intent(this@MainActivity, DisplayMessageActivity::class.java)
        val message = editText.text.toString()
        myIntent.putExtra(EXTRA_MESSAGE, message)
        startActivity(myIntent)
    }
}

DisplayMessageActivity

import android.content.Intent
import android.support.v7.app.AppCompatActivity
import android.os.Bundle
import kotlinx.android.synthetic.main.activity_display_message.*

class DisplayMessageActivity : AppCompatActivity() {

    override fun onCreate(savedInstanceState: Bundle?) {
        super.onCreate(savedInstanceState)
        setContentView(R.layout.activity_display_message)

        val myIntent:Intent = intent
        val message = myIntent.getStringExtra(MainActivity.EXTRA_MESSAGE)
        textView.text = message
    }
}

Of course i looked this up with google, but could not find anythin that would apply to my case (the path to the jdk is defined).

Any ideas?


#2

Tried running the same code today and everything works fine…

Would still be intrested in finding the source of this error though.