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

image_picker: Depend on full support-v4 library for ease of use #747

Merged
merged 1 commit into from
Aug 30, 2018

Conversation

sir-boformer
Copy link
Contributor

@sir-boformer sir-boformer changed the title Depend on full support-v4 library for ease of use image_picker: Depend on full support-v4 library for ease of use Aug 30, 2018
@calebisstupid
Copy link

I feel like a total noob over here but can I grab this PR as a dependency in my pubspec before it's accepted?

Copy link
Member

@goderbauer goderbauer 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!

@goderbauer goderbauer merged commit db3f999 into flutter:master Aug 30, 2018
@goderbauer
Copy link
Member

@calebisstupid I don't think you can do that, but the fix is live on pub now.

@sir-boformer
Copy link
Contributor Author

sir-boformer commented Aug 30, 2018

@calebisstupid For future reference:

dependencies:
  flutter:
    sdk: flutter
  image_picker:
    git:
      url: git://github.com/sir-boformer/plugins.git
      ref: revert-deps
      path: packages/image_picker

@goderbauer
Copy link
Member

@sir-boformer TIL. Cool!

teriyakijack added a commit to teriyakijack/plugins that referenced this pull request Aug 31, 2018
* upstream/master:
  Update FOSDC config (flutter#751)
  Add support-v4 dep to ml-vision (flutter#750)
  Add support for firebaseopensource.com (flutter#749)
  Use api to allow support-v4 version resolution. (flutter#748)
  Depend on full support-v4 library for ease of use (flutter#747)
  Plugin template for webview_flutter (flutter#746)
  Fix Java lint warnings in google maps plugin (flutter#745)
  Remove iOS instructions from the maps plugin readme. (flutter#744)
  [image_picker] White line after resize - fixed by adding floor() (flutter#686)
  Port google_maps_flutter to use AndroidView for embedding the map. (flutter#743)
@calebisstupid
Copy link

calebisstupid commented Aug 31, 2018

Thanks for the help! So I've got 0.4.10 now, but I am seeing the following:

What went wrong: Execution failed for task ':app:preDebugBuild'. Android dependency 'com.android.support:support-v4' has different version for the compile (26.1.0) and runtime (27.1.1) classpath. You should manually set the same version via DependencyResolution

I should add, it appears to be working when I added the following to my build.gradle file:

subprojects {
    project.configurations.all {
        resolutionStrategy.eachDependency { details ->
            if (details.requested.group == 'com.android.support'
                    && !details.requested.name.contains('multidex') ) {
                details.useVersion "26.1.0"
            }
        }
    }
}

Searched a bit on this and unfortunately do not know enough about gradle to fully grasp why exactly this works (I'm coming to flutter from more iOS experience), and whether or not this is a workaround or a real fix. Any chance I could get a ELI5 on what exactly this is referring to?

@sir-boformer
Copy link
Contributor Author

Does the issue still occur in image_picker 0.4.11? It was published a few hours ago.

Does adding this to your build.gradle fix the problem?

dependencies {
    ...
    implementation 'com.android.support:support-v4:27.1.1'
}

Can you post your full build.gradle (the one in the app folder) and your pubspec.yaml dependencies?

@calebisstupid
Copy link

calebisstupid commented Aug 31, 2018

@sir-boformer

I'll give 0.4.11 a shot. What is weird is an older flutter app I opened and migrated to 0.6.0 (also using image_picker 0.4.10) does not have this issue. Both projects were created with the standard flutter project creator. I'm just failing at isolating the cause.

Adding implementation 'com.android.support:support-v4:27.1.1' and removing the subprojects section from my first post re-introduces the issue

For the project causing this issue:
yaml:

name: obfuscated_project
description: A new Flutter project.

dependencies:
  flutter:
    sdk: flutter
  location: ^1.4.0
  modal_progress_hud: ^0.1.0
  http: ^0.11.3+17
  intl: ^0.15.7
  image_picker: ^0.4.10
  cached_network_image: ^0.4.2
  cupertino_icons: ^0.1.2
  json_annotation: ^1.0.0

dev_dependencies:
  json_serializable: ^1.0.0
  build_runner: ^0.10.1+1

flutter:
  assets:
   - images/obfuscated_project-bg-wgradient.png
  fonts:
    - family: BerkshireSwash
      fonts:
        - asset: fonts/BerkshireSwash-Regular.ttf

  uses-material-design: true

build.gradle:

buildscript {
    repositories {
        google()
        jcenter()
    }

    dependencies {
        classpath 'com.android.tools.build:gradle:3.0.1'
        implementation 'com.android.support:support-v4:27.1.1'
    }
}

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
}

@sir-boformer
Copy link
Contributor Author

That's the wrong build.gradle. The one in your "app" folder...

My first guess would be the location plugin. You would have to remove all plugins (plugin means flutter libraries which access native OS features) and enable them one by one to find the culprit.

Or just keep the workaround in place...

@calebisstupid
Copy link

Ok cool. Adding implementation 'com.android.support:support-v4:27.1.1' to the build.gradle in the app folder works.

I did toggle each plugin in and out and this was only occuring with image_picker.

I'll keep this implementation dependency in instead of the subprojects one.

@calebisstupid
Copy link

Adding this in case it helps with anything: I went to do a release build of the working app (working as in debug running fine) and got

error: invalid file path '/Users/_obfuscated_/workspace/_obfuscated_/build/image_picker/intermediates/manifests/aapt/release/AndroidManifest.xml'.


FAILURE: Build failed with an exception.

* What went wrong:
Execution failed for task ':image_picker:verifyReleaseResources'.
> java.util.concurrent.ExecutionException: java.util.concurrent.ExecutionException: com.android.tools.aapt2.Aapt2Exception: AAPT2 error: check logs for details

Ended up adding the same implementation 'com.android.support:support-v4:27.1.1' and release build worked.

nichtverstehen pushed a commit to nichtverstehen/plugins that referenced this pull request Sep 6, 2018
andreidiaconu pushed a commit to andreidiaconu/plugins that referenced this pull request Feb 17, 2019
andreidiaconu added a commit to andreidiaconu/plugins that referenced this pull request Feb 17, 2019
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.

Upgrade to 0.6 beta completely broke my app
4 participants