Reputation: 35
I just created new empty activity in Android studio.
Splash Activity Class:
package com.example.layoutpractice
import androidx.appcompat.app.AppCompatActivity
import android.os.Bundle
class Splash : AppCompatActivity() {
override fun onCreate(savedInstanceState: Bundle?) {
super.onCreate(savedInstanceState)
setContentView(R.layout.activity_splash)
}
}
Splash Activity XML file:
//activity_splash.xml
<?xml version="1.0" encoding="utf-8"?>
<androidx.constraintlayout.widget.ConstraintLayout
xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="match_parent"
android:layout_height="match_parent">
</androidx.constraintlayout.widget.ConstraintLayout>
As you can see,
I made no changes to the code.
But I still get an error in Android Studio.
I even deleted and recreated the .xml file as recommended by the Android editor, but it didn't change.
Upvotes: 0
Views: 1964
Reputation: 26
Invalidate Caches and restart Android Studio. File
-> Invalidate Caches / Restart...
Upvotes: 0
Reputation: 157
Check that is there any import like
import android.R
if its there remove it and reimport
Upvotes: 1