Preface: I am using Flutter
to develop an Android app
.But I found that when I open the App and then switch to the background, and then reopen the App after a while, the App will be stuck on the startup page and cannot be opened normally
.
This is my MainActivity
:
class MainActivity: FlutterActivity() {
///There is Nothing.
}
This is my AndroidManifest.xml configuration:
<activity
android:name=".MainActivity"
android:configChanges="orientation|keyboardHidden|keyboard|screenSize|smallestScreenSize|locale|layoutDirection|fontScale|screenLayout|density|uiMode"
android:exported="true"
android:hardwareAccelerated="true"
android:launchMode="singleTop"
android:theme="@style/LaunchTheme"
android:windowSoftInputMode="adjustResize">
<meta-data
android:name="io.flutter.embedding.android.NormalTheme"
android:resource="@style/NormalTheme" />
<meta-data
android:name="io.flutter.app.android.SplashScreenUntilFirstFrame"
android:value="true" />
<meta-data
android:name="io.flutter.embedding.android.SplashScreenDrawable"
android:resource="@drawable/launch_background" />
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
<meta-data
android:name="flutterEmbedding"
android:value="2" />
The launch_background
content is:
<?xml version="1.0" encoding="utf-8"?>
<layer-list xmlns:android="http://schemas.android.com/apk/res/android">
<item android:drawable="?android:colorBackground" />
<item>
<bitmap
android:gravity="center"
android:src="@mipmap/ic_logo" />
</item>
</layer-list>
And,the main.dart
code:
void main() async {
await onCreated();
runApp(const App());
}
class App extends StatelessWidget {
const App({super.key});
@override
Widget build(BuildContext context) {
return GetMaterialApp(
title: AppConfig.getAppName,
debugShowCheckedModeBanner: false,
locale: const Locale('zh', 'CN'),
fallbackLocale: const Locale('zh', 'CN'),
theme: ThemeData(
primaryColor: AppColors.primaryColor,
),
defaultTransition: Transition.rightToLeft,
getPages: AppRoutes.appRoutePages,
initialRoute: AppRoutes.getAppInitPage,
routingCallback: (value) {
AppRoutes.onAppRouteCallback(value);
},
builder: FlutterSmartDialog.init(),
navigatorObservers: [FlutterSmartDialog.observer],
localizationsDelegates: GlobalMaterialLocalizations.delegates,
supportedLocales: const [
Locale('zh', 'CN')
],
);
}
...
}
onCreated()
content is:
Future onCreated() async {
logInfo("#startAppInit");
WidgetsFlutterBinding.ensureInitialized();
await initMMKV();
await _queryAppInfo();
await CameraChecker.getInstance().startCheck();
await _init();
await _initAppEnv();
}
Through the following output log, you will find that the code "startAppInit" has no output.
Then, the output log in Logcat:
I SmartGc CheckAndAddTask : enable = 1 periodCheck = 0
I SmartGc CheckAndAddTask : enable = 1 periodCheck = 0
D Compat change id reported: 171979766; UID 10502; state: ENABLED
I setSystemFontMap SharedMemory
I setSystemFontMap Typaface
I applyConfigurationToResources: smallestScreenWidthDp = 443mMaxBounds = Rect(0, 0 - 1122, 2442)
W Unable to open '/system_ext/framework/androidx.window.extensions.dm': No such file or directory
W Unable to open '/system_ext/framework/androidx.window.extensions.dm': No such file or directory
I Init compatible state: true
D HwFrameworkSecurityPartsFactory in.
I add HwFrameworkSecurityPartsFactory to memory.
E Fail to acquire dataAnalyzerService...
W Unable to open '/system_ext/framework/androidx.window.sidecar.dm': No such file or directory
W Unable to open '/system_ext/framework/androidx.window.sidecar.dm': No such file or directory
W Unable to open '/data/app/~~KjocvaBbLJ3H408L42y5SQ==/com.silence.flutter_demo-6AYuhVbD68Z84OIS_YyisQ==/base.dm': No such file or directory
W Unable to open '/data/app/~~KjocvaBbLJ3H408L42y5SQ==/com.silence.flutter_demo-6AYuhVbD68Z84OIS_YyisQ==/base.dm': No such file or directory
W ApkAssets1 has N = 0
W ApkAssets1 has N = 0
W CUST VERSION = false, use class = class android.app.HwCustApplicationPackageManagerImpl
V ANGLE Developer option for 'com.silence.flutter_demo' set to: 'default'
V ANGLE GameManagerService for com.silence.flutter_demo: false
I apicache path=/storage/emulated/0 state=mounted key=com.silence.flutter_demo#0#256
V Updatable production driver is not supported on the device.
I need clear apicache,because volumes changed,oldCnt=0 newCnt=1
I SmartGc process: com.silence.flutter_demo enalbed: 1
I apicache path=/storage/emulated/0 state=mounted key=com.silence.flutter_demo#0#0
I need clear apicache,because volumes changed,oldCnt=1 newCnt=1
D Using Network Security Config from resource network_security_config debugBuild: true
D Using Network Security Config from resource network_security_config debugBuild: true
I VM with version 2.1.0 has multidex support
I Installing application
I VM has multidex support, MultiDex support library is disabled.
I init processName:com.silence.flutter_demo pid=24330 uid=10502
E AtomicFileUtils: readFileLines file not exist: AtomicFile[/data/user/0/com.silence.flutter_demo/files/hw_cached_resid.list]
I loadHwSystemFonts, isNightMode false, fontWeightScale is 100
I update not variable theme font
I finishPreloaded preloadStatus 0
V Handling launch of ActivityRecord{a1e9942 token=android.os.BinderProxy@debb38d {com.silence.flutter_demo/com.silence.flutter_demo.MainActivity}}
D disableOutlineDraw is true
W ApkAssets1 has N = 0
W ApkAssets1 has N = 0
E isInSupportList 'com.silence.flutter_demo' is a game? no; or product supported? yes
I [GetTotalMemory] total memory =7471888KB
I [0020080c] pn: com.silence.flutter_demo, p: 24330
I HwCustType is 0
E open file error
I no cota live update cust policy found
I GetCfgDirRealPolicyValue: custPolicyDirs: /system/magic/base:/system/magic/china:/system/magic/oversea:/system/magic/china_honor:/system/magic/oversea_honor:/vendor/etc:/odm/cust/all/cn:/odm/etc:/odm/hn_odm/LGE-AN00:/product_h/etc:/product_h/region_comm/china:/preas/china:/product_h/hn_oem/LGE-AN00:/preload/LGE-AN00/all/cn:/cust/global:/cust/def/cn:/version/cust/all/cn:/version/special_cust/LGE-AN00/all/cn:/cust/cotalite:/cust/ecota
I [0030080c] no spt app: com.silence.flutter_demo
V callActivityOnCreate
I Found extracted resources res_timestamp-2-1701048852257
W ApkAssets1 has N = 0
W ApkAssets1 has N = 0
D [SkFontMgr Android Parser] /system/etc/fonts.xml:1830:4: warning: 'ChineseBigSizeL' alias target not found
D [SkFontMgr Android Parser] /system/etc/fonts.xml:1831:4: warning: 'ChineseBigSizeL' alias target not found
D [SkFontMgr Android Parser] /system/etc/fonts.xml:1832:4: warning: 'ChineseBigSizeL' alias target not found
D [SkFontMgr Android Parser] /system/etc/fonts.xml:1833:4: warning: 'ChineseBigSizeL' alias target not found
D [SkFontMgr Android Parser] /system/etc/fonts.xml:1834:4: warning: 'ChineseBigSizeL' alias target not found
D [SkFontMgr Android Parser] /system/etc/fonts.xml:1836:4: warning: 'ChineseBigSizeM' alias target not found
D [SkFontMgr Android Parser] /system/etc/fonts.xml:1837:4: warning: 'ChineseBigSizeM' alias target not found
D [SkFontMgr Android Parser] /system/etc/fonts.xml:1838:4: warning: 'ChineseBigSizeM' alias target not found
D [SkFontMgr Android Parser] /system/etc/fonts.xml:1839:4: warning: 'ChineseBigSizeM' alias target not found
D [SkFontMgr Android Parser] /system/etc/fonts.xml:1840:4: warning: 'ChineseBigSizeM' alias target not found
D [SkFontMgr Android Parser] /system/etc/fonts.xml:1842:4: warning: 'ChineseBigSizeS' alias target not found
D [SkFontMgr Android Parser] /system/etc/fonts.xml:1843:4: warning: 'ChineseBigSizeS' alias target not found
D [SkFontMgr Android Parser] /system/etc/fonts.xml:1844:4: warning: 'ChineseBigSizeS' alias target not found
D [SkFontMgr Android Parser] /system/etc/fonts.xml:1845:4: warning: 'ChineseBigSizeS' alias target not found
D [SkFontMgr Android Parser] /system/etc/fonts.xml:1846:4: warning: 'ChineseBigSizeS' alias target not found
D [SkFontMgr Android Parser] /system/etc/fonts.xml:1848:4: warning: 'ChineseBigSizeXs' alias target not found
D [SkFontMgr Android Parser] /system/etc/fonts.xml:1849:4: warning: 'ChineseBigSizeXs' alias target not found
D [SkFontMgr Android Parser] /system/etc/fonts.xml:1850:4: warning: 'ChineseBigSizeXs' alias target not found
D [SkFontMgr Android Parser] /system/etc/fonts.xml:1851:4: warning: 'ChineseBigSizeXs' alias target not found
D [SkFontMgr Android Parser] /system/etc/fonts.xml:1852:4: warning: 'ChineseBigSizeXs' alias target not found
W type=1400 audit(0.0:213440): avc: denied { read } for name="max_map_count" dev="proc" ino=14176327 scontext=u:r:untrusted_app:s0:c246,c257,c512,c768 tcontext=u:object_r:proc_max_map_count:s0 tclass=file permissive=0 app=com.qualcomm.timeservice
I QUALCOMM build : 2e98867c23, Ibac4945cc0
Build Date : 12/14/22
OpenGL ES Shader Compiler Version: EV031.36.08.16
Local Branch :
Remote Branch :
Remote Branch :
Reconstruct Branch :
I Build Config : S P 12.1.1 AArch64
I Driver Path : /vendor/lib64/egl/libGLESv2_adreno.so
I Driver Version : 0615.57
I PFP: 0x01730155, ME: 0x00000000
W Could not find QSPM HAL service. Skipping adreno profile processing.
D Scheduling upload for context TransportContext(cct, DEFAULT, MSRodHRwczovL2ZpcmViYXNlbG9nZ2luZy5nb29nbGVhcGlzLmNvbS92MGNjL2xvZy9iYXRjaD9mb3JtYXQ9anNvbl9wcm90bzNc) with jobId=-2113788497 in 30000ms(Backend next call timestamp 0). Attempt 1
D Compat change id reported: 194532703; UID 10502; state: ENABLED
D Scheduling upload for context TransportContext(cct, VERY_LOW, MSRodHRwczovL2ZpcmViYXNlbG9nZ2luZy5nb29nbGVhcGlzLmNvbS92MGNjL2xvZy9iYXRjaD9mb3JtYXQ9anNvbl9wcm90bzNc) with jobId=-2108807760 in 86400000ms(Backend next call timestamp 0). Attempt 1
I Considering local module com.google.mlkit.dynamite.barcode:10000 and remote module com.google.mlkit.dynamite.barcode:0
I Selected local version of com.google.mlkit.dynamite.barcode
W com.silence.flutter_demo requires the Google Play Store, but it is missing.
W The service for com.google.android.gms.common.internal.service.zap is not available: ConnectionResult{statusCode=SERVICE_INVALID, resolution=null, message=null}
I The Dart VM service is listening on http://127.0.0.1:42065/4_AJJF3o01A=/
W Accessing hidden method Landroid/view/accessibility/AccessibilityNodeInfo;->getSourceNodeId()J (unsupported,test-api, reflection, allowed)
W Accessing hidden method Landroid/view/accessibility/AccessibilityRecord;->getSourceNodeId()J (unsupported, reflection, allowed)
W Accessing hidden field Landroid/view/accessibility/AccessibilityNodeInfo;->mChildNodeIds:Landroid/util/LongArray; (unsupported, reflection, allowed)
W Accessing hidden method Landroid/util/LongArray;->get(I)J (unsupported, reflection, allowed)
D Storing event with priority=DEFAULT, name=FIREBASE_ML_SDK for destination cct
W A splash screen was provided to Flutter, but this is deprecated. See flutter.dev/go/android-splash-migration for migration steps.
D Upload for context TransportContext(cct, DEFAULT, MSRodHRwczovL2ZpcmViYXNlbG9nZ2luZy5nb29nbGVhcGlzLmNvbS92MGNjL2xvZy9iYXRjaD9mb3JtYXQ9anNvbl9wcm90bzNc) is already scheduled. Returning...
D Storing event with priority=VERY_LOW, name=FIREBASE_ML_SDK for destination cct
I old windowMode:0 new windoMode:1
D Upload for context TransportContext(cct, VERY_LOW, MSRodHRwczovL2ZpcmViYXNlbG9nZ2luZy5nb29nbGVhcGlzLmNvbS92MGNjL2xvZy9iYXRjaD9mb3JtYXQ9anNvbl9wcm90bzNc) is already scheduled. Returning...
I add activity client record, r= ActivityRecord{a1e9942 token=android.os.BinderProxy@debb38d {com.silence.flutter_demo/com.silence.flutter_demo.MainActivity}} token= android.os.BinderProxy@debb38d
I set decor visibility 4
I scaleDisplayModeInRog, return new display mode = {id=1, width=1122, height=2442, fps=60.000004, alternativeRefreshRates=[]}
I old windowMode:1 new windoMode:1
D dispatchInputInterval 1000000
W Access denied finding property "ro.vendor.display.precompile_skshader_config"
I isSystemInDarkMode isResUiModeYes: false, isDarkMode: false
I set decor visibility 0
W type=1400 audit(0.0:213441): avc: denied { read } for name="u:object_r:vendor_display_prop:s0" dev="tmpfs" ino=589 scontext=u:r:untrusted_app:s0:c246,c257,c512,c768 tcontext=u:object_r:vendor_display_prop:s0 tclass=file permissive=0 app=com.qualcomm.timeservice
D onViewRootImplSet activityToken android.os.BinderProxy@debb38d,activityClientRecord ActivityRecord{a1e9942 token=android.os.BinderProxy@debb38d {com.silence.flutter_demo/com.silence.flutter_demo.MainActivity}},isHnNavigationHide false isHidePrivateFlag = false
D onViewRootImplSet activityToken android.os.BinderProxy@debb38d,activityClientRecord ActivityRecord{a1e9942 token=android.os.BinderProxy@debb38d {com.silence.flutter_demo/com.silence.flutter_demo.MainActivity}},isHwNavigationHide false
W depended package hiTouch does n't exist!
I HiTouch restricted: system app HiTouch don't exist.
D onAttached, package=com.silence.flutter_demo, windowType=1, mHiTouchRestricted=true
I 184819560 attach
I 184819560 win vis 0
I REFRESH_STATUS_BAR_ATTRS OnContentApplyWindowInsetsListener has SYSTEM_UI_LAYOUT_FLAGS
I SurfaceControl 0x7ae701bf30
I [](id:5f0a00000000,api:0,p:-1,c:24330) connect: controlledByApp=false
I BLASTBufferQueue : comm:ycnet.pv_manage isTargetApp:0
D RCS is disable
I REFRESH_STATUS_BAR_ATTRS OnContentApplyWindowInsetsListener has SYSTEM_UI_LAYOUT_FLAGS
I 184819560 setWindowStopped false
I [VRI[MainActivity]#0(BLAST Consumer)0](id:5f0a00000000,api:0,p:-1,c:24330) connect: api=1 producerControlledByApp=true
I SurfaceControl 0x7ae701c2a0
E Unable to match the desired swap behavior.
I SurfaceControl 0x7ae701f210
I SurfaceControl 0x7ae701f160
I SurfaceControl 0x7ae701e0e0
I [](id:5f0a00000001,api:0,p:-1,c:24330) connect: controlledByApp=false
I 184819560 create Surface(name=SurfaceView[com.silence.flutter_demo/com.silence.flutter_demo.MainActivity])/@0xff75db9 Surface(name=Background for SurfaceView[com.silence.flutter_demo/com.silence.flutter_demo.MainActivity])/@0xf775fe Surface(name=SurfaceView[com.silence.flutter_demo/com.silence.flutter_demo.MainActivity](BLAST))/@0xfc4d15f android.graphics.BLASTBufferQueue@d1247ac
I [SurfaceView[com.silence.flutter_demo/com.silence.flutter_demo.MainActivity]#1(BLAST Consumer)1](id:5f0a00000001,api:0,p:-1,c:24330) connect: api=1 producerControlledByApp=true
I SurfaceControl 0x7ae70003c0
I SurfaceControl 0x7ae701f370
I setAllowedHwForceDark:false package:com.silence.flutter_demo mCurrProcessState:0 mIsPackageNameChange:false hwForceDarkState:0 isViewAllowedForceDark:true isLastHonorForceDark:false
I AGPServiceClient ConnectLocked
W Expecting binder but got null!
I removeInvalidNode jank list is null
I init Rme, version is: v1.0
I init Rme, version is: v1.0
I current pid:24330 AppType:-1
D disableOutlineDraw is true
I init Rme, version is: v1.0
I current pid:24330 AppType:-1
D Compat change id reported: 193247900; UID 10502; state: ENABLED
I send MSG_WINDOW_FOCUS_CHANGED msg
D showOrHideHighlightView: hasFocus=true; winMode=1; isMrgNull=true
W startInputReason = 1
W startInputReason = 6
I SurfaceControl 0x7ae7020c30
I SurfaceControl 0x7ae7020b80
I SurfaceControl 0x7ae7011ae0
I nativeRelease 0x7ae701f370 count: 2
I ~SurfaceControl 0x7ae701f370
I nativeRelease 0x7ae70003c0 count: 2
I ~SurfaceControl 0x7ae70003c0
I nativeRelease 0x7ae701dcc0 count: 5
I ~SurfaceControl 0x7ae701dcc0
I init lrucache size: 4194304 pid=24330
V printErrorResource, maybe not an error because module has entative action to load resource.
D Installing profile for com.silence.flutter_demo
D Making request to: https://firebaselogging.googleapis.com/v0cc/log/batch?format=json_proto3
D tagSocket(4) with statsTag=0xffffffff, statsUid=-1
D tagSocket(4) with statsTag=0xffffffff, statsUid=-1
D tagSocket(4) with statsTag=0xffffffff, statsUid=-1
D tagSocket(4) with statsTag=0xffffffff, statsUid=-1
D tagSocket(4) with statsTag=0xffffffff, statsUid=-1
Hope teachers can help me,thanks.
How to resovle the question..