Android Studio的面料 [英] Fabric with Android Studio
本文介绍了Android Studio的面料的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我正在尝试将 Crashlytics 槽式Fabric安装到我的 Android Studio 项目中,但遇到以下错误:
I'm trying to install Crashlytics trough Fabric into my Android Studio Project I'm running into the following error:
Gradle tasks [:App:generateDebugSources, :App:generateDebugAndroidTestSources, :Customer:generateDebugSources, :Customer:generateDebugAndroidTestSources, :PDFViewCtrlTools:generateDebugSources, :PDFViewCtrlTools:generateDebugAndroidTestSources]
Crashlytics was applied to an android-library project.
Android-library support is currently an incubating feature.
Contact support@fabric.io with any issues.
Error:A problem occurred configuring project ':Customer'.
> Could not resolve all dependencies for configuration ':Customer:_debugCompile'.
> Could not find com.crashlytics.sdk.android:crashlytics:2.2.1.
Searched in the following locations:
https://jcenter.bintray.com/com/crashlytics/sdk/android/crashlytics/2.2.1/crashlytics-2.2.1.pom
https://jcenter.bintray.com/com/crashlytics/sdk/android/crashlytics/2.2.1/crashlytics-2.2.1.jar
file:/Users/mes/Documents/Eclipse/sdk/extras/android/m2repository/com/crashlytics/sdk/android/crashlytics/2.2.1/crashlytics-2.2.1.pom
file:/Users/mes/Documents/Eclipse/sdk/extras/android/m2repository/com/crashlytics/sdk/android/crashlytics/2.2.1/crashlytics-2.2.1.jar
file:/Users/mes/Documents/Eclipse/sdk/extras/google/m2repository/com/crashlytics/sdk/android/crashlytics/2.2.1/crashlytics-2.2.1.pom
file:/Users/mes/Documents/Eclipse/sdk/extras/google/m2repository/com/crashlytics/sdk/android/crashlytics/2.2.1/crashlytics-2.2.1.jar
Required by:
project:Customer:unspecified > project:App:unspecified
Information:BUILD FAILED
这是我的版本。 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 {
mavenCentral()
maven { url 'https://maven.fabric.io/public' }
}
dependencies {
compile fileTree(dir: 'libs', include: '*.jar')
compile 'com.google.android.gms:play-services:6.1.71'
compile 'com.android.support:appcompat-v7:21.0.3'
compile project(":PDFViewCtrlTools")
compile('com.crashlytics.sdk.android:crashlytics:2.2.1') {
transitive = true;
}
}
android {
compileSdkVersion 21
buildToolsVersion "21.1.2"
lintOptions {
// If true, stop the gradle build if errors are found
abortOnError false
//ignore 'ValidFragment'
}
}
这是我的 AndroidManifest.xml
<activity
android:name="com.ecrome.tabook.MainActivity"
android:label="@string/app_name"
android:launchMode="singleTop" >
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
<meta-data
android:name="io.fabric.ApiKey"
android:value="xxxxxx" />
</activity>
有什么想法为什么我会出错并且无法编译应用程序?
Any ideas why I'm getting the error and I'm not able to compile the app?
推荐答案
有两个build.gradle
在项目/build.gradle的第一个中添加:
Have two build.gradle In first of the project/build.gradle add:
buildscript {
repositories {
//ADD this Line
maven { url 'https://maven.fabric.io/public' }
}
dependencies {
//ADD this Line
classpath 'io.fabric.tools:gradle:1.22.2'
}
}
在第二个app / build.gradle中
And in second app/build.gradle
buildscript {
repositories {
//ADD this Line
maven { url 'https://maven.fabric.io/public' }
}
dependencies {
//ADD this Line
classpath 'io.fabric.tools:gradle:1.22.2'
}
}
apply plugin: 'io.fabric'
repositories {
maven { url 'https://maven.fabric.io/public' }
}
dependencies {
compile('com.crashlytics.sdk.android:crashlytics:2.6.8@aar'){
transitive = true;
}
}
AndroidManifest
AndroidManifest
<uses-permission android:name="android.permission.INTERNET" />
<application
<meta-data
android:name="io.fabric.ApiKey"
android:value="yourKey" />
<application/>
MainActivity
MainActivity
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
Fabric.with(this, new Crashlytics());
setContentView(R.layout.activity_main);
}
这篇关于Android Studio的面料的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文