install failed due to duplicate permission - android

I'm trying to install the app on my Samsung M31s phone, but every time I'm getting the following error -
Error: INSTALL_FAILED_DUPLICATE_PERMISSION: Package com.glance.tv.internal attempting to redeclare permission glance.sdk.api.status.permission.READ already owned by com.samsung.android.dynamiclock'
Is there any way to bypass this permission?
I tried removing it from the manifesto, but it is still not working.
<permission
android:name="com.glance.PERMISSION_READ"
android:protectionLevel="normal" />

Related

Android Studio ignoring Manifest uses-permission entries

I am trying to show my location on a GoogleMap but Android Studio reports a fatal error on the following line
savedGoogleMap.isMyLocationEnabled = true
The error message is
Missing permissions required by GoogleMap.setMyLocationEnabled: android.permission.ACCESS_COARSE_LOCATION or android.permission.ACCESS_FINE_LOCATION
The problem is the manifest file already includes both permissions so they are not missing!
<uses-permission android:name="android.permission.ACCESS_COARSE_LOCATION" />
<uses-permission android:name="android.permission.ACCESS_FINE_LOCATION" />
Using the IDE context actions to add the permissions inserts additional .ACCESS___LOCATION to the manifest file but Android Studio still reports the fatal error
The apparent issue is Android Studio is ignoring permissions included in the manifest
Earlier posts e.g. here highlight the need for runtime permission checks
My App checks for the required permissions and if checkSelfPermission is not granted I then request the required permissions
if (ActivityCompat.checkSelfPermission(this, Manifest.permission.ACCESS_FINE_LOCATION) == PackageManager.PERMISSION_GRANTED)
So at this moment my app shows a fatal error but there appears no way to fix it
Can anyone suggest other avenues I might try ?
Update
Despite the fatal error the App builds and launches? It also shows myLocation on the Google map.
My problem is the manifest file already includes both permissions!
That's not the problem. It is totally fine to have both permissions declared in your AndroidManifest.xml file, just make sure they are added in the correct place like so
After you double checked on that one, make sure you you not only call checkSelfPermission, but also requestPermissions like this:
After receiving the result proceed with your calls (or if the permission was already granted).
If you are positive with this so far and still no success, it would seem to me that something else is causing the problem and I would look into the configuration files, library dependency, caches etc.

Android BIND_JOB_SERVICE & sepolicy

I have a valid manifest file with the right permission & "exported" set as well. But, I still get the below error:
Error: Requires permission android.permission.BIND_JOB_SERVICE
The command (initiated over adb) is a running a service (via "am startservice") & the manifest file has these details:
<service
android:name=".MyService"
android:enabled="true"
android:exported="true"
android:permission="android.permission.BIND_JOB_SERVICE" />
Logcat doesn't have anything useful, just throws the permission required error (which the APK already has). This seems like a sepolicy restriction since if I remove the policy (by running "setenforce 0"), then the command works fine (no errors seen as well)
I've tried running in "permissive" mode but it doesn't show any useful messages. Is there any way to figure out what policy needs to be turned on?
Here's the actual error from logcat:
05-16 14:03:32.892 566 897 W ActivityManager: Permission Denial: Accessing service com.abc.def/.MyService from pid=6757, uid=2000 requires android.permission.BIND_JOB_SERVICE
What I found was, putting the same command in a bash script and sourcing it works fine!!

Cordova - android app crashes at launch due to contact permission

