启动应用后,Android 9手机会崩溃

时间:2018-09-07 12:51:34

标签: android android-9.0-pie

我的应用仅在android 9时崩溃。在其他android platforms上运行正常。可能是什么原因? 我收到以下错误:

  

ui.activities.StartActivity}:java.lang.SecurityException:从   用户0未经授权INTERACT_ACROSS_USERS成为用户-1或   不允许INTERACT_ACROSS_USERS_FULL

09-07 14:57:45.917 17829-17829/XXXXXXXXX E/AndroidRuntime: FATAL EXCEPTION: main
Process: XXXXXXXXX, PID: 17829
java.lang.RuntimeException: Unable to start activity ComponentInfo{XXXXXXXXX/XXXXXXXXX.ui.activities.StartActivity}: java.lang.SecurityException: Call from user 0 as user -1 without permission INTERACT_ACROSS_USERS or INTERACT_ACROSS_USERS_FULL not allowed.
    at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2913)
    at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:3048)
    at android.app.servertransaction.LaunchActivityItem.execute(LaunchActivityItem.java:78)
    at android.app.servertransaction.TransactionExecutor.executeCallbacks(TransactionExecutor.java:108)
    at android.app.servertransaction.TransactionExecutor.execute(TransactionExecutor.java:68)
    at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1808)
    at android.os.Handler.dispatchMessage(Handler.java:106)
    at android.os.Looper.loop(Looper.java:193)
    at android.app.ActivityThread.main(ActivityThread.java:6669)
    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:858)
 Caused by: java.lang.SecurityException: Call from user 0 as user -1 without permission INTERACT_ACROSS_USERS or INTERACT_ACROSS_USERS_FULL not allowed.
    at android.os.Parcel.createException(Parcel.java:1942)
    at android.os.Parcel.readException(Parcel.java:1910)
    at android.os.Parcel.readException(Parcel.java:1860)
    at android.view.accessibility.IAccessibilityManager$Stub$Proxy.addClient(IAccessibilityManager.java:295)
    at android.view.accessibility.AccessibilityManager.tryConnectToServiceLocked(AccessibilityManager.java:1125)
    at android.view.accessibility.AccessibilityManager.<init>(AccessibilityManager.java:358)
    at android.view.accessibility.AccessibilityManager.getInstance(AccessibilityManager.java:336)
    at android.view.View.setFlags(View.java:14008)
    at android.view.View.<init>(View.java:5565)
    at android.view.ViewGroup.<init>(ViewGroup.java:659)
    at android.view.ViewGroup.<init>(ViewGroup.java:655)
    at android.view.ViewGroup.<init>(ViewGroup.java:651)
    at android.view.ViewGroup.<init>(ViewGroup.java:647)
    at android.widget.FrameLayout.<init>(FrameLayout.java:78)
    at com.android.internal.policy.DecorView.<init>(DecorView.java:255)
    at com.android.internal.policy.PhoneWindow.generateDecor(PhoneWindow.java:2310)
    at com.android.internal.policy.PhoneWindow.installDecor(PhoneWindow.java:2662)
    at com.android.internal.policy.PhoneWindow.setContentView(PhoneWindow.java:410)
    at android.app.Activity.setContentView(Activity.java:2771)
    at XXXXXXXXX.ui.activities.StartActivity.onCreate(StartActivity.java:15)
    at android.app.Activity.performCreate(Activity.java:7136)
    at android.app.Activity.performCreate(Activity.java:7127)
    at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1271)
    at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2893)
    at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:3048) 
    at android.app.servertransaction.LaunchActivityItem.execute(LaunchActivityItem.java:78) 
    at android.app.servertransaction.TransactionExecutor.executeCallbacks(TransactionExecutor.java:108) 
    at android.app.servertransaction.TransactionExecutor.execute(TransactionExecutor.java:68) 
    at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1808) 
    at android.os.Handler.dispatchMessage(Handler.java:106) 
    at android.os.Looper.loop(Looper.java:193) 
    at android.app.ActivityThread.main(ActivityThread.java:6669) 
    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:858) 
 Caused by: android.os.RemoteException: Remote stack trace:
    at com.android.server.accessibility.AccessibilityManagerService$SecurityPolicy.resolveCallingUserIdEnforcingPermissionsLocked(AccessibilityManagerService.java:3522)
    at com.android.server.accessibility.AccessibilityManagerService.addClient(AccessibilityManagerService.java:487)
    at android.view.accessibility.IAccessibilityManager$Stub.onTransact(IAccessibilityManager.java:82)
    at android.os.Binder.execTransact(Binder.java:731)

09-07 14:57:49.921 17829-17829 / XXXXXXXXX E / CrashlyticsCore:无法执行任务。     java.util.concurrent.TimeoutException         在java.util.concurrent.FutureTask.get(FutureTask.java:206)         在com.crashlytics.android.core.CrashlyticsBackgroundWorker.submitAndWait(CrashlyticsBackgroundWorker.java:41)         在com.crashlytics.android.core.CrashlyticsController.handleUncaughtException(CrashlyticsController.java:320)         在com.crashlytics.android.core.CrashlyticsController $ 6.onUncaughtException(CrashlyticsController.java:300)         在com.crashlytics.android.core.CrashlyticsUncaughtExceptionHandler.uncaughtException(CrashlyticsUncaughtExceptionHandler.java:42)         在java.lang.ThreadGroup.uncaughtException(ThreadGroup.java:1068)         在java.lang.ThreadGroup.uncaughtException(ThreadGroup.java:1063)         在java.lang.Thread.dispatchUncaughtException(Thread.java:1955)

<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:orientation="vertical" android:layout_width="match_parent"
android:layout_height="match_parent">
<ImageView
    android:id="@+id/imageView"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:scaleType="centerCrop"
    android:src="@drawable/splash"/>
</LinearLayout>

OnCreate:
@Override
protected void onCreate(Bundle savedInstanceState) {
   super.onCreate(savedInstanceState);
   setContentView(R.layout.activity_splash);




Manifest:
<activity
       android:name=".ui.activities.StartActivity"
       android:launchMode="singleTask"
       android:screenOrientation="portrait" >
       <intent-filter>
           <action android:name="android.intent.action.MAIN" />
           <category android:name="android.intent.category.LAUNCHER" />
       </intent-filter>
   </activity>

2 个答案:

答案 0 :(得分:0)

Android 9具有旋转,省电等新功能。是否尝试从代码内部获取设备旋转许可?不断将其设置为纵向模式可能是一个错误。

答案 1 :(得分:-1)

在清单中添加此android:protectionLevel =“ signature”。

添加权限

<permission android:name="android.permission.INTERACT_ACROSS_USERS_FULL" android:protectionLevel="signature"/>