Integrating Crashlytics to library project

前端 未结 3 771
滥情空心
滥情空心 2021-02-18 18:24

I have a library project (a custom view library project) which doesn\'t have any Activities/services. I want to integrate Crashlytics SDK to my library. When I try to add it via

3条回答
  •  执念已碎
    2021-02-18 19:08

    Create an android library project with the following gradle:

    apply plugin: 'com.android.library'
    <-- other project specific includes -->
    
    buildscript {
      repositories {
        maven { url 'https://maven.fabric.io/public' }
      }
    
      dependencies {
        classpath 'io.fabric.tools:gradle:1.+'
      }
    }
    
    apply plugin: 'io.fabric'
    
    repositories {
      maven { url 'https://maven.fabric.io/public' }
    }
    
    dependencies {
      compile('com.crashlytics.sdk.android:crashlytics:2.6.5@aar') {
        transitive = true;
      }
    }
    

    To your base project add the maven line to allProjects/repositories:

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

    From your application project add a dependency to the newly created library project. for example:

    compile project(':crashlytics_lib')
    

提交回复
热议问题