2

Using developer.android migration guide for splash screens in android 12. My build.grade has

android {
   compileSdkVersion 31
   ...
}
dependencies {
   ...
   implementation 'androidx.core:core-splashscreen:1.0.0-alpha01'
}

Manifest and theme also set up. The issue I am having is with

protected void onCreate(Bundle savedInstanceState) {
         super.onCreate(savedInstanceState);

         // Handle the splash screen transition.
         SplashScreen splashScreen = SplashScreen.installSplashScreen(this);
         setContentView(R.layout.main_activity);
    }
}

I am getting error: cannot find symbol SplashScreen.installSplashScreen(this); with the .installSplashScreen part of code in red in Android Studio.

I have seen this stack post with some suggestions. I have tried both

import android.window.SplashScreen;
import androidx.core.splashscreen.SplashScreen;

But still getting cannot find symbol.

BinDev
  • 191
  • 13

2 Answers2

2

I'm not sure if there is correct usage - but maybe this?

androidx.core.splashscreen.SplashScreen.installSplashScreen(this);
BinDev
  • 191
  • 13
1

In my case if use this version:

implementation 'androidx.core:core-splashscreen:1.1.0-alpha01'

import does not work! but if use older version:

implementation 'androidx.core:core-splashscreen:1.0.0-alpha01'

it works!

Konstantin
  • 159
  • 7