Skip to content
This repository was archived by the owner on Feb 22, 2023. It is now read-only.

Conversation

@redbrogdon
Copy link
Contributor

Hello from the AdMob DevRel team!

I'm making some updates to the firebase-admob plugin as a first step toward teaching myself Flutter. This is my first time coding in Dart and my first Flutter-related commit, so feel free to critique anything. :)

@redbrogdon
Copy link
Contributor Author

TIL about proper line length for .dart files.

@redbrogdon
Copy link
Contributor Author

The remaining Travis failure is for the iOS build:

Found "Xcode 8.3.3". Xcode 9.0 or greater is required to develop for iOS.
Encountered error while building for device.

I don't see this error for any of the other PRs, but I also haven't touched anything specific to iOS here. Any advice?

@lukef
Copy link
Contributor

lukef commented Dec 17, 2017

@redbrogdon - unrelated, you may want to bump gradle to 3.0.1 as that is the latest. i.e.: com.android.tools.build:gradle:3.0.1

@redbrogdon
Copy link
Contributor Author

Nice catch. Done.

@lukef
Copy link
Contributor

lukef commented Dec 17, 2017

re: xcode. It might be related to cocoapods. The example does not specify a platform value but travis is set up to use xcode 8.3. If cocoapods is being downloaded then it could be defaulting to 9.x.

The example app should probably specify a platform value and the travis configuration should also probably be updated to use xcode 9.

@redbrogdon
Copy link
Contributor Author

Hrm. Xcode is still failing, and I don't want to try messing with the Travis configuration for a project for which I'm not yet a contributor

If anyone from the Flutter team can point me toward the best way to resolve this, much obliged. I'll hold here and work on some other changes locally for now.

@zanderso
Copy link
Member

/cc @mravn-google

@mravn-google
Copy link
Contributor

mravn-google commented Dec 18, 2017

