AgoraIO-Extensions / Agora-Flutter-SDK

Flutter plugin of Agora RTC SDK for Android/iOS/macOS/Windows
https://pub.dev/packages/agora_rtc_engine
MIT License
746 stars 388 forks source link

FOREGROUND_SERVICE_MEDIA_PROJECTION causing playstore to reject updates. #1666

Open jerrypaulsam opened 7 months ago

jerrypaulsam commented 7 months ago

Version of the agora_rtc_engine

6.2.1

Platforms affected

Steps to reproduce

  1. Build appbundle
  2. Upload to Google Play
  3. Gets rejected

Expected results

We are only using audio call service. How to disable FOREGROUND_SERVICE_MEDIA_PROJECTION from manifest?

Actual results

FOREGROUND_SERVICE_MEDIA_PROJECTION causing playstore to reject updates.

Code sample

We tried adding this

configurations.all { exclude group:"io.agora.rtc", module:"full-screen-sharing" }

but still, the apk analyzer shows FOREGROUND_SERVICE_MEDIA_PROJECTION in manifest

Screenshots or Video

Screenshots / Video demonstration [Upload media here]

Logs

Logs ```console [Paste your logs here] ```

Flutter Doctor output

Doctor output ```console [✓] Flutter (Channel stable, 3.19.4, on macOS 14.2.1 23C71 darwin-arm64, locale en-IN) • Flutter version 3.19.4 on channel stable at /Users/xyz/Documents/flutter • Upstream repository https://github.com/flutter/flutter.git • Framework revision 68bfaea224 (12 days ago), 2024-03-20 15:36:31 -0700 • Engine revision a5c24f538d • Dart version 3.3.2 • DevTools version 2.31.1 [✓] Android toolchain - develop for Android devices (Android SDK version 33.0.0) • Android SDK at /Users/xyz/Library/Android/sdk • Platform android-34, build-tools 33.0.0 • Java binary at: /Applications/Android Studio.app/Contents/jre/Contents/Home/bin/java • Java version OpenJDK Runtime Environment (build 11.0.12+0-b1504.28-7817840) • All Android licenses accepted. [✓] Xcode - develop for iOS and macOS (Xcode 15.3) • Xcode at /Applications/Xcode.app/Contents/Developer • Build 15E204a • CocoaPods version 1.15.2 [✓] Chrome - develop for the web • Chrome at /Applications/Google Chrome.app/Contents/MacOS/Google Chrome [✓] Android Studio (version 2021.2) • Android Studio at /Applications/Android Studio.app/Contents • Flutter plugin can be installed from: 🔨 https://plugins.jetbrains.com/plugin/9212-flutter • Dart plugin can be installed from: 🔨 https://plugins.jetbrains.com/plugin/6351-dart • Java version OpenJDK Runtime Environment (build 11.0.12+0-b1504.28-7817840) [✓] VS Code (version 1.87.2) • VS Code at /Applications/Visual Studio Code.app/Contents • Flutter extension can be installed from: 🔨 https://marketplace.visualstudio.com/items?itemName=Dart-Code.flutter [✓] Connected device (3 available) • iPhone (mobile) • 00008110-0018696A1EF0401E • ios • iOS 17.3.1 21D61 • macOS (desktop) • macos • darwin-arm64 • macOS 14.2.1 23C71 darwin-arm64 • Chrome (web) • chrome • web-javascript • Google Chrome 123.0.6312.87 [✓] Network resources • All expected network resources are available. • No issues found! ```
littleGnAl commented 7 months ago

Maybe you can check this issue for reference https://github.com/AgoraIO-Extensions/Agora-Flutter-SDK/issues/1575

jerrypaulsam commented 7 months ago

I have checked it, but still facing the same issue. I don't need the video related features as we are only using audio calls with the app. It's been a few days since we uploaded the update build and not getting accepted. If the problem cannot be resolved, we might even need to remove the audio call feature completely until we find a workaround.

littleGnAl commented 7 months ago

Can you try these steps to confirm where the permission is from? https://github.com/AgoraIO-Extensions/Agora-Flutter-SDK/issues/1575#issuecomment-1955868017

jerrypaulsam commented 7 months ago

@littleGnAl I did. We did try all those and still the release manifest is showing the FOREGROUND_SERVICE_MEDIA_PROJECTION. As of now, we are removing the package and planning an alternative in the meantime.

littleGnAl commented 7 months ago

We did try all those and still the release manifest is showing the FOREGROUND_SERVICE_MEDIA_PROJECTION. As of now

Is it from our package?

jerrypaulsam commented 7 months ago

Yes, as per the log. We don't have any other package which uses the FOREGROUND_SERVICE_MEDIA_PROJECTION

melbanna40 commented 7 months ago

I'm facing same issue and i did exclude "full-screen-sharing" module from project as mentioned here #1458 This way path :android/build.gradle Screenshot 2024-04-04 at 8 35 15 PM

littleGnAl commented 7 months ago

@melbanna40 Can you follow this step to check if the permission comes from our package? https://github.com/AgoraIO-Extensions/Agora-Flutter-SDK/issues/1575#issuecomment-1955868017

littleGnAl commented 7 months ago

If you face this issue after these steps https://github.com/AgoraIO-Extensions/Agora-Flutter-SDK/issues/1575#issuecomment-1955868017, I think it's better to provide a reproducible demo for further investigation.

melbanna40 commented 7 months ago

@melbanna40 Can you follow this step to check if the permission comes from our package? #1575 (comment)

it was from it. Application accepted on google play after excluding the "full-screen-sharing" module 🚀 Thanks 🙏

aruntr369 commented 7 months ago

@melbanna40 i added configurations.all { exclude group:"io.agora.rtc", module:"full-screen-sharing" }, and the report is not showing the use of FOREGROUND_SERVICE_MEDIA_PROJECTION, but play store is still rejecting the build for not declaring the use of it. can you please explain the step you took get approval from play store

melbanna40 commented 7 months ago

@melbanna40 i added configurations.all { exclude group:"io.agora.rtc", module:"full-screen-sharing" }, and the report is not showing the use of FOREGROUND_SERVICE_MEDIA_PROJECTION, but play store is still rejecting the build for not declaring the use of it. can you please explain the step you took get approval from play store

i just cleared android caches at this paths cd android rm -Rf .gradle/caches m -Rf /app/build built a new bundle and new release version on google play.

johneyp commented 6 months ago

How do you fix this on an expo app ?

baharudin-yusup commented 5 months ago

I also encountered this issue when uploading my APK to the Play Store. I was able to resolve it by following these steps:

  1. Exclude the full-screen-sharing module in the project-level build.gradle file:

    // build.gradle (project-level)
    
    //...
    
    configurations.configureEach {
       exclude group: "io.agora.rtc", module: "full-screen-sharing"
    }
  2. Remove the FOREGROUND_SERVICE_MEDIA_PROJECTION permission in the AndroidManifest.xml file:

    <!-- AndroidManifest.xml -->
    
    <!-- ... -->
    
    <uses-permission
       android:name="android.permission.FOREGROUND_SERVICE_MEDIA_PROJECTION"
       tools:ignore="SystemPermissionTypo"
       tools:node="remove" />
    
    <!-- ... -->
fahadyaqub commented 2 months ago

Spent a good part of the day on this. Here is how i was able to finally fix it.

Project-level means the app/build.gradle file. The code snippets here and other places confused me because "repositories" property is only in my the root level gradle file. So basically in app/build.gradle;

signingConfigs{
 ....
}

//this goes in here somewhere
configurations.configureEach {
    exclude group: "io.agora.rtc", module: "full-screen-sharing"
}
compileOptions{
 ...
}

After making these changes, do a clean/build, and "sync gradle with project files".

Important: If you have uploaded an old bundle (which had this issue), published to any of the other testing releases (internal, closed etc), then the same error will keep appearing for production release, unless you change and upgrade (or remove) the bad bundles from all of those releases - even though the bundle in production release is fixed.

In the error details on playstore it actually lists which bundles have the issue associated with them (but its not that obvious).

So every time you clean/build, check the logs in manifest-merger-release-report.txt - which is created on every compilation. (details linked above by @littleGnAl), once you confirm the permission no longer exists in this log file, upload it, and attach this bundle to all the test and prod release channels.

popeyewrener commented 1 month ago

I'm facing same issue and i did exclude "full-screen-sharing" module from project as mentioned here #1458 This way path :android/build.gradle Screenshot 2024-04-04 at 8 35 15 PM

thanks this solution working for removing foreground services