Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

App installation fails in Android 12 devices

Our app fails to install after migrating to the targetSdkVersion 31. On trying to find the issue we found that a library was using FLASHLIGHT permission and we were getting this error while installing:

Installation failed due to: 'Failed to commit install session 130765275 with command cmd package install-commit 130765275. Error: -127: Package com.xxxx.yyyy.zzzz attempting to declare permission android.permission.FLASHLIGHT in non-existing group android.permission-group.HARDWARE_CONTROLS'

Permissions used in the manifest file of library:

<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
<uses-permission android:name="android.permission.RECORD_AUDIO" />
<uses-permission android:name="android.permission.CAMERA" />
<uses-permission android:name="android.permission.INTERNET" />

<uses-feature android:name="android.hardware.camera" />
<uses-feature android:name="android.hardware.camera.autofocus" />

<permission
    android:name="android.permission.FLASHLIGHT"
    android:permissionGroup="android.permission-group.HARDWARE_CONTROLS"
    android:protectionLevel="normal" />

Is there any workaround to this issue?

like image 852
Eldho Paul Konnanal Avatar asked Nov 27 '25 10:11

Eldho Paul Konnanal


1 Answers

android.permission-group.HARDWARE_CONTROLS is deprecated in targetSdkVersion 31 . The work around is to remove the permission used by library in your manifest by

<permission
      android:name="permissionOne"
      tools:node="remove"
      tools:selector="com.example.lib1">

tools:node="remove"

will remove the permission from the App if its used in any of your libraries

like image 176
Jinson Paul Avatar answered Nov 29 '25 23:11

Jinson Paul



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!