Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Setup twitter fabric sdk for cordova plugin

I'm trying to use Twitter login in my app using cordova, and I haven't found any plugin allowing to perform native login using the installed Twitter app credential.

So i want to create my own plugin, but I'm stuck on how to integrate Twitter sdk into my plugin.xml file. According to twitter's documentation, i'm supposed to edit my build.gradle to include the Maven repository and apply Fabric

 buildscript {
  repositories {
   jcenter()
   maven { url 'https://maven.fabric.io/repo' }
  }
 dependencies {
  classpath 'com.android.tools.build:gradle:0.13.3'
  // The Fabric Gradle plugin uses an open ended version to
  // react quickly to Android tooling updates
  classpath 'io.fabric.tools:gradle:1.+'
 }
}

apply plugin: 'com.android.application'

//Put Fabric plugin after Android plugin
apply plugin: 'io.fabric'

repositories {
 jcenter()
 maven { url 'https://maven.fabric.io/repo' }
}

My problem is, I have no idea how to do that in my plugin.xml file, and cordova plugin documentation doesn't talk about that.

Can anybody help?

like image 926
Thomas Avatar asked Jan 19 '15 14:01

Thomas


2 Answers

With the release of Cordova v5.0.0 and Cordova Android v4.0.0 Gradle is replacing Ant as the default build system. Here are the changes you might find interesting:

Changes For Plugin Developers:

Build using Gradle

  • All builds use Gradle by default, instead of Ant
  • Plugins can add their own gradle build steps!
  • Plugins can depend on Maven libraries using tags

So plugins can also include build-extras.gradle files via:

<framework src="some.gradle" custom="true" type="gradleReference" />
like image 67
krebernisak Avatar answered Nov 13 '22 18:11

krebernisak


I've been working on making a plugin as well. You can view the plugin's progress here. It still has rough edges as the gradle.build file needs dependencies and I don't know of a way to inject them correctly.

I've successfully used it in a simple "Hello Cordova" app and am working on trying to get it to work in a company project.

like image 28
TheBosZ Avatar answered Nov 13 '22 19:11

TheBosZ