Kotlin activity Startup and Compile Error [How to Solve]

The android project added an activity written in kotlin code and tried to launch the page.
The error is reported as follows:

C:\Users\15901\Desktop\ShangXueTang\app\src\main\java\com\example\shangxuetang\MainActivity.java:41: ����: �Ҳ�������
startActivity(new Intent(MainActivity.this, LifecycleActivity.class));
^
����: �� LifecycleActivity
�: �� MainActivity
1 ������

 

Solution:

    1. Add the following two lines of configuration to build.gradle(:app)
apply plugin: 'kotlin-android'
apply plugin: 'kotlin-android-extensions'
    1. add the dependency path.
dependencies {
        classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
        }

Read More: