Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Using with gradle - remove support-v4 from default? #43

Open
rafaeliga opened this issue Aug 18, 2016 · 6 comments
Open

Using with gradle - remove support-v4 from default? #43

rafaeliga opened this issue Aug 18, 2016 · 6 comments

Comments

@rafaeliga
Copy link
Contributor

rafaeliga commented Aug 18, 2016

Is there a way to remove android-support-v* from default config?

My project needs motion-gradle support and I want to keep everything there, using gradle.

These are the lines that I needed to remove from default android project file:

vendor_dir = File.join(File.dirname(__FILE__), '../vendor/android')
  v7_app_compat_dir = File.join(vendor_dir, 'support/v7/appcompat')
  app.vendor_project(:jar => File.join(v7_app_compat_dir, "/libs/android-support-v4.jar"))
  app.vendor_project(:jar => File.join(v7_app_compat_dir, "/libs/android-support-v7-appcompat.jar"), :resources => File.join(v7_app_compat_dir, "/res"), :manifest => File.join(v7_app_compat_dir, "/AndroidManifest.xml"))
  app.vendor_project(:jar => File.join(vendor_dir, 'google-play-services_lib/libs/google-play-services.jar'), :filter => ['^.com.google.android.gms.vision'], :resources => File.join(vendor_dir, 'google-play-services_lib/res'), :manifest => File.join(vendor_dir, 'google-play-services_lib/AndroidManifest.xml'))
  app.manifest_entry('application', 'meta-data', :name => 'com.google.android.gms.version', :value => '@integer/google_play_services_version')
  app.manifest_entry('application', 'meta-data', :name => 'com.google.android.gms.vision.DEPENDENCIES', :value => 'barcode')

I tried to find a way to just clean the vendor_projects array but it seems not possible with motion.

@jjaffeux
Copy link
Contributor

jjaffeux commented Aug 18, 2016

The easy way would just be to use motion-gradle for Flow. We wanted Flow to be very easy to get started, so I would prefer not.

We could try to be smarter and detect if motion-gradle is in the project and if the gradle dependencies include support-v4, would be something like:

unless app.respond_to?(:gradle) && gradle.dependencies.map(&:name).include?("support-v4")
  vendor_dir = File.join(File.dirname(__FILE__), '../vendor/android')
  v7_app_compat_dir = File.join(vendor_dir, 'support/v7/appcompat')
  app.vendor_project(:jar => File.join(v7_app_compat_dir, "/libs/android-support-v4.jar"))
  app.vendor_project(:jar => File.join(v7_app_compat_dir, "/libs/android-support-v7-appcompat.jar"), :resources => File.join(v7_app_compat_dir, "/res"), :manifest => File.join(v7_app_compat_dir, "/AndroidManifest.xml"))
end

@rafaeliga
Copy link
Contributor Author

That sounds good!

Thanks for your fast answer.

Do I need to create a pull request with this or will probably be include in a next release? :D

@jjaffeux
Copy link
Contributor

happy to merge a PR if you get something working

@rafaeliga
Copy link
Contributor Author

rafaeliga commented Aug 18, 2016

The first part works "unless app.respond_to?(:gradle)", but the second didnt, because on that moment my code that adds the gradle dependencies wasnt executed yet, is that right?

I can create a Pull request only with the respond_to, but Im sure if that is correct.

@jjaffeux
Copy link
Contributor

yeah... was afraid of this, we need to figure out a solution to this :)

I don't have time to dig this for now, maybe using motion-gradle for flow would be the best solution.

@rafaeliga
Copy link
Contributor Author

Got it.

Im going to create a pull request with that.

Thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants