-
Notifications
You must be signed in to change notification settings - Fork 9.8k
[connectivity] Android Code Inspection and Clean up #3051
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
Can you fix up the merge conflicts? @xster - will this cause any problems with the v1 deprecation? |
|
LGTM |
@dnfield |
* master: [in_app_purchase] Android Code Inspection and Clean up (flutter#3120) Android Code Inspection and Clean up (flutter#3117) [in_app_purchase] Fix finishing purchases upon payment cancellation (flutter#3106) [google_maps_flutter_web] Fix convert.dart issues (flutter#3093) [multiple] Opt-out tests of null-safety (flutter#3113) [webview_flutter] add public documentation. (flutter#3114) in_app_purchase: started supported null as a parameter for the sandbox arguement (flutter#3110) [connectivity] Android Code Inspection and Clean up (flutter#3051) [android_intent] Android Code Inspection and Clean up (flutter#3043) Remove `io.flutter.embedded_views_preview` from README [google_maps_flutter] Fix headline in the readme (flutter#3100) [webview_flutter] Add new entrypoint that uses hybrid composition on Android (flutter#3067) [google_maps_flutter] Out of developers preview, bump to 1.0.0 (flutter#3091) [url_launcher_web] Move third_party under src. (flutter#3080) [plugin_platform_interface] Fix homepage in pubspec.yaml (flutter#3088) [connectivity_for_web] Fix homepage in pubspec.yaml (flutter#3089) [in_app_purchase] Update typo in example main.dart (flutter#3073)
This seems to break building for me on the Flutter dev branch with
Rolling back to |
Hi @hacker1024 Can you try with JDK 8 please . Thank you |
I added the following to android {
compileOptions {
sourceCompatibility JavaVersion.VERSION_1_8
targetCompatibility JavaVersion.VERSION_1_8
}
kotlinOptions {
jvmTarget = "1.8"
}
} |
Can you please provide your |
buildscript {
ext.kotlin_version = '1.4.10'
repositories {
google()
jcenter()
}
dependencies {
classpath 'com.android.tools.build:gradle:3.5.0'
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
}
}
allprojects {
repositories {
google()
jcenter()
}
}
rootProject.buildDir = '../build'
subprojects {
project.buildDir = "${rootProject.buildDir}/${project.name}"
}
subprojects {
project.evaluationDependsOn(':app')
}
task clean(type: Delete) {
delete rootProject.buildDir
}
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-6.7-all.zip |
Can you install JDK 8, Set JAVA_HOME and update gradle-wrapper.properties to :
Set JAVA_HOME:
|
It looks like switching to JDK 8 on my end did actually fix it - odd. |
@hacker1024 you are welcome |
PROBLEM: Upgrading to Java 11 will cause the following innocuous warnings to become build failures due to the "-Werror" flag: ``` > Task :connectivity:compileReleaseJavaWithJavac FAILED warning: [options] source value 7 is obsolete and will be removed in a future release warning: [options] target value 7 is obsolete and will be removed in a future release warning: [options] To suppress warnings about obsolete options, use -Xlint:-options. error: warnings found and -Werror specified FAILURE: Build failed with an exception. ``` Example: https://github.com/WorldHealthOrganization/app/runs/1318596280 FIX: Target Java 8 for all plugins that use the `-Werror` compiler argument: ``` android { ... compileOptions { sourceCompatibility JavaVersion.VERSION_1_8 targetCompatibility JavaVersion.VERSION_1_8 } ``` The plugins were all found with: ``` $ find . -name build.gradle | xargs grep Werror ./packages/connectivity/connectivity/android/build.gradle:def args = ["-Xlint:deprecation","-Xlint:unchecked","-Werror"] ./packages/camera/android/build.gradle:def args = ["-Xlint:deprecation","-Xlint:unchecked","-Werror"] ./packages/video_player/video_player/android/build.gradle:def args = ["-Xlint:deprecation","-Xlint:unchecked","-Werror"] ./packages/android_alarm_manager/android/build.gradle:def args = ["-Xlint:deprecation","-Xlint:unchecked","-Werror"] ./packages/android_intent/android/build.gradle:def args = ["-Xlint:deprecation","-Xlint:unchecked","-Werror"] ``` I think the config was broken for video_player. Also updated a few example apps too. WORKAROUND: As a temporary workaround, developers can downgrade to Java 11 which doesn't warn that Java 7 is obsolete. Example: https://github.com/WorldHealthOrganization/app/pull/1669/files#diff-710a4407aba47ffddf61ee9be9490428d5d0883759b18e490858db28e1ace4afR86 REGRESSION: @hamdikahloun - thanks for your work on the Connectivity package. Adding `-Werror` flags is a positive thing but I think is best combined with Java 8 to ensure that the warning don't become error. Your PR: flutter#3051 FYI @mehmetf, @Salakar, @bkonyi, @ened, @dnfield as you've all edited Java 8 targets
PROBLEM: Upgrading to Java 12 will cause the following innocuous warnings to become build failures due to the "-Werror" flag: ``` > Task :connectivity:compileReleaseJavaWithJavac FAILED warning: [options] source value 7 is obsolete and will be removed in a future release warning: [options] target value 7 is obsolete and will be removed in a future release warning: [options] To suppress warnings about obsolete options, use -Xlint:-options. error: warnings found and -Werror specified FAILURE: Build failed with an exception. ``` Example: https://github.com/WorldHealthOrganization/app/runs/1318596280 FIX: Target Java 8 for all plugins that use the `-Werror` compiler argument: ``` android { ... compileOptions { sourceCompatibility JavaVersion.VERSION_1_8 targetCompatibility JavaVersion.VERSION_1_8 } ``` The plugins were all found with: ``` $ find . -name build.gradle | xargs grep Werror ./packages/connectivity/connectivity/android/build.gradle:def args = ["-Xlint:deprecation","-Xlint:unchecked","-Werror"] ./packages/camera/android/build.gradle:def args = ["-Xlint:deprecation","-Xlint:unchecked","-Werror"] ./packages/video_player/video_player/android/build.gradle:def args = ["-Xlint:deprecation","-Xlint:unchecked","-Werror"] ./packages/android_alarm_manager/android/build.gradle:def args = ["-Xlint:deprecation","-Xlint:unchecked","-Werror"] ./packages/android_intent/android/build.gradle:def args = ["-Xlint:deprecation","-Xlint:unchecked","-Werror"] ``` I think the config was broken for video_player. Also updated a few example apps too. WORKAROUND: As a temporary workaround, developers can downgrade to Java 11 which doesn't warn that Java 7 is obsolete. Example: https://github.com/WorldHealthOrganization/app/pull/1669/files#diff-710a4407aba47ffddf61ee9be9490428d5d0883759b18e490858db28e1ace4afR86 REGRESSION: @hamdikahloun - thanks for your work on the Connectivity package. Adding `-Werror` flags is a positive thing but I think is best combined with Java 8 to ensure that the warning don't become error. Your PR: flutter#3051 FYI @mehmetf, @Salakar, @bkonyi, @ened, @dnfield as you've all edited Java 8 targets
Description
Handle deprecation & unchecked warning as error
Avoiding uses or overrides a deprecated API
Update README with the updated information about WifiInfo on Android O or higher.
Related Issues
flutter/flutter#65970
Checklist
Before you create this PR confirm that it meets all requirements listed below by checking the relevant checkboxes (
[x]
). This will ensure a smooth and quick review process.///
).flutter analyze
) does not report any problems on my PR.Breaking Change
Does your PR require plugin users to manually update their apps to accommodate your change?