CrashlyticsKit を AntやMaven や Gradleと連携させて起動・実行する方法を簡単に説明します。 カスタムセットアップをしたい場合は、以下の各ビルドツールごとの説明を参照してください。
Build ToolsWe have simple instructions to get up and running with the CrashlyticsKit on Ant, Maven and Gradle. If you require a custom setup, see the instructions for your build tool below. |
特定のビルドで Crashlytics をインクルードしたくない場合、この一行を追加します。:
ext.enableCrashlytics = false
Gradle Advanced SetupIf you don’t want to include Crashlytics for a specific build, add this line to a flavor: ext.enableCrashlytics = false |
プロジェクトではなくプロジェクトで使っているライブラリ内にCrashlytics キットを設置したい場合、基本となるプロジェクトをセットアップした後に変更を加えます。
base/build.gradleを以下のように変更してください。
buildscript {
repositories {
maven { url 'https://maven.fabric.io/repo' }
}
dependencies {
classpath 'io.fabric.tools:gradle:1.+'
}
}
apply plugin: 'com.android.application'
apply plugin: 'io.fabric'
以下のコードをlibrary/build.gradleへ移動させてください。
repositories {
maven { url 'https://maven.fabric.io/repo' }
}
dependencies {
compile('com.crashlytics.sdk.android:crashlytics:KIT_VERSION@aar') {
transitive = true;
}
}
注意: Fabric.withをアプリのonCreate()内ではなくライブラリ内で初期化したい場合、Fabric.withをライブラリ内に移動させてください。
Setting up a Library SubprojectIf you want the Crashlytics Kit to be in a library your project is using instead of your project, after setting up your base project, make these additional changes.
buildscript {
repositories {
maven { url 'https://maven.fabric.io/repo' }
}
dependencies {
classpath 'io.fabric.tools:gradle:1.+'
}
}
apply plugin: 'com.android.application'
apply plugin: 'io.fabric'
Then move the following lines to your library/build.gradle
repositories {
maven { url 'https://maven.fabric.io/repo' }
}
dependencies {
compile('com.crashlytics.sdk.android:crashlytics:KIT_VERSION@aar') {
transitive = true;
}
}
Note: If you want Fabric.with initialized in your library instead of your project’s onCreate(), move Fabric.with into the library. |
POM.xmlファイルに以下のlocation情報を追加してセットアップをカスタマイズします:
<property name="crashlytics.project.path" location="PROJECT.ROOT"></property> <property name="crashlytics.manifest.path" location="MANIFEST.PARENT/AndroidManifest.xml"></property> <property name="crashlytics.res.path" location="RES.PARENT/res"></property>
ant のビルド結果がAndroid SDKのビルド結果と大きく異なっている場合は、 crashlytics_build.xmlファイルの上部に記載されたコメントを参照してください。
Ant Advanced SetupCustomize your setup by adding any of these locations to your <property name="crashlytics.project.path" location="PROJECT.ROOT"></property> <property name="crashlytics.manifest.path" location="MANIFEST.PARENT/AndroidManifest.xml"></property> <property name="crashlytics.res.path" location="RES.PARENT/res"></property> Refer to the comments at the top of the |
以下のようにカスタムパスを追加してください:
<plugin>
<groupid>com.crashlytics</groupid>
<artifactid>crashlytics-maven</artifactid>
<version>1.7.0</version>
<configuration>
<androidManifestPath>relative/path/to/
AndroidManifest.xml</androidManifestPath>
<androidAssetsPath>relative/path/to/assets
</androidAssetsPath>
<androidResPath>relative/path/to/assets
</androidResPath>
</configuration>
<executions>
<execution>
<id>GenerateResources</id>
<goals>
<goal>GenerateResources</goal>
</goals>
</execution>
<execution>
<id>CleanupResources</id>
<goals>
<goal>CleanupResources</goal>
</goals>
</execution>
</executions>
</plugin>
MavenAdd custom paths with this snippet:
<plugin>
<groupid>com.crashlytics</groupid>
<artifactid>crashlytics-maven</artifactid>
<version>1.7.0</version>
<configuration>
<androidManifestPath>relative/path/to/
AndroidManifest.xml</androidManifestPath>
<androidAssetsPath>relative/path/to/assets
</androidAssetsPath>
<androidResPath>relative/path/to/assets
</androidResPath>
</configuration>
<executions>
<execution>
<id>GenerateResources</id>
<goals>
<goal>GenerateResources</goal>
</goals>
</execution>
<execution>
<id>CleanupResources</id>
<goals>
<goal>CleanupResources</goal>
</goals>
</execution>
</executions>
</plugin>
|