I am developing an application with Flutter and deploying it to the Google play store. When I upload the app bundle to the tests it failed and I have no idea what these are. It works on iPhone and my emulators without any problem. I am using the Flutter Beta version because one of the issues I am facing is not fixed in stable versions. So I can't lower the Flutter version.
Dart version 2.18.0 (build 2.18.0-165.1.beta) Flutter version 3.1.0-9.0.pre
//app/build.gradle
defaultConfig {
applicationId "com.xxx.xxx"
minSdkVersion 21
targetSdkVersion 31
versionCode flutterVersionCode.toInteger()
versionName flutterVersionName
multiDexEnabled true
}
I have these errors in the screenshot. And I have no idea what these are and how to solve them. Can anyone give some advice? The details are below:
FATAL EXCEPTION: main
Process: com.google.android.apps.mtaas.deviceadmin, PID: 24263
java.lang.RuntimeException: Exception thrown in onCreate() of ComponentInfo{com.google.android.apps.mtaas.deviceadmin/com.google.android.apps.mtaas.deviceadmin.ToggleUserRestriction}: java.lang.SecurityException: No active admin ComponentInfo{com.google.android.apps.mtaas.deviceadmin/com.google.android.apps.mtaas.deviceadmin.DeviceAdminReceiver}
at android.app.ActivityThread.handleMakeApplication(ActivityThread.java:7033)
at android.app.ActivityThread.handleBindApplication(ActivityThread.java:6989)
at android.app.ActivityThread.access$1600(ActivityThread.java:272)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:2055)
at android.os.Handler.dispatchMessage(Handler.java:107)
at android.os.Looper.loop(Looper.java:237)
at android.app.ActivityThread.main(ActivityThread.java:8016)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:493)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1076)
Caused by: java.lang.SecurityException: No active admin ComponentInfo{com.google.android.apps.mtaas.deviceadmin/com.google.android.apps.mtaas.deviceadmin.DeviceAdminReceiver}
at android.os.Parcel.createException(Parcel.java:2088)
at android.os.Parcel.readException(Parcel.java:2056)
at android.os.Parcel.readException(Parcel.java:2004)
at android.app.admin.IDevicePolicyManager$Stub$Proxy.setUserRestriction(IDevicePolicyManager.java:12057)
at android.app.admin.DevicePolicyManager.addUserRestriction(DevicePolicyManager.java:9463)
at com.google.android.apps.mtaas.deviceadmin.ToggleUserRestriction.start(ToggleUserRestriction.java:49)
at com.google.android.apps.mtaas.deviceadmin.ToggleUserRestriction.onCreate(ToggleUserRestriction.java:22)
at android.app.ActivityThread.handleMakeApplication(ActivityThread.java:7028)
... 9 more
Caused by: android.os.RemoteException: Remote stack trace:
at com.android.server.devicepolicy.DevicePolicyManagerService.getActiveAdminWithPolicyForUidLocked(DevicePolicyManagerService.java:3259)
at com.android.server.devicepolicy.DevicePolicyManagerService.getActiveAdminOrCheckPermissionForCallerLocked(DevicePolicyManagerService.java:3155)
at com.android.server.devicepolicy.DevicePolicyManagerService.getActiveAdminForCallerLocked(DevicePolicyManagerService.java:3136)
at com.android.server.devicepolicy.DevicePolicyManagerService.setUserRestriction(DevicePolicyManagerService.java:11176)
at android.app.admin.IDevicePolicyManager$Stub.onTransact$setUserRestriction$(IDevicePolicyManager.java:18210)
2nd error:
FATAL EXCEPTION: main
Process: com.google.android.apps.mtaas.deviceadmin, PID: 24387
java.lang.RuntimeException: Exception thrown in onCreate() of ComponentInfo{com.google.android.apps.mtaas.deviceadmin/com.google.android.apps.mtaas.deviceadmin.SetUpdatePolicy}: java.lang.SecurityException: No active admin ComponentInfo{com.google.android.apps.mtaas.deviceadmin/com.google.android.apps.mtaas.deviceadmin.DeviceAdminReceiver}
at android.app.ActivityThread.handleMakeApplication(ActivityThread.java:7033)
at android.app.ActivityThread.handleBindApplication(ActivityThread.java:6989)
at android.app.ActivityThread.access$1600(ActivityThread.java:272)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:2055)
at android.os.Handler.dispatchMessage(Handler.java:107)
at android.os.Looper.loop(Looper.java:237)
at android.app.ActivityThread.main(ActivityThread.java:8016)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:493)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1076)
Caused by: java.lang.SecurityException: No active admin ComponentInfo{com.google.android.apps.mtaas.deviceadmin/com.google.android.apps.mtaas.deviceadmin.DeviceAdminReceiver}
at android.os.Parcel.createException(Parcel.java:2088)
at android.os.Parcel.readException(Parcel.java:2056)
at android.os.Parcel.readException(Parcel.java:2004)
at android.app.admin.IDevicePolicyManager$Stub$Proxy.setSystemUpdatePolicy(IDevicePolicyManager.java:13914)
at android.app.admin.DevicePolicyManager.setSystemUpdatePolicy(DevicePolicyManager.java:10286)
at com.google.android.apps.mtaas.deviceadmin.SetUpdatePolicy.start(SetUpdatePolicy.java:51)
at com.google.android.apps.mtaas.deviceadmin.SetUpdatePolicy.onCreate(SetUpdatePolicy.java:34)
at android.app.ActivityThread.handleMakeApplication(ActivityThread.java:7028)
... 9 more
Caused by: android.os.RemoteException: Remote stack trace:
at com.android.server.devicepolicy.DevicePolicyManagerService.getActiveAdminWithPolicyForUidLocked(DevicePolicyManagerService.java:3259)
at com.android.server.devicepolicy.DevicePolicyManagerService.getActiveAdminOrCheckPermissionForCallerLocked(DevicePolicyManagerService.java:3155)
at com.android.server.devicepolicy.DevicePolicyManagerService.getActiveAdminForCallerLocked(DevicePolicyManagerService.java:3136)
at com.android.server.devicepolicy.DevicePolicyManagerService.setSystemUpdatePolicy(DevicePolicyManagerService.java:12678)
at android.app.admin.IDevicePolicyManager$Stub.onTransact(IDevicePolicyManager.java:5997)
3rd error:
FATAL EXCEPTION: Instr: com.google.android.apps.mtaas.deviceadmin.HideApps
Process: com.google.android.apps.mtaas.deviceadmin, PID: 24912
java.lang.SecurityException: No active admin ComponentInfo{com.google.android.apps.mtaas.deviceadmin/com.google.android.apps.mtaas.deviceadmin.DeviceAdminReceiver}
at android.os.Parcel.createException(Parcel.java:2088)
at android.os.Parcel.readException(Parcel.java:2056)
at android.os.Parcel.readException(Parcel.java:2004)
at android.app.admin.IDevicePolicyManager$Stub$Proxy.isApplicationHidden(IDevicePolicyManager.java:12520)
at android.app.admin.DevicePolicyManager.isApplicationHidden(DevicePolicyManager.java:9590)
at com.google.android.apps.mtaas.deviceadmin.HideApps.onStart(HideApps.java:63)
at android.app.Instrumentation$InstrumentationThread.run(Instrumentation.java:2209)
Caused by: android.os.RemoteException: Remote stack trace:
at com.android.server.devicepolicy.DevicePolicyManagerService.getActiveAdminWithPolicyForUidLocked(DevicePolicyManagerService.java:3259)
at com.android.server.devicepolicy.DevicePolicyManagerService.getActiveAdminOrCheckPermissionForCallerLocked(DevicePolicyManagerService.java:3155)
at com.android.server.devicepolicy.DevicePolicyManagerService.getActiveAdminForCallerLocked(DevicePolicyManagerService.java:3136)
at com.android.server.devicepolicy.DevicePolicyManagerService.enforceCanManageScopeOrCheckPermission(DevicePolicyManagerService.java:7218)
at com.android.server.devicepolicy.DevicePolicyManagerService.enforceCanManageScope(DevicePolicyManagerService.java:7204)
4th error:
FATAL EXCEPTION: Instr: com.google.android.apps.mtaas.deviceadmin.HideApps
Process: com.google.android.apps.mtaas.deviceadmin, PID: 28724
java.lang.SecurityException: No active admin ComponentInfo{com.google.android.apps.mtaas.deviceadmin/com.google.android.apps.mtaas.deviceadmin.DeviceAdminReceiver}
at android.os.Parcel.createException(Parcel.java:2088)
at android.os.Parcel.readException(Parcel.java:2056)
at android.os.Parcel.readException(Parcel.java:2004)
at android.app.admin.IDevicePolicyManager$Stub$Proxy.isApplicationHidden(IDevicePolicyManager.java:12520)
at android.app.admin.DevicePolicyManager.isApplicationHidden(DevicePolicyManager.java:9590)
at com.google.android.apps.mtaas.deviceadmin.HideApps.onStart(HideApps.java:63)
at android.app.Instrumentation$InstrumentationThread.run(Instrumentation.java:2209)
Dependencies:
cupertino_icons: ^1.0.2
firebase_core: ^1.19.1
firebase_auth: ^3.4.1
firebase_database: ^9.0.18
cloud_firestore: ^3.2.1
firebase_storage: ^10.3.1
cloud_functions: ^3.3.2
firebase_app_check: ^0.0.6 12
font_awesome_flutter: ^10.1.0
google_fonts: ^3.0.1
smooth_page_indicator: ^1.0.0 2
flutter_riverpod: ^1.0.3
http: ^0.13.4
flutter_dotenv: ^5.0.2
modal_bottom_sheet: ^2.0.1
image_picker: ^0.8.5 3
filter_list: ^1.0.2
syncfusion_flutter_core: ^20.1.56
syncfusion_flutter_sliders: ^20.1.56
shimmer: ^2.0.0
flutter_rating_bar: ^4.0.1
blur: ^3.1.0
cached_network_image: ^3.2.1
flutter_slidable: ^1.3.0
youtube_player_flutter: ^8.1.0
loading_indicator: ^3.1.0
pull_to_refresh: ^2.0.0
google_sign_in: ^5.3.2
dropdown_search: ^5.0.1
toggle_switch: ^2.0.1
chips_choice_null_safety: ^2.0.2
flutter_speed_dial: ^6.0.0
auto_size_text: ^3.0.0
bouncing_widget: ^2.0.0
badges: ^2.0.3
flutter_launcher_icons: ^0.9.3
flutter_svg: ^1.1.1 1
flutter_cache_manager: ^3.3.0
string_similarity: ^2.0.0
shared_preferences: ^2.0.15
sign_in_with_apple: ^4.1.0
crypto: ^3.0.2
CodePudding user response:
Looks like you are using this package and its unable to fetch the admin
https://pub.dev/packages/device_policy_manager
Please remove this package if not used or if used please check the manifest if you have added
...
<receiver android:name="device.policy.manager.DeviceAdmin" android:permission="android.permission.BIND_DEVICE_ADMIN">
<meta-data android:name="android.app.device_admin" android:resource="@xml/policies" />
<intent-filter android:exported="true">
<action android:name="android.app.action.DEVICE_ADMIN_ENABLED" />
<action android:name="android.app.action.ACTION_DEVICE_ADMIN_DISABLE_REQUESTED" />
<action android:name="android.app.action.ACTION_DEVICE_ADMIN_DISABLED" />
</intent-filter>
</receiver>
<activity
.
.
.
</application>
CodePudding user response:
I didn't change anything in the code but built it 2 more times with different build numbers and now it passed the tests.
flutter clean
// then change build number in pubspec.yaml version: 1.0.1 1 to version: 1.0.1 2
flutter build appbundle --release