无法找到符号 SplashScreen.installSplashScreen(this);
Cannot Find Symbol SplashScreen.installSplashScreen(this);
在 android 12 中使用 developer.android migration guide 作为启动画面。我的 build.grade 有
android {
compileSdkVersion 31
...
}
dependencies {
...
implementation 'androidx.core:core-splashscreen:1.0.0-alpha01'
}
清单和主题也设置好了。我遇到的问题是
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
// Handle the splash screen transition.
SplashScreen splashScreen = SplashScreen.installSplashScreen(this);
setContentView(R.layout.main_activity);
}
}
我遇到错误:找不到符号 SplashScreen.installSplashScreen(this); Android Studio 中的 .installSplashScreen 部分代码为红色。
我看过this stack post with some suggestions.我都试过了
import android.window.SplashScreen;
import androidx.core.splashscreen.SplashScreen;
但是还是找不到符号。
我不确定用法是否正确 - 但也许是这样?
androidx.core.splashscreen.SplashScreen.installSplashScreen(this);
在 android 12 中使用 developer.android migration guide 作为启动画面。我的 build.grade 有
android {
compileSdkVersion 31
...
}
dependencies {
...
implementation 'androidx.core:core-splashscreen:1.0.0-alpha01'
}
清单和主题也设置好了。我遇到的问题是
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
// Handle the splash screen transition.
SplashScreen splashScreen = SplashScreen.installSplashScreen(this);
setContentView(R.layout.main_activity);
}
}
我遇到错误:找不到符号 SplashScreen.installSplashScreen(this); Android Studio 中的 .installSplashScreen 部分代码为红色。
我看过this stack post with some suggestions.我都试过了
import android.window.SplashScreen;
import androidx.core.splashscreen.SplashScreen;
但是还是找不到符号。
我不确定用法是否正确 - 但也许是这样?
androidx.core.splashscreen.SplashScreen.installSplashScreen(this);