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