I'm having an issue that I found the cause but I couldn't manage to resolve.
My cordova app crashes on android 8.0.0. I did a logcat which revealed that the app is trying to access contacts.
The weird thing is I have no plugin for contacts nor using contacts in my app.
On the logcat, I have this error:
12-11 17:29:42.094 E/AndroidRuntime( 5609): java.lang.RuntimeException: java.lang.RuntimeException: java.lang.SecurityException: Permission Denial: opening provider com.android.providers.contacts.ContactsProvider2 from ProcessRecord{6155964 5609:com.pierrickmartelliere.UPHAIRR/u0a210} (pid=5609, uid=10210) requires android.permission.READ_CONTACTS or android.permission.WRITE_CONTACTS
I tried everything, added
<config-file parent="/manifest" target="AndroidManifest.xml">
<uses-permission android:name="android.permission.READ_CONTACTS" />
<uses-permission android:name="android.permission.WRITE_CONTACTS" />
</config-file>
to my config.xml, it adds well on AndroidManifest.xml when building but I still got the error.
I tried both tags uses-permission and uses-permission-sdk as stated here but without luck.
My version of cordova-android is 6.2.3
I also tried the cordova-plugin-permission, as in deviceready listener:
var permissions = cordova.plugins.permissions;
permissions.requestPermission(
permissions.READ_CONTACTS,
function(success) {},
function(error) {}
);
permissions.requestPermission(
permissions.WRITE_CONTACTS,
function(success) {},
function(error) {}
);
But nothing changed. The app crashes before the "deviceready" event is fired so I can do nothing on runtime.
As stated here, if I change the targetSdkVersion to lower than 23 (even 25), the crash disappears, but Im' not able to upload it to google play anymore since play console doesn't accept targetSdkVersion < 26.
Also, if I manually authorize contact access from app setting and I force stop and relaunch the app, it works. This is driving me crazy.
Some help on this would be very appreciated.
Thanks to anyone who will take the time to read or answer.
I finally posted an issue in the cordova-android github. I got an answer quickly, which is:
UPDATE cordova-android to 7.1.4 !
https://github.com/apache/cordova-android/issues/606

Error -505 INSTALL_FAILED_DUPLICATE_PERMISSION:

I am working on a android VOIP Dialer. I unable to install my current app along with old app in a device.
01-07 12:05:05.115: E/Finsky(28214): [1] PackageInstallerImpl$2.onReceive: Error -505 while installing com.current.app: INSTALL_FAILED_DUPLICATE_PERMISSION: Package com.current.app attempting to redeclare permission android.permission.CONFIGURE_SIP already owned by com.old.app
the permission in manifest.
<permission
android:name="android.permission.CONFIGURE_SIP"
android:permissionGroup="android.permission-group.COST_MONEY"
android:protectionLevel="signature" />
I have tried protectionLevel both signature and dangerous.
How can I solve this issue.
It seems you are trying to declare same permission in two applications.
In order to keep both application installed, common solution for this problem is to use a dynamic prefix for your permission, preventing conflicts with other apps (as it happens for GCM configuration too):
<permission
android:name="${applicationId}.permission.CONFIGURE_SIP"
android:permissionGroup="${applicationId}.permission-group.COST_MONEY"
android:protectionLevel="signature" />
Be careful to have applicationId value assigned in your Gradle configuration under android > defaultConfig.

Unity can not Build on Android:java.lang.IllegalArgumentException: already added: Manifest$permission (UNEXPECTED TOP-LEVEL EXCEPTION)

When I have
----Plugins/Android/{res, jar….}
----Plugins/Android/AndroidManifest.xml
It's OK
When I have Facebook and Google+
----Plugins/Android/{res, jar….}
----Plugins/Android/facebookSDK folder
----Plugins/Android/google-play-services_lib (google+)
----Plugins/Android/BaseGameUtils (google+)
----Plugins/Android/MainLibProj (google+)
----Plugins/Android/AndroidManifest.xml
Can not Build to Android, getting error:
UNEXPECTED TOP-LEVEL EXCEPTION: java.lang.IllegalArgumentException:
already added: L …. /Manifest$permission;
It's because of this line on AndroidManifest.xml
<permission android:name="{my package}.permission.C2D_MESSAGE"
android:protectionLevel="signature" />
When I remove this permission, I can build and run, but can not get Push Notification (lack of permission).
Question: How can I keep this permission on Unity?
Finally, I solved this issue.
When you build your ----Plugins/Android/{ jar….} (your own project). Don't add any permission on AndroidManifest.
And then add that permission on ----Plugins/Android/AndroidManifest.xml. Good luck!

Categories

Resources