简体   繁体   中英

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?

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" />

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.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM