应用在启动时,创建activity报错闪退,报错信息是”Activity {packageName/compomentName} did not call through to super.onCreate()” ,经确认,这个问题是梆梆加固的问题,请遇到的开发者联系梆梆加固厂商,用最新的版本升级即可。
05-13 09:53:25.471 10732 15838 15838 E AndroidRuntime: FATAL EXCEPTION: main
05-13 09:53:25.471 10732 15838 15838 E AndroidRuntime: Process: xxxx, PID: xxx
05-13 09:53:25.471 10732 15838 15838 E AndroidRuntime: android.util.SuperNotCalledException: Activity {xxx/xxxx} did not call through to super.onCreate()
05-13 09:53:25.471 10732 15838 15838 E AndroidRuntime: at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:3549)
05-13 09:53:25.471 10732 15838 15838 E AndroidRuntime: at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:3729)
..............................................//此处省略
// Determine whether the transition will be seamless.// Non-seamless transitions may cause a 1-2 second black screen.
Display display = context.getDisplay(); // API 30+
Display.Mode mode = display.getMode();
float[] refreshRates = mode.getAlternativeRefreshRates();
boolean willbeSeamless = Arrays.asList(refreshRates).contains(newRefreshRate);
// Set the frame rate even if the transition will not be seamless.
surface.setFrameRate(newRefreshRate, FRAME_RATE_COMPATIBILITY_FIXED_SOURCE, CHANGE_FRAME_RATE_ALWAYS);
PACKAGE_NAME: Targeting S+ (version 10000 and above) requires that one of
FLAG_IMMUTABLE or FLAG_MUTABLE be specified when creating a PendingIntent.
Strongly consider using FLAG_IMMUTABLE, only use FLAG_MUTABLE if
some functionality depends on the PendingIntent being mutable, e.g. if
it needs to be used with inline replies or bubbles.
publicclassMyReceiverimplementsOnReceiveContentListener {
publicstaticfinal String[] MIME_TYPES = new String[] {"image/*", "video/*"};
@Override
public ContentInfoCompat onReceiveContent(View view, ContentInfoCompat contentInfo) {
Pair<ContentInfoCompat, ContentInfoCompat> split = contentInfo.partition(
item -> item.getUri() != null);
ContentInfo uriContent = split.first;
ContentInfo remaining = split.second;
if (uriContent != null) {
ClipData clip = uriContent.getClip();
for (int i = 0; i < clip.getItemCount(); i++) {
Uri uri = clip.getItemAt(i).getUri();
// App-specific logic to handle the URI ...
}
}
// Return anything that your app didn't handle. This preserves the default platform// behavior for text and anything else that you aren't implementing custom handling for.return remaining;
}
}
// Create a new event for the activity.
@Override
protectedvoidonCreate(@Nullable Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
// Set the layout for the content view.
setContentView(R.layout.main_activity);
// Set up an OnPreDrawListener to the root view.final View content = findViewById(android.R.id.content);
content.getViewTreeObserver().addOnPreDrawListener(
new ViewTreeObserver.OnPreDrawListener() {
@Override
publicbooleanonPreDraw() {
// Check if the initial data is ready.if (mViewModel.isReady()) {
// The content is ready; start drawing.
content.getViewTreeObserver().removeOnPreDrawListener(this);
returntrue;
} else {
// The content is not ready; suspend.returnfalse;
}
}
});
}
@Override
protectedvoidonCreate(@Nullable Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
// ...// Add a callback that's called when the splash screen is animating to// the app content.
getSplashScreen().setOnExitAnimationListener(splashScreenView -> {
final ObjectAnimator slideUp = ObjectAnimator.ofFloat(
splashScreenView,
View.TRANSLATION_Y,
0f,
-splashScreenView.getHeight()
);
slideUp.setInterpolator(new AnticipateInterpolator());
slideUp.setDuration(200L);
// Call SplashScreenView.remove at the end of your custom animation.
slideUp.addListener(new AnimatorListenerAdapter() {
@Override
publicvoidonAnimationEnd(Animator animation) {
splashScreenView.remove();
}
});
// Run your animation.
slideUp.start();
});
}
// Get the duration of the animated vector drawable.long animationDuration = splashScreenView.getIconAnimationDurationMillis();
// Get the start time of the animation.long animationStart = splashScreenView.getIconAnimationStartMillis();
// Calculate the remaining duration of the animation.long remainingDuration = Math.max(
animationDuration - (SystemClock.uptimeMillis() - animationStart),
0L
);
// Listener is called immediately after the user exits PIP but before animating.
playerView.addOnLayoutChangeListener { _, left, top, right, bottom,
oldLeft, oldTop, oldRight, oldBottom ->
if (left != oldLeft || right != oldRight || top != oldTop
|| bottom != oldBottom) {
// The playerView's bounds changed, update the source hint rect to // reflect its new bounds.
val sourceRectHint = Rect()
playerView.getGlobalVisibleRect(sourceRectHint)
setPictureInPictureParams(
PictureInPictureParams.Builder()
.setSourceRectHint(sourceRectHint)
.build()
)
}
}