这是清单文件,该应用程序在android 9以下的所有版本上均可正常运行,但在android 10上仍会停止运行。

<?xml version="1.0" encoding="utf-8"?>
<uses-permission android:name="android.permission.ACCESS_FINE_LOCATION" />
<uses-permission android:name="android.permission.ACCESS_COARSE_LOCATION" />
<uses-permission android:name="android.permission.INTERNET" />
<uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE" />
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />
<uses-permission android:name="android.permission.CAMERA" />

<uses-feature android:name="android.hardware.location.gps" />

<application
    android:allowBackup="true"
    android:fullBackupContent="@xml/backup_descriptor"
    android:usesCleartextTraffic="true"
    android:icon="@mipmap/ic_launcher"
    android:label="@string/app_name"
    android:largeHeap="true"
    android:name="com.shops.nicofoods.MyApplication"
    android:roundIcon="@mipmap/ic_launcher_round"
    android:supportsRtl="true"
    android:theme="@style/AppTheme">
    <uses-library android:name="org.apache.http.legacy" android:required="false" />
    <meta-data
        android:name="com.google.android.gms.version"
        android:value="@integer/google_play_services_version" />
    <meta-data
        android:name="com.facebook.sdk.ApplicationId"
        android:value="@string/facebook_app_id" />

    <activity
        android:name="com.facebook.FacebookActivity"
        android:configChanges="keyboard|keyboardHidden|screenLayout|screenSize|orientation"
        android:label="@string/app_name" />

    <meta-data
        android:name="com.google.android.gms.wallet.api.enabled"
        android:value="true" />

    <activity
        android:name="com.shops.nicofoods.activities.WelcomeScreenActivity"
        android:screenOrientation="portrait"
        android:theme="@style/AppTheme.NoActionBar" />
    <activity
        android:name="com.shops.nicofoods.activities.SplashActivity"
        android:screenOrientation="portrait"
        android:theme="@style/AppTheme.NoActionBar">
        <intent-filter>
            <action android:name="android.intent.action.MAIN" />

            <category android:name="android.intent.category.LAUNCHER" />
        </intent-filter>
    </activity>
    <!-- Firebase Notifications -->
    <service android:name="com.shops.nicofoods.fcm.MyFirebaseMessagingService">
        <intent-filter>
            <action android:name="com.google.firebase.MESSAGING_EVENT" />
        </intent-filter>
    </service>
    <service android:name="com.shops.nicofoods.fcm.MyFirebaseInstanceIDService">
        <intent-filter>
            <action android:name="com.google.firebase.INSTANCE_ID_EVENT" />
        </intent-filter>
    </service>

    <!--<activity-->
        <!--android:name="com.braintreepayments.api.BraintreeBrowserSwitchActivity"-->
        <!--android:launchMode="singleTask">-->
        <!--<intent-filter>-->
            <!--<action android:name="android.intent.action.VIEW" />-->

            <!--<data android:scheme="${applicationId}.braintree" />-->

            <!--<category android:name="android.intent.category.DEFAULT" />-->
            <!--<category android:name="android.intent.category.BROWSABLE" />-->
        <!--</intent-filter>-->
    <!--</activity>-->
    <activity
        android:name="com.shops.nicofoods.HomeActivity"
        android:screenOrientation="portrait"
        android:theme="@style/AppTheme.NoActionBar"
        android:windowSoftInputMode="adjustNothing" />

    <meta-data
        android:name="com.google.android.geo.API_KEY"
        android:value="@string/p_apikey" />
    <meta-data
        android:name="com.razorpay.ApiKey"
        android:value="rzp_live_uwWRXIWmWvbvej"
        />
    <!-- <service -->
    <!-- android:name=".service.OrderStatusService" -->
    <!-- android:exported="false" /> -->

    <activity
        android:name="com.shops.nicofoods.activities.LoginActivity"
        android:screenOrientation="portrait"
        android:theme="@style/AppTheme.NoActionBar" />
    <activity
        android:name="com.shops.nicofoods.activities.AddCardActivity"
        android:screenOrientation="portrait"
        android:theme="@style/AppTheme.NoActionBar" />
    <activity
        android:name="com.shops.nicofoods.activities.OtpActivity"
        android:screenOrientation="portrait"
        android:theme="@style/AppTheme.NoActionBar" />
    <activity
        android:name="com.shops.nicofoods.activities.MobileNumberActivity"
        android:screenOrientation="portrait"
        android:theme="@style/AppTheme.NoActionBar" />
    <activity
        android:name="com.shops.nicofoods.activities.SignUpActivity"
        android:screenOrientation="portrait"
        android:theme="@style/AppTheme.NoActionBar" />
    <activity
        android:name="com.shops.nicofoods.activities.ForgotPasswordActivity"
        android:label="@string/forgot_password"
        android:parentActivityName="com.shops.nicofoods.activities.LoginActivity"
        android:screenOrientation="portrait"
        android:theme="@style/AppTheme.NoActionBar" />
    <activity
        android:name="com.shops.nicofoods.activities.HotelViewActivity"
        android:screenOrientation="portrait"
        android:theme="@style/AppTheme.NoActionBar" />
    <activity
        android:name="com.shops.nicofoods.activities.ChangePasswordActivity"
        android:label="Change Password"
        android:screenOrientation="portrait"
        android:theme="@style/AppTheme.NoActionBar" />
    <activity
        android:name="com.shops.nicofoods.activities.FavouritesActivity"
        android:screenOrientation="portrait"
        android:theme="@style/AppTheme.NoActionBar" />
    <activity
        android:name="com.shops.nicofoods.activities.RecommendedListActivity"
        android:screenOrientation="portrait"
        android:theme="@style/AppTheme.NoActionBar" />
    <activity
        android:name="com.shops.nicofoods.activities.EditAccountActivity"
        android:screenOrientation="portrait"
        android:theme="@style/AppTheme.NoActionBar" />
    <activity
        android:name="com.shops.nicofoods.activities.SetDeliveryLocationActivity"
        android:screenOrientation="portrait"
        android:theme="@style/AppTheme.NoActionBar" />
    <activity
        android:name="com.shops.nicofoods.activities.SaveDeliveryLocationActivity"
        android:theme="@style/AppTheme.NoActionBar" />
    <activity
        android:name="com.shops.nicofoods.activities.ManageAddressActivity"
        android:screenOrientation="portrait"
        android:theme="@style/AppTheme.NoActionBar" />
    <activity
        android:name="com.shops.nicofoods.activities.AccountPaymentActivity"
        android:screenOrientation="portrait"
        android:theme="@style/AppTheme.NoActionBar" />
    <activity
        android:name="com.shops.nicofoods.activities.OrdersActivity"
        android:screenOrientation="portrait"
        android:theme="@style/AppTheme.NoActionBar" />
    <activity
        android:name="com.shops.nicofoods.activities.FilterActivity"
        android:screenOrientation="portrait"
        android:theme="@style/AppTheme.NoActionBar" />
    <activity
        android:name="com.shops.nicofoods.activities.ViewCartActivity"
        android:screenOrientation="portrait"
        android:theme="@style/AppTheme.NoActionBar" />
    <activity
        android:name="com.shops.nicofoods.activities.PastOrderDetailActivity"
        android:screenOrientation="portrait"
        android:theme="@style/AppTheme.NoActionBar" />
    <activity
        android:name="com.shops.nicofoods.activities.OtherHelpActivity"
        android:screenOrientation="portrait"
        android:theme="@style/AppTheme.NoActionBar"
        android:windowSoftInputMode="adjustResize" />
    <activity
        android:name="com.shops.nicofoods.activities.NotificationActivity"
        android:screenOrientation="portrait"
        android:theme="@style/AppTheme.NoActionBar" />
    <activity
        android:name="com.shops.nicofoods.activities.PromotionActivity"
        android:screenOrientation="portrait"
        android:theme="@style/AppTheme.NoActionBar" />
    <activity
        android:name="com.shops.nicofoods.activities.CurrentOrderDetailActivity"
        android:screenOrientation="portrait"
        android:theme="@style/AppTheme.NoActionBar" />
    <activity
        android:name="com.shops.nicofoods.activities.AddMoneyActivity"
        android:screenOrientation="portrait"
        android:windowSoftInputMode="adjustNothing"
        android:theme="@style/AppTheme.NoActionBar" />
    <activity
        android:name="com.shops.nicofoods.activities.WalletActivity"
        android:screenOrientation="portrait"
        android:theme="@style/AppTheme.NoActionBar" />

    <meta-data
        android:name="io.fabric.ApiKey"
        android:value="3aef7a5b05836cf8166f23c95e43c52517bee917" />

    <activity
        android:name="com.shops.nicofoods.activities.ResetPasswordActivity"
        android:screenOrientation="portrait" />


    <activity
        android:name="com.shops.nicofoods.activities.PaymentActivity"
        android:screenOrientation="portrait" />
    <activity
        android:name="com.shops.nicofoods.activities.SecretKeyActivity"
        android:screenOrientation="portrait" />

    <!--<provider-->
        <!--android:name="android.support.v4.content.FileProvider"-->
        <!--android:authorities="${applicationId}.fileprovider"-->
        <!--android:exported="false"-->
        <!--android:grantUriPermissions="true">-->
        <!--<meta-data-->
            <!--android:name="android.support.FILE_PROVIDER_PATHS"-->
            <!--android:resource="@xml/file_paths" />-->
    <!--</provider>-->

    <activity
        android:name="com.shops.nicofoods.activities.ProductDetailActivity"
        android:theme="@style/AppTheme.NoActionBar"
        android:windowSoftInputMode="adjustPan"
        android:parentActivityName="com.shops.nicofoods.activities.HotelViewActivity"
    />
