fluttie icon indicating copy to clipboard operation
fluttie copied to clipboard

Run error

Open geoffery009 opened this issue 7 years ago • 5 comments

FAILURE: Build failed with an exception.

  • What went wrong: Execution failed for task ':app:preDebugBuild'.

Android dependency 'com.android.support:support-fragment' has different version for the compile (25.2.0) and runtime (27.0.2) classpath. You should manually set the same version via DependencyResolution

  • Try: Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output.

  • Get more help at https://help.gradle.org

BUILD FAILED in 2s Finished with error: Gradle build failed: 1

geoffery009 avatar Apr 03 '18 08:04 geoffery009

Thanks for the report. Does this error occur when trying to build the example included in this repo or did you encounter it in your own project? I'm asking because I can build projects depending on Fluttie on my machine and because Fluttie does not depend on 'com.android.support:support-fragment'. It only transitively depends on 'com.android.support:appcompat-v7' with version 27.0.2. So, if you're including other dependencies in your own project, it would be helpful if you could list the other flutter plugins you're using in your pubspec.yaml.

simolus3 avatar Apr 03 '18 12:04 simolus3

dependencies: flutter: sdk: flutter

cupertino_icons: ^0.1.0 location: "^1.1.7" http: "^0.11.3+16" json_annotation: "^0.2.2" intl: "^0.15.4" shared_preferences: "^0.4.0" share: "^0.4.0" package_info: "^0.3.0" flutter_webview_plugin: "^0.1.5" fluttie: "^0.2.0"

use in my own project , run the example and it conflict with 'location' flutter plugin

geoffery009 avatar Apr 04 '18 01:04 geoffery009

Ok, I think I figured it out. What I said earlier is wrong as the Android library of Lottie does depend on the support-fragment library. As the version Lottie is using differs from the version the location package requests, the build fails because Gradle can't decide which version to include. If you go to the build.gradle of your android/app module and add the following line at the beginning of the dependencies section, your build should work even with Fluttie enabled:

dependencies {
    implementation 'com.android.support:support-fragment:27.1.0'

    [...]

This will force the location plugin to use the newer version that Fluttie is using as well. I have just published an update for Fluttie including the latest version of Lottie, I recommend that you use it as well here:fluttie: "^0.2.1". After you have done all this, please run

flutter clean
flutter packages get

and check if you can then run your app with Fluttie.

simolus3 avatar Apr 04 '18 13:04 simolus3

it works:0,thanks ps:how to change widget size ,i use 'preferredSize' but it dosent works


await instance.prepareAnimation(emojiComposition,
        duration: const Duration(seconds: 2),
        preferredSize: Fluttie.kDefaultSize,
        repeatCount: const RepeatCount.infinite(),
        repeatMode: RepeatMode.START_OVER);

geoffery009 avatar Apr 08 '18 01:04 geoffery009

You can change the size of your animations in two places: In instance.prepareAnimation and in the place you create the widget in, with new FluttieAnimation(yourAnimation, size: const Size(w, h)). You're looking for the second option here. The first one, which you're using, controlls the dimension in which the animation will be rendered in (higher size: better quality, but it might introduce lag on slower devices). The second one is the size the animation will be displayed with. They don't have to be the same size as you can, for instance, scale small animations to a big display size when high resolutions aren't required. Effectively, you need to use the size parameter when you're creating a new FluttieAnimation as a widget. If the outcome of that animation looks bad, increase the preferredSize when preparing the animation. If it feels sluggish, decrease the preferred size.

simolus3 avatar Apr 13 '18 19:04 simolus3