Build fails with Android SDK 31
See original GitHub issueError:
Error:
android:exported needs to be explicitly specified for <service>. Apps targeting Android 12 and higher are required to specify an explicit value for `android:exported` when the corresponding component has an intent filter defined. See https://developer.android.com/guide/topics/manifest/activity-element#exported for details.
I found it’s agora using this answer. Generated manifest (see it’s missing exported for activity and service):
<activity
android:name="io.agora.rtc.ss.impl.ScreenSharing$LocalScreenCaptureAssistantActivity"
android:configChanges="screenSize|orientation"
android:screenOrientation="fullUser"
android:theme="@android:style/Theme.Translucent" />
<service
android:name="io.agora.rtc.ss.impl.LocalScreenSharingService"
android:foregroundServiceType="mediaProjection" >
<intent-filter>
<action android:name="android.intent.action.screenshare" />
</intent-filter>
</service>
Patch (add this to your manifest):
<activity android:name="io.agora.rtc.ss.impl.ScreenSharing$LocalScreenCaptureAssistantActivity"
android:exported="false"
tools:node="merge" />
<service
android:name="io.agora.rtc.ss.impl.LocalScreenSharingService"
android:exported="false"
android:foregroundServiceType="mediaProjection" tools:node="merge" />
Issue Analytics
- State:
- Created a year ago
- Reactions:5
- Comments:13
Top Results From Across the Web
Android Studio error "Installed Build Tools revision 31.0.0 is ...
In SDK Manager, deselect 31.0.0 and try installing an older version (e.g., I've tried 30.0.3) and update "buildToolsVersion" in build.gradle to ...
Read more >Android build fails with Android SDK Build-Tools 31.0.0 #1288
The build seems to ignore the pinned Android Build-Tools version. This issue started appearing in our build pipeline between July 19., 13:20 UTC ......
Read more >Installed Build Tools revision 31.0.0-rc5 is corrupted
Problem. After updating to the latest Android 12 tools 31.0.0-rc5, the builds are failing. Here's the message: Build-tool 31.0.0 rc5 is missing DX...
Read more >[Android] Android build fails when targeting SDK 31 and using ...
The issue is caused by Android Gradle Plugin incompatibility with build-tools 31.0.0. The same issue is reproducible with a project created in ...
Read more >How to solve Android Studio Error: Installed Build Tools ...
In many blogs, you will find that the solution is to downgrade to the API 30, however, if you want to experiment with...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
You can
patch-package
the build.gradle file to point at the more recent AAR with the fix, which is an approach that’s compatible with Expo’s managed workflow. Below is the react-native-agora+3.7.0.patch file to use withpatch-package
:I just came here following a similar path. Took a while to find the culprit and the solution. Thanks for posting!
I added:
<service android:exported="true" android:foregroundServiceType="mediaProjection" android:name="io.agora.rtc.ss.impl.LocalScreenSharingService"> <intent-filter> <action android:name="android.intent.action.screenshare"/> </intent-filter> </service>