</application>

错误日志

2020-01-28 17:59:44.502 1684-1684 /? E / shops.nicofood:在runtime_flags中设置的未知位:0x8000
2020-01-28 17:59:45.028 1684-1684 /? E / FirebaseInstanceId:在后台时无法启动服务:java.lang.IllegalStateException:不允许启动服务意图{act = com.google.firebase.INSTANCE_ID_EVENT pkg = com.shops.nicofoods cmp = com.shops.nicofoods /。 fcm.MyFirebaseInstanceIDService(有其他功能)}:应用程序在后台uid UidRecord {6d8a895 u0a134 SVC空闲更改:idle |未执行的处理:1 seq(0,0,0)}

详细日志

2020-01-28 17:59:44.484 1684-1684 /? I / shops.nicofood:不启用-Xcheck:jni(已启用)
2020-01-28 17:59:44.502 1684-1684 /? E / shops.nicofood:在runtime_flags中设置的未知位:0x8000
2020-01-28 17:59:44.503 1684-1684 /? W / shops.nicofood:使用默认值的x86出现意外的X86 CPU变体
2020-01-28 17:59:44.579 1684-1684 /? I / shops.nicofood:ClassLoaderContext是一个特殊的共享库。
2020-01-28 17:59:44.969 1684-1684 /? I / MultiDex:版本2.1.0的VM具有multidex支持
2020-01-28 17:59:44.969 1684-1684 /? I / MultiDex:安装应用程序
2020-01-28 17:59:44.969 1684-1684 /? I / MultiDex:VM具有multidex支持,MultiDex支持库已禁用。
2020-01-28 17:59:44.996 1684-1684 /? D / FirebaseApp:com.google.firebase.auth.FirebaseAuth未链接。跳过初始化。
2020-01-28 17:59:45.028 1684-1684 /? E / FirebaseInstanceId:在后台时无法启动服务:java.lang.IllegalStateException:不允许启动服务意图{act = com.google.firebase.INSTANCE_ID_EVENT pkg = com.shops.nicofoods cmp = com.shops.nicofoods /。 fcm.MyFirebaseInstanceIDService(有其他功能)}:应用程序在后台uid UidRecord {6d8a895 u0a134 SVC空闲更改:idle |未执行的处理:1 seq(0,0,0)}
2020-01-28 17:59:45.029 1684-1684 /? D / FirebaseApp:com.google.firebase.crash.FirebaseCrash未链接。跳过初始化。
2020-01-28 17:59:45.068 1684-1684 /? I / FA:正在启动应用评估,版本:11400
2020-01-28 17:59:45.068 1684-1684 /? I / FA:要启用调试日志记录,请运行:adb shell setprop log.tag.FA VERBOSE
2020-01-28 17:59:45.109 1684-1684 /? V / FA:已启用收藏
2020-01-28 17:59:45.109 1684-1684 /? V / FA:应用程式套件,Google应用程式编号:com.shops.nicofoods,1:72318950278:android:b6b96c0c7eee2376792a07
2020-01-28 17:59:45.111 1684-1684 /? I / FA:要启用更快的调试模式事件记录,请运行:
亚行 shell setprop debug.firebase.analytics.app com.shops.nicofoods
2020-01-28 17:59:45.111 1684-1684 /? D / FA:启用调试级别的消息记录
2020-01-28 17:59:45.168 1684-1684 /? V / FA:取消作业。职位编号:-1646145356
2020-01-28 17:59:45.185 1684-1684 /? V / FA:注册 Activity 生命周期回调
2020-01-28 17:59:45.189 1684-1684 /? I / FirebaseInitProvider:FirebaseApp初始化成功
2020-01-28 17:59:45.258 1684-1724 /? V / FA:使用测量服务
2020-01-28 17:59:45.278 1684-1724 /? V / FA:连接到远程服务
2020-01-28 17:59:45.341 1684-1724 /? V / FA:使用测量服务
2020-01-28 17:59:45.341 1684-1724 /? V / FA:连接尝试已在进行中
2020-01-28 17:59:45.431 1684-1727 /? D / NetworkSecurityConfig:未指定网络安全配置,使用平台默认值
2020-01-28 17:59:45.586 1684-1684 / com.shops.nicofoods I / CrashlyticsCore:初始化Crashlytics 2.3.17.dev
2020-01-28 17:59:45.794 1684-1684 / com.shops.nicofoods I / ActivityThread:handleStopService:token=android.os.BinderProxy@51eed9c未找到。
2020-01-28 17:59:45.925 1684-1724 / com.shops.nicofoods D / FA:已连接到远程服务
2020-01-28 17:59:45.926 1684-1724 / com.shops.nicofoods V / FA:处理排队的服务任务:2
2020-01-28 17:59:45.937 1684-1759 / com.shops.nicofoods W / shops.nicofoods:无效的com.crashlytics.android.answers.EnabledSessionAnalyticsManagerStrategy.setAnalyticsSettingsData(io.fabric.sdk.android.services。 settings.AnalyticsSettingsData,java.lang.String)花费了109.554毫秒
2020-01-28 17:59:51.057 1684-1724 / com.shops.nicofoods V / FA:不 Activity ,已从服务断开连接
2020-01-28 18:00:26.136 1684-1737 / com.shops.nicofoods E / Fabric:设置请求失败。
2020-01-28 18:00:26.141 1684-1735 / com.shops.nicofoods E /答案:无法检索设置
2020-01-28 18:00:26.143 1684-1740 / com.shops.nicofoods W / CrashlyticsCore:收到空设置,正在跳过报告提交!

最佳答案

2020-01-28 17:59:45.028 1684-1684/? E/FirebaseInstanceId: Failed to start service while in background: java.lang.IllegalStateException: Not allowed to start service Intent {

不确定,但似乎您可能拥有较旧的播放服务库,由于android 10中的新限制,该服务库无法从后台启动服务。

因此,尝试更新可能具有更新服务的FCM /播放服务库。

另外,请确保模拟器具有最新间隔

07-28 12:24