0

I have a Cordova project created using Visual Studio 2015's Tools for Apache Cordova. We're trying to create a plugin that uses an external library, and that library depends on various things such as Google's location services. I've found that they go in a .gradle file, but have no idea how to get them in that file using TACO. I can do it manually, but VS regenerates the .gradle file every time the project's built.

I'm new to TACO, so it may be I'm missing something.

PointlessSpike
  • 333
  • 5
  • 16

1 Answers1

1

Very common problem when starting out with Cordova Plugins. I've struggled with this in the past. Start by reading this. You need to add some entries to your plugin.xml file. In that file you should have a section for each platform you support. You should also not be modifying the platform/android/build.gradle file directly. Make a separate one which will eventually get it's contents appended to your platform/android/build.gradle using <framework>.

<platform name="android">

</platform>

In platforms add something similar to match your features:

Permissions docs

<config-file target="AndroidManifest.xml" parent="/*">
    <uses-permission android:name="android.permission.ACCESS_FINE_LOCATION"/>
    ....
</config-file>

External Libs docs

<framework src="src/android/build.gradle" custom="true" type="gradleReference" />
<source-file src="lib/android/sample-android-sdk/sample.jar" custom="true" target-dir="lib" />
johnborges
  • 2,422
  • 20
  • 33
  • I'm not entirely sure what needs to go into my build,gradle file... I've just put the dependencies thing in there and I'm getting an error saying buildToolsVersion is not specified. Is there somewhere with more info on this? – PointlessSpike Oct 25 '16 at 08:12
  • I think it's falling over on this line: compile(name:opencv,ext:'aar') – PointlessSpike Oct 25 '16 at 08:30
  • I took out the JAR file and used that instead and it's not erroring on build anymore. But now when running the plugin I'm getting an error saying it couldn't find "libopencv_java3.so". – PointlessSpike Oct 25 '16 at 09:05
  • That turned out to be something different, where I needed to use a .aar file. This has really helped everything come together, so thanks a lot. – PointlessSpike Oct 25 '16 at 13:06