Skip to content

Conversation

@navaronbracke
Copy link
Contributor

@navaronbracke navaronbracke commented Feb 23, 2023

This PR was recreated from flutter/plugins#7062 in flutter/plugins

This PR adds a @TargetApi() annotation and moves a @SuppressWarnings("deprecation") annotation to the right place.

It also enables javac lint options for the camera_android example and fixes the warnings related to that.

Fixes: flutter/flutter#94999
Part of: flutter/flutter#91868

If you had to change anything in the flutter/tests repo, include a link to the migration guide as per the breaking change policy.
N/A

Pre-launch Checklist

  • I read the Contributor Guide and followed the process outlined there for submitting PRs.
  • I read the Tree Hygiene wiki page, which explains my responsibilities.
  • I read and followed the relevant style guides and ran the auto-formatter. (Unlike the flutter/flutter repo, the flutter/packages repo does use dart format.)
  • I signed the CLA.
  • The title of the PR starts with the name of the package surrounded by square brackets, e.g. [shared_preferences]
  • I listed at least one issue that this PR fixes in the description above.
  • I updated pubspec.yaml with an appropriate new version according to the pub versioning philosophy, or this PR is exempt from version changes.
  • I updated CHANGELOG.md to add a description of the change, following repository CHANGELOG style.
  • I updated/added relevant documentation (doc comments with ///).
  • I added new tests to check the change I am making, or this PR is test-exempt.
  • All existing and new tests are passing.

If you need help, consider asking for advice on the #hackers-new channel on Discord.

@flutter-dashboard
Copy link

It looks like this pull request may not have tests. Please make sure to add tests before merging. If you need an exemption to this rule, contact Hixie on the #hackers channel in Chat (don't just cc him here, he won't see it! He's on Discord!).

If you are not sure if you need tests, consider this rule of thumb: the purpose of a test is to make sure someone doesn't accidentally revert the fix. Ask yourself, is there anything in your PR that you feel it is important we not accidentally revert back to how it was before your fix?

Reviewers: Read the Tree Hygiene page and make sure this patch meets those guidelines before LGTMing.

@google-cla
Copy link

google-cla bot commented Feb 23, 2023

Thanks for your pull request! It looks like this may be your first contribution to a Google open source project. Before we can look at your pull request, you'll need to sign a Contributor License Agreement (CLA).

View this failed invocation of the CLA check for more information.

For the most up to date status, view the checks section at the bottom of the pull request.

@navaronbracke
Copy link
Contributor Author

navaronbracke commented Feb 23, 2023

@stuartmorgan I'll recap my findings about the use of --fatal-warnings in the build-examples tooling to act as a test for this PR (and in the long term, for all plugins).

If I build the example with a release build: cd packages/camera/camera_android/example && flutter run --release
I get the following logs:

Build Logs
navaronbracke@MacBook-Pro-van-Navaron example % flutter run --release
Launching lib/main.dart on motorola one in release mode...
w: Runtime JAR files in the classpath should have the same version. These files were found in the classpath:
    /Users/navaronbracke/.gradle/caches/modules-2/files-2.1/org.jetbrains.kotlin/kotlin-stdlib-jdk8/1.5.30/5fd47535cc85f9e24996f939c2de6583991481b0/kotlin-stdlib-jdk8-1.5.30.jar (version 1.5)
    /Users/navaronbracke/.gradle/caches/modules-2/files-2.1/org.jetbrains.kotlin/kotlin-stdlib-jdk7/1.5.30/525f5a7fa6d7790a571c07dd24214ed2dda352fe/kotlin-stdlib-jdk7-1.5.30.jar (version 1.5)
    /Users/navaronbracke/.gradle/caches/modules-2/files-2.1/org.jetbrains.kotlin/kotlin-stdlib/1.7.10/d2abf9e77736acc4450dc4a3f707fa2c10f5099d/kotlin-stdlib-1.7.10.jar (version 1.7)
    /Users/navaronbracke/.gradle/caches/modules-2/files-2.1/org.jetbrains.kotlin/kotlin-stdlib-common/1.7.10/bac80c520d0a9e3f3673bc2658c6ed02ef45a76a/kotlin-stdlib-common-1.7.10.jar (version 1.7)
w: Some runtime JAR files in the classpath have an incompatible version. Consider removing them from the classpath
e: /Users/navaronbracke/.gradle/caches/modules-2/files-2.1/androidx.annotation/annotation/1.5.0/857678d6b4ca7b28571ef7935c668bdb57e15027/annotation-1.5.0.jar!/META-INF/annotation.kotlin_module: Module was compiled with an incompatible version of Kotlin. The binary version of its metadata is 1.7.1, expected version is 1.5.1.
e: /Users/navaronbracke/.gradle/caches/modules-2/files-2.1/org.jetbrains.kotlin/kotlin-stdlib/1.7.10/d2abf9e77736acc4450dc4a3f707fa2c10f5099d/kotlin-stdlib-1.7.10.jar!/META-INF/kotlin-stdlib.kotlin_module: Module was compiled with an incompatible version of Kotlin. The binary version of its metadata is 1.7.1, expected version is 1.5.1.
e: /Users/navaronbracke/.gradle/caches/modules-2/files-2.1/org.jetbrains.kotlin/kotlin-stdlib-common/1.7.10/bac80c520d0a9e3f3673bc2658c6ed02ef45a76a/kotlin-stdlib-common-1.7.10.jar!/META-INF/kotlin-stdlib-common.kotlin_module: Module was compiled with an incompatible version of Kotlin. The binary version of its metadata is 1.7.1, expected version is 1.5.1.
w: Runtime JAR files in the classpath should have the same version. These files were found in the classpath:
    /Users/navaronbracke/.gradle/caches/modules-2/files-2.1/org.jetbrains.kotlin/kotlin-stdlib-jdk8/1.5.30/5fd47535cc85f9e24996f939c2de6583991481b0/kotlin-stdlib-jdk8-1.5.30.jar (version 1.5)
    /Users/navaronbracke/.gradle/caches/modules-2/files-2.1/org.jetbrains.kotlin/kotlin-stdlib-jdk7/1.5.30/525f5a7fa6d7790a571c07dd24214ed2dda352fe/kotlin-stdlib-jdk7-1.5.30.jar (version 1.5)
    /Users/navaronbracke/.gradle/caches/modules-2/files-2.1/org.jetbrains.kotlin/kotlin-stdlib/1.7.10/d2abf9e77736acc4450dc4a3f707fa2c10f5099d/kotlin-stdlib-1.7.10.jar (version 1.7)
    /Users/navaronbracke/.gradle/caches/modules-2/files-2.1/org.jetbrains.kotlin/kotlin-stdlib-common/1.7.10/bac80c520d0a9e3f3673bc2658c6ed02ef45a76a/kotlin-stdlib-common-1.7.10.jar (version 1.7)
w: Some runtime JAR files in the classpath have an incompatible version. Consider removing them from the classpath
No issues found.
Running Gradle task 'assembleRelease'...                           61.6s
✓  Built build/app/outputs/flutter-apk/app-release.apk (7.4MB).
Installing build/app/outputs/flutter-apk/app-release.apk...      2,946ms

Flutter run key commands.
h List all available interactive commands.
c Clear the screen
q Quit (terminate the application on the device).

The deprecation messages no longer appear (which is the goal of this PR),
but the following messages from Gradle are seen as warnings (Also notice they start with w:), which would become fatal with the flag enabled:

w: Runtime JAR files in the classpath should have the same version.
These files were found in the classpath:
<list of files with classpath issues>

Those messages are actually dependency problems (as the dependencies and the project itself use different version of the Kotlin Standard Libary, hence the warnings) and shouldn't be fatal? I'm not sure if there is a way to lower the severity of this category of messages (to an info category of sorts), so that we can rely on --fatal-warnings as intended.

@stuartmorgan-g stuartmorgan-g changed the title [camera_android] Recreating PR 7062 from flutter/plugins [camera_android] Fix camera android deprecation warning for CamcorderProfile.get() Feb 23, 2023
@stuartmorgan-g
Copy link
Collaborator

I'm exploring an alternate solution for making deprecation warnings errors now; if that pans out I'll have a PR soon to enable it with an initial exclusion list, and then this PR will be able to include removing camera_android from the exclusion list.

Copy link
Contributor

@camsim99 camsim99 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The change looks good to me!

@stuartmorgan-g
Copy link
Collaborator

I'm exploring an alternate solution for making deprecation warnings errors now; if that pans out I'll have a PR soon to enable it with an initial exclusion list, and then this PR will be able to include removing camera_android from the exclusion list.

This is posted as #3293

Once that lands, this can be covered by just enabling this: https://github.com/flutter/packages/pull/3293/files#diff-c40bf8281656da0025c18216f38b473c0f0c018ccce9b04c57cf25f8a391b91fR38-R39

@CaseyHillers
Copy link
Contributor

Removing needs tests as in follow up commits tests were added to verify the change.

Copy link
Collaborator

@stuartmorgan-g stuartmorgan-g left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM, thanks!

@stuartmorgan-g stuartmorgan-g added the autosubmit Merge PR when tree becomes green via auto submit App label Mar 7, 2023
@auto-submit auto-submit bot merged commit c40f189 into flutter:main Mar 7, 2023
engine-flutter-autoroll added a commit to engine-flutter-autoroll/flutter that referenced this pull request Mar 7, 2023
auto-submit bot pushed a commit to flutter/flutter that referenced this pull request Mar 7, 2023
sourcegraph-bot pushed a commit to sgtest/megarepo that referenced this pull request Mar 7, 2023
…rning for CamcorderProfile.get() (flutter/packages#3273) (#122104)

Commit: 80be2bfc9f8cc39d197f616b8ce809217908a5f8
@navaronbracke navaronbracke deleted the fix_camera_android_deprecation branch March 7, 2023 17:33
engine-flutter-autoroll added a commit to engine-flutter-autoroll/packages that referenced this pull request Mar 8, 2023
engine-flutter-autoroll added a commit to engine-flutter-autoroll/packages that referenced this pull request Mar 8, 2023
engine-flutter-autoroll added a commit to engine-flutter-autoroll/packages that referenced this pull request Mar 8, 2023
@bartekpacia
Copy link
Member

What release is this fix available in?

@stuartmorgan-g
Copy link
Collaborator

What release is this fix available in?

You can look at the pubspec changes in a PR to know what version it is in.

engine-flutter-autoroll added a commit to engine-flutter-autoroll/packages that referenced this pull request May 10, 2023
engine-flutter-autoroll added a commit to engine-flutter-autoroll/packages that referenced this pull request May 10, 2023
nploi pushed a commit to nploi/packages that referenced this pull request Jul 16, 2023
…Profile.get() (flutter#3273)

[camera_android] Fix camera android deprecation warning for CamcorderProfile.get()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

autosubmit Merge PR when tree becomes green via auto submit App p: camera platform-android

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[camera] Build warnings on camera 0.9.4+5

6 participants