We're currently seeing the same Xcode 8 vs Xcode 9 issue for all plugins (I believe) due to flutter/flutter@7fb7852. We seem to need an upgrade to the Travis config for flutter/plugins. I'm on it (#314)

Copy link
Contributor

@mravn-google mravn-google left a comment

Choose a reason for hiding this comment

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

Thanks for contributing!


buildscript {
repositories {
maven {
Copy link
Contributor

Choose a reason for hiding this comment

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

With Gradle 4.x, you can write just google().

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Done.


dependencies {
classpath 'com.android.tools.build:gradle:2.3.0'
classpath 'com.android.tools.build:gradle:3.0.1'
Copy link
Contributor

@mravn-google mravn-google Dec 18, 2017

Choose a reason for hiding this comment

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

This is a breaking change, right? We are eventually going to move all plugins to Gradle 4.1 / Android Studio Gradle plugin 3.0.1, but by doing so, existing Flutter projects cannot consume them until they also upgrade these Gradle-related dependencies. This is OK, we just need to make sure that each plugin's version is bumped accordingly (semver), and that the change log includes an entry stating the compatibility break and how to deal with it. You may wish to link to our wiki page describing how to upgrade existing Flutter projects.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Reverted. See my comment below on the firebase-core and -ads versions.


rootProject.allprojects {
repositories {
maven {
Copy link
Contributor

Choose a reason for hiding this comment

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

google()

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Done.

compileSdkVersion 25
buildToolsVersion '25.0.3'
compileSdkVersion 26
buildToolsVersion '26'
Copy link
Contributor

Choose a reason for hiding this comment

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

The new Flutter template uses buildToolsVersion '26.0.3' to avoid an Android Studio warning about a newer version being available.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Done.

compileSdkVersion 25
buildToolsVersion '25.0.3'
compileSdkVersion 26
buildToolsVersion '26'
Copy link
Contributor

Choose a reason for hiding this comment

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

26.0.3

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Done.

androidTestCompile 'com.android.support:support-annotations:25.2.0'
androidTestCompile 'com.android.support.test:runner:0.5'
androidTestCompile 'com.android.support.test:rules:0.5'
androidTestImplementation 'com.android.support:support-annotations:26.1.0'
Copy link
Contributor

Choose a reason for hiding this comment

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

New Flutter project template uses the following, roughly aligning with the project templates of Android Studio 3.0.1:

dependencies {
    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'
}

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Done.

@@ -1,5 +1,5 @@
# Uncomment this line to define a global platform for your project
# platform :ios, '9.0'
platform :ios, '8.0'
Copy link
Contributor

Choose a reason for hiding this comment

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

This is inconsistent with new Flutter requirements, I believe (flutter/flutter@7fb7852).

Copy link
Contributor Author

Choose a reason for hiding this comment

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

This was just an attempt to try to unbreak the Travis Xcode test. It's reverted now.

compile 'com.google.firebase:firebase-core:11.4.+'
compile 'com.google.firebase:firebase-ads:11.4.+'
// firebase-core is exposed so the google-services plugin will see it.
api 'com.google.firebase:firebase-core:11.6.2'
Copy link
Contributor

Choose a reason for hiding this comment

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

I'm a bit uneasy about pinning these dependencies to specific versions. Many Flutter apps are going to be using several Firebase-related plugins together, and then they face the challenge of ensuring consistency among transient dependencies like firebase-core. Since the other plugins currently (and unfortunately) use 11.4.+, we have an inconsistency with 11.6.2. Is upgrading to 11.6.2 necessary? If not, please stay at 11.4.+. Otherwise, we need to provide consistent versions of the other Firebase plugins as well. Those updates could then bump the Gradle versions as well. And I'd suggest using the version range specifier [11.6.2,12.0[ to avoid a similar issue in the future, at least until somebody needs v12.

Copy link

Choose a reason for hiding this comment

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

Cloud Firestore also needs a bump to 11.6.+, see comment.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Right, this plugin doesn't exist in a vacuum, and is instead part of a suite that needs to work together. I should have accounted for that.

I don't need any recently released features, so there's no need to update the versions in this file now. When they do get updated, it should clearly be in concert with the others. Change reverted.

@redbrogdon
Copy link
Contributor Author

Thanks for the quick feedback! I believe I've addressed your concerns, and with the Travis config change 9.2 is building the iOS version just fine. Let me know if I missed anything or there are other issues, though.

On a related note, I've begun adding rewarded video ads to the plugin in another local branch. Would it be a normal practice to send a work-in-progress PR with just the Dart code (no iOS or Android platform code), so someone can sanity check it and the API before I keep going?

@mravn-google
Copy link
Contributor

@redbrogdon Sounds great! If you create a PR that represents work in progress, just mark it as such in the title (e.g. [WIP] Xxx or [Review only] Yyy) and add a comment saying what you'd like reviewers to focus on and what to ignore for now.

@lukef
Copy link
Contributor

lukef commented Dec 19, 2017

@redbrogdon @mravn-google - It might also make sense to bump the compile + target sdk to 27 and build tools to 27.0.2 as they are the latest versions. Also, I know we're using inclusive dependency versioning, but it's worth noting that Google Play Services 11.8 came out today as well so all firebase deps will use 11.8.

@mravn-google
Copy link
Contributor

@lukef Our current strategy is to follow Android Studio templates as much as possible/reasonable. And those are still at v26, I believe (at least, that is the case on my machine). Not sure why, but possibly related to the fact that the SDK manager says v27 is only "partially installed", offering me no obvious way to complete it.

@mravn-google
Copy link
Contributor

@redbrogdon @lukef FYI, #317 is on its way too, with Gradle and dependency upgrades to Firebase-related plugins.

@lukef
Copy link
Contributor

lukef commented Dec 19, 2017

re: templates - I think the AS templates probably haven't caught up to the release yet. It's trivial to change them for each app, but last night I got a notification that flutter run is installing SDK platform 25 because it needs 25 (outdated) meaning that my app is now dependent on many versions of the SDK and build tools. This is less than ideal as it takes up space on laptops, creates possible conflicts, etc. It would be ideal if you could target an SDK for all plugins + flutter + native that is synchronized but i understand the difficulties of that.

re: partially installed - you need to click the "Show Package Details" checkbox at the bottom of the list. This will show the full set of options.

capture

Add multiple database support to firebase_database. Includes Android bug fixes for firebase_core.
@mravn-google
Copy link
Contributor

mravn-google commented Dec 20, 2017

@redbrogdon Sorry, we should get you in a position to land this. May I ask you to write a CHANGELOG.md entry and bump the version in pubspec.yaml? I'll deal with the Gradle version and template issues as part of #317.

@redbrogdon
Copy link
Contributor Author

Sure thing. I'm doing some traveling for the holidays, but can have it for you in a day or two.

@sethladd
Copy link
Contributor

@redbrogdon thank you so much for the contribution!

@lukef
Copy link
Contributor

lukef commented Dec 20, 2017

Sorry to be a pest, but does this mean that flutter will be targeting SDK 26 as a maximum? this seems contrary to what we should be doing on the android native side. I would think that targeting 27 is in the best interests of everyone, unless you know something i don't.

@mravn-google
Copy link
Contributor

mravn-google commented Dec 20, 2017

@lukef No. The project templates are not normative; they are intended to provide a starting point for new projects, and certainly the target SDK is the choice of the app developer (so long as you stay above the minimum supported by Flutter, SDK 16).

I postponed the template upgrade to version 27 because there were already too many moving pieces with the upgrade to Gradle 4.1 and and AS Gradle plugin 3.0.1.

@lukef
Copy link
Contributor

lukef commented Dec 20, 2017

@mravn-google - Happy to jump on a call to discuss, but .. the issue I see is that if you lock the plugin to 26 and (specifically) build-tools 26.0.2 and, lets say, you have only 26.0.1 installed then you will need to pull down v 26.0.2 on top also. so if plugin A is 26.0.1 and plugin B is 26.0.2 and your app is 27.0.2 then you have 3 versions in play.

I'm working on a loose proposal to work around it, but in the meantime my thoughts are if you push people to the highest version it is better. it'd be better for a developer to be forced to bump the build version in their app vs having to fight each plugin if they want to use 27.

@lukef
Copy link
Contributor

lukef commented Dec 20, 2017

Full disclosure: I don't know fully the direct consequences of the above scenario other than it using a bunch of bandwidth and disk space. There are other side effects that are best shared in an email because its probably making this PR messy :)

@redbrogdon
Copy link
Contributor Author

Oh, look at me forgetting to pull changes.

@redbrogdon
Copy link
Contributor Author

Clearly I'm learning as much about developing on GitHub as I am about Dart and Flutter. It looks like I've doubled up commits while rebasing onto the changes from master, which has bloated the PR and made it look (to my untrained eye) impossible to review.

Is there a simple way to fix this that you can recommend, or should I just blow away this pull request and make a new, clean one?

@redbrogdon
Copy link
Contributor Author

I'm going to go ahead and close this PR and create a new one. Should be ready in a jiffy.

@redbrogdon
Copy link
Contributor Author

New pull requested submitted as #327.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

9 participants