After updating to Android Studio 4.1.1 the uses-permission in the manifest no longer works. It does not produce any build error, but in the target device it acts like the uses-permission tags are just not there.
I first noticed something was wrong when my working Bluetooth LE project just stopped detecting any other devices in scanning. On a hunch I uninstalled the debug version from the device and built an signed APK of the release version. No errors yet. Then I transferred the APK file to the device and launched it and was surprised to see "This application does not require any special access." I know from experience that I should have been seeing a warning that the app requires ACCESS_FINE_LOCATION. So just to be sure, I added a really serious permission: ANSWER_PHONE_CALLS. Surprisingly, the install on the device still says "This app does not require any special access.". Fortunately I had saved an APK file that I built before I updated Android Studio, and when I install it on the same device, the "access precise location" warning pops up and the Bluetooth stuff works perfectly. I am targeting the same API as before, same compileSDK. I suspect that the Bluetooth functions are silently failing because part of the OS thinks I have not declared the proper permissions. Here is my module build.gradle and the relevant parts of my manifest:
apply plugin: 'com.android.application'
android {
compileSdkVersion 27
defaultConfig {
applicationId "com.realtimespecialties.watering"
minSdkVersion 21
targetSdkVersion 26
versionCode 1
versionName "1.0"
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
}
buildTypes {
release {
minifyEnabled true
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
android.applicationVariants.all { variant ->
variant.outputs.all {
outputFileName = "watering-1.1.apk"
}
}
}
}
}
dependencies {
implementation fileTree(include: ['*.jar'], dir: 'libs')
implementation 'com.android.support.constraint:constraint-layout:1.1.0'
testImplementation 'junit:junit:4.12'
androidTestImplementation 'com.android.support.test:runner:1.0.1'
androidTestImplementation 'com.android.support.test.espresso:espresso-core:3.0.1'
}
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.realtimespecialties.watering">
<uses-permission android:name="android.permission.BLUETOOTH"/>
<uses-permission android:name="android.permission.BLUETOOTH_ADMIN"/>
<uses-permission android:name="android.permission.ACCESS_FINE_LOCATION" />
<uses-permission android:name="android.permission.ANSWER_PHONE_CALLS" />
<uses-feature android:name="android.hardware.bluetooth_le" android:required="true"/>
<uses-feature android:name="android.hardware.location.gps" />
<application
android:screenOrientation="portrait"
android:configChanges="orientation|keyboardHidden"
android:name=".Myapp"
android:allowBackup="true"
android:icon="@Mipmap/ic_launcher"
android:label="@String/app_name"
android:roundIcon="@Mipmap/ic_launcher_round"
android:supportsRtl="true"
android:theme="@Style/AppTheme">
<activity android:name=".Main">
<intent-filter>
<action android:name="android.intent.action.MAIN"/>
<category android:name="android.intent.category.LAUNCHER"/>
</intent-filter>
</activity>
</application>
</manifest>
I first noticed something was wrong when my working Bluetooth LE project just stopped detecting any other devices in scanning. On a hunch I uninstalled the debug version from the device and built an signed APK of the release version. No errors yet. Then I transferred the APK file to the device and launched it and was surprised to see "This application does not require any special access." I know from experience that I should have been seeing a warning that the app requires ACCESS_FINE_LOCATION. So just to be sure, I added a really serious permission: ANSWER_PHONE_CALLS. Surprisingly, the install on the device still says "This app does not require any special access.". Fortunately I had saved an APK file that I built before I updated Android Studio, and when I install it on the same device, the "access precise location" warning pops up and the Bluetooth stuff works perfectly. I am targeting the same API as before, same compileSDK. I suspect that the Bluetooth functions are silently failing because part of the OS thinks I have not declared the proper permissions. Here is my module build.gradle and the relevant parts of my manifest:
apply plugin: 'com.android.application'
android {
compileSdkVersion 27
defaultConfig {
applicationId "com.realtimespecialties.watering"
minSdkVersion 21
targetSdkVersion 26
versionCode 1
versionName "1.0"
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
}
buildTypes {
release {
minifyEnabled true
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
android.applicationVariants.all { variant ->
variant.outputs.all {
outputFileName = "watering-1.1.apk"
}
}
}
}
}
dependencies {
implementation fileTree(include: ['*.jar'], dir: 'libs')
implementation 'com.android.support.constraint:constraint-layout:1.1.0'
testImplementation 'junit:junit:4.12'
androidTestImplementation 'com.android.support.test:runner:1.0.1'
androidTestImplementation 'com.android.support.test.espresso:espresso-core:3.0.1'
}
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.realtimespecialties.watering">
<uses-permission android:name="android.permission.BLUETOOTH"/>
<uses-permission android:name="android.permission.BLUETOOTH_ADMIN"/>
<uses-permission android:name="android.permission.ACCESS_FINE_LOCATION" />
<uses-permission android:name="android.permission.ANSWER_PHONE_CALLS" />
<uses-feature android:name="android.hardware.bluetooth_le" android:required="true"/>
<uses-feature android:name="android.hardware.location.gps" />
<application
android:screenOrientation="portrait"
android:configChanges="orientation|keyboardHidden"
android:name=".Myapp"
android:allowBackup="true"
android:icon="@Mipmap/ic_launcher"
android:label="@String/app_name"
android:roundIcon="@Mipmap/ic_launcher_round"
android:supportsRtl="true"
android:theme="@Style/AppTheme">
<activity android:name=".Main">
<intent-filter>
<action android:name="android.intent.action.MAIN"/>
<category android:name="android.intent.category.LAUNCHER"/>
</intent-filter>
</activity>
</application>
</manifest>
Last edited: