App works well in all version of android device at installation time (First time) but when I open next time on Android P,it throws following exception
Fatal Exception: java.lang.RuntimeException: Unable to start activity ComponentInfo{com.merojob.merojobapp/com.merojob.merojobapp.SplashScreenActivity}: java.lang.SecurityException: Call from user 0 as user 361911 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(Method.java)
at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:493)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:858)
and i searched over internet ,I found this question Android permission.INTERACT_ACROSS_USERS_FULL. I put permission in manifest as
<permission
android:name="android.permission.INTERACT_ACROSS_USERS_FULL"
android:protectionLevel="signature" />
But this solution doesn't work in my case . The crash is happening again and again. I think it's because of multiUser problem . I also searched about that and found this link https://android.stackexchange.com/questions/67038/can-somebody-explain-how-multi-user-is-implemented-in-android-4-4/67040#67040
Is there any idea how to handle this problem ?
here is my manifest file
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="***************">
<uses-permission android:name="android.permission.INTERNET" />
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
<uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE" />
<permission
android:name="android.permission.INTERACT_ACROSS_USERS_FULL"
android:protectionLevel="signature" />
<application
android:name=".MeroJobApp"
android:allowBackup="false"
android:icon="@mipmap/ic_launcher"
android:label="@string/app_name"
android:largeHeap="true"
android:supportsRtl="true"
android:theme="@style/AppThemeJobSeeker">
<meta-data
android:name="io.fabric.ApiKey"
android:value="*****************************" />
<activity
android:name=".SplashScreenActivity"
android:allowTaskReparenting="true"
android:alwaysRetainTaskState="true"
android:configChanges="orientation"
android:launchMode="singleTask"
android:showForAllUsers="true"
android:theme="@style/SplashTheme">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
<activity
android:name="com.theartofdev.edmodo.cropper.CropImageActivity"
android:theme="@style/Base.Theme.AppCompat" />
<activity
android:launchMode="singleTask"
android:showForAllUsers="true"
android:name=".activity.MainActivity"
android:screenOrientation="portrait" />
<activity
android:launchMode="singleTask"
android:showForAllUsers="true"
android:name=".activity.LoginActivity"
android:screenOrientation="portrait" />
<activity
android:launchMode="singleTask"
android:showForAllUsers="true"
android:name=".activity.TutorialActivity"
android:screenOrientation="portrait" />
<receiver
android:name=".utils.ConnectivityReceiver"
android:enabled="true">
<intent-filter>
<action android:name="android.net.conn.CONNECTIVITY_CHANGE" />
</intent-filter>
</receiver>
<service android:name=".Services.CustomFirebaseMessagingService">
<intent-filter>
<action android:name="com.google.firebase.MESSAGING_EVENT" />
</intent-filter>
</service>
<service android:name=".Services.CustomFirebaseInstanceIDService">
<intent-filter>
<action android:name="com.google.firebase.INSTANCE_ID_EVENT" />
</intent-filter>
</service>
<meta-data
android:name="com.facebook.sdk.ApplicationId"
android:value="@string/facebook_app_id" />
<meta-data
android:name="com.google.firebase.messaging.default_notification_channel_id"
android:value="@string/default_notification_channel_id" />
</application>
and app level build.gradle file is here
apply plugin: 'com.android.application'
apply plugin: 'io.fabric'
apply plugin: 'realm-android'
android {
compileSdkVersion 28
defaultConfig {
applicationId "************"
minSdkVersion 19
targetSdkVersion 28
versionCode 22
versionName "2.9.1"
testInstrumentationRunner"android.support.test.runner.AndroidJUnitRunner"
multiDexEnabled true
}
buildTypes {
release {
// buildConfigField 'String', "APP_KEY", APP_KEY
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'),'proguard-rules.pro'
resValue("bool", "FIREBASE_CRASH_ENABLED", "true")
}
debug {
resValue("bool", "FIREBASE_CRASH_ENABLED", "false")
}
}
externalNativeBuild {
cmake {
path 'src/CMakeLists.txt'
}
}
compileOptions {
sourceCompatibility JavaVersion.VERSION_1_8
targetCompatibility JavaVersion.VERSION_1_8
}
}
dependencies {
implementation fileTree(include: ['*.jar'], dir: 'libs')
androidTestImplementation('com.android.support.test.espresso:espresso-core:2.2.2', {
exclude group: 'com.android.support', module: 'support-annotations'
})
/*
implementation('com.crashlytics.sdk.android:crashlytics:2.6.8@aar') {
transitive = true;
}
*/
implementation 'com.android.support:appcompat-v7:28.0.0'
implementation 'com.android.support:design:28.0.0'
implementation 'com.android.support.constraint:constraint-layout:1.1.3'
// compile 'com.android.support:exifinterface:27.0.1'
testImplementation 'junit:junit:4.12'
androidTestImplementation 'com.android.support.test:runner:1.0.2'
androidTestImplementation 'com.android.support.test.espresso:espresso-core:3.0.2'
implementation 'com.android.support:cardview-v7:28.0.0'
implementation 'com.android.support:recyclerview-v7:28.0.0'
implementation 'com.google.code.gson:gson:2.8.2'
implementation 'com.orhanobut:hawk:2.0.1'
implementation 'com.jakewharton:butterknife:8.5.1'
implementation 'org.greenrobot:eventbus:3.0.0'
implementation 'com.squareup.retrofit2:retrofit:2.3.0'
implementation 'com.squareup.retrofit2:converter-gson:2.3.0'
implementation 'com.squareup.okhttp3:okhttp:3.10.0'
implementation 'com.github.xiprox:ErrorView:v2.2.0.1'
implementation 'com.github.ragunathjawahar:android-saripaar:android-saripaar-2.0.3'
implementation 'me.relex:circleindicator:1.2.2@aar'
implementation 'com.jakewharton.timber:timber:4.5.1'
implementation 'org.ocpsoft.prettytime:prettytime:4.0.1.Final'
implementation 'com.facebook.android:facebook-android-sdk:4.29.0'
implementation 'com.github.bumptech.glide:glide:4.8.0'
annotationProcessor 'com.github.bumptech.glide:compiler:4.8.0'
// implementation 'com.twitter.sdk.android:twitter:3.0.0'
implementation 'com.splitwise:tokenautocomplete:2.0.8@aar'
implementation 'com.android.support.constraint:constraint-layout:1.1.3'
testImplementation 'junit:junit:4.12'
annotationProcessor 'com.jakewharton:butterknife-compiler:8.5.1'
implementation 'com.android.support:multidex:1.0.3'
implementation 'com.crashlytics.sdk.android:crashlytics:2.9.5'
implementation 'com.google.firebase:firebase-core:16.0.4'
implementation 'com.theartofdev.edmodo:android-image-cropper:2.7.0'
implementation 'com.google.firebase:firebase-config:16.1.0'
implementation 'com.google.firebase:firebase-messaging:17.3.4'
///implementation 'org.jsoup:jsoup:1.10.1'
}
repositories {
mavenCentral()
}
configurations.all {
resolutionStrategy.eachDependency { DependencyResolveDetails details ->
def requested = details.requested
if (requested.group == 'com.android.support') {
if (!requested.name.startsWith("multidex")) {
details.useVersion '26.0.1'
}
}
}
}
apply plugin: 'com.google.gms.google-services'