【问题标题】:Adding Fabric answers to a common library within the project将 Fabric 答案添加到项目中的公共库
【发布时间】:2016-11-03 13:15:03
【问题描述】:

我有一个项目,它有一个公共库。这个库被引用到我的基础应用程序和其他库。

我需要将 Fabrics Answers 集成到 Base 库中的一个公共类中,我可以使用该类从任何模块调用或引用。 我尝试将 Fabric 答案添加到公共库,但它在引用此公共库的每个模块中都抛出错误。

错误是:-

Failed to resolve: com.crashlytics.sdk.android:answers:1.3.10

我该如何解决这个问题。

自定义库的 Gradle 是:-

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 23
    buildToolsVersion "24.0.1"

    defaultConfig {
        minSdkVersion 11
        targetSdkVersion 11
        compileOptions {
            sourceCompatibility JavaVersion.VERSION_1_7
            targetCompatibility JavaVersion.VERSION_1_7
        }
    }

    buildTypes {
        release {
            minifyEnabled false
            proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.txt'
        }
    }
}

dependencies {
    compile 'com.android.support:support-v4:23.4.0'
    compile files('libs/conceal_android.jar')
    compile files('libs/cordova-5.3.0.jar')
    compile files('libs/dom4j-1.6.1.jar')
    compile files('libs/fbconnect.jar')
    compile files('libs/FlurryAgent.jar')
    compile files('libs/google-play-services.jar')
    compile files('libs/in-app-purchasing-1.0.3.jar')
    compile files('libs/jaxen-1.1-beta-6.jar')
    compile files('libs/libconceal.jar')
    compile files('libs/twitter4j-core-3.0.3.jar')
    compile files('libs/zip4j_1.3.2.jar')
    compile('com.crashlytics.sdk.android:answers:1.3.10@aar') {
        transitive = true;
    }
}

显示的错误是:-

我该如何解决这个问题。否则我必须总是去把这个答案添加到单个模块并重复代码

【问题讨论】:

  • 可能是您的 android 或 google 存储库不是更新版本,因此也会发生这种情况

标签: android android-gradle-plugin build.gradle twitter-fabric


【解决方案1】:

你需要

<meta-data
            android:name="io.fabric.ApiKey"
            android:value="YOUR_FABRIC_API_KEY" />

在 AndroidManifest.xml 中

【讨论】:

  • 它已经在工作了...... Fabric 正在对我工作......我需要将它添加到我的库中,这样我就可以在任何地方使用它作为一个通用类
猜你喜欢
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 2015-06-29
  • 2022-08-18
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
相关资源
最近更新 更多