Twitter Kit Fabric Android on module Library Android Studio

…衆ロ難τιáo~ 提交于 2019-12-23 21:51:48

问题


I have a problem with Twitter Kit SDK for Android, I need to import Twitter Kit SDK to a library (module) within my project (I'm using Android Studio). I am using Fabric Studio Plugin for Android, to support the implementation, but when implement as shown in the link https://dev.twitter.com/fabric/android/integrating in the library (module), the Gradle not finds and returns me the message "Could not find com.twitter.sdk.android:twitter:1.4.0", then when I implement in my app (module), the import is successful, I can not import through the gradle for a library?

apply plugin: 'com.android.library'
apply plugin: 'io.fabric'

buildscript {
    repositories {
        mavenCentral()
        maven { url 'https://maven.fabric.io/public' }
    }

    dependencies {
        classpath 'io.fabric.tools:gradle:1.+'
    }
}

repositories {
    mavenCentral()
    maven { url 'https://maven.fabric.io/public' }
}

android {
    signingConfigs {
    }
    compileSdkVersion 21
    buildToolsVersion '20.0.0'
    defaultConfig {
        minSdkVersion 14
        targetSdkVersion 21
        versionCode 1
        versionName "1.0"
    }
    buildTypes {
        release {
            minifyEnabled false
            proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
        }
    }
}

dependencies {
    compile fileTree(include: ['*.jar'], dir: 'libs')
    compile 'com.android.support:appcompat-v7:21.0.3'
    compile 'com.facebook.android:facebook-android-sdk:4.0.0'
    compile('com.twitter.sdk.android:twitter:1.4.0@aar') {
        transitive = true;
    }

    compile project(':httplib')
}

回答1:


I created a re-usable twitter component usig fabric

My working gradle look like below

  buildscript {
repositories {
    maven { url 'https://maven.fabric.io/public' }
}

dependencies {
    classpath 'io.fabric.tools:gradle:1.+'
   }
 }
   apply plugin: 'com.android.library'
   apply plugin: 'io.fabric'

repositories {
  maven { url 'https://maven.fabric.io/public' }
 }
android {
compileSdkVersion 22
buildToolsVersion "21.1.2"

defaultConfig {
    minSdkVersion 14
    targetSdkVersion 22
    versionCode 1
    versionName "1.0"
}
buildTypes {
    release {
        minifyEnabled false
        proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
    }
}
 }

  dependencies {
   compile fileTree(dir: 'libs', include: ['*.jar'])
  compile 'com.android.support:appcompat-v7:22.0.0'
   compile('com.twitter.sdk.android:twitter:1.3.2@aar') {
   transitive = true;
 }
 } 

Once you updated your gradle make sure to sync gradle and finally rebuild the project.Worked well for me.



来源:https://stackoverflow.com/questions/29569200/twitter-kit-fabric-android-on-module-library-android-studio

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!