我想在官方文档上使用firebase crashlytics sdk,但我的gradle同步失败了:
错误:Android依赖项 'com.crashlytics.sdk.android:crashlytics-core:2.4.1'设置为 不支持compileOnly /提供
我该怎么做才能解决这个问题...?
应用级别:
apply plugin: 'com.android.application'
apply plugin: 'io.fabric'
android {
compileSdkVersion 28
buildToolsVersion '28.0.3'
buildTypes {
release {
minifyEnabled true
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
compileOptions {
sourceCompatibility JavaVersion.VERSION_1_8
targetCompatibility JavaVersion.VERSION_1_8
}
}
dependencies {
implementation 'com.google.firebase:firebase-analytics:17.2.0'
// Add dependency
implementation 'com.crashlytics.sdk.android:crashlytics:2.10.1'
}
apply plugin: 'com.google.gms.google-services'
项目级别:
// Top-level build file where you can add configuration options common to all sub-projects/modules.
buildscript {
repositories {
jcenter()
maven {
url 'https://maven.fabric.io/public'
}
google()
}
dependencies {
classpath 'com.android.tools.build:gradle:3.4.2'
classpath 'org.greenrobot:greendao-gradle-plugin:3.2.2'
classpath 'com.google.gms:google-services:4.3.2'
classpath 'io.fabric.tools:gradle:1.31.0' // Crashlytics plugin
}
}
allprojects {
repositories {
jcenter()
maven { url "https://jitpack.io" }
maven {
url 'https://maven.google.com/'
}
maven {
url 'https://maven.fabric.io/public'
}
google()
}
}
task clean(type: Delete) {
delete rootProject.buildDir
}
答案 0 :(得分:1)
{@push('scripts')
<script>
$('#department').change(function(){
var departmentID = $(this).val();
if(departmentID) {
$.ajax({
type:"GET",
url:"{{url('get-section-list-position')}}?department_id="+departmentID,
success:function(res){
if(res) {
$("#section").empty();
$("#section").append('<option>Please Select Section</option>');
$.each(res,function(key, value){
$("#section").append('<option value="'+key+'">'+value+'</option>');
});
} else {
$("#section").empty();
}
}
});
} else {
$("#section").empty();
}
});
</script>
@endpush
是的替代品-不推荐使用的等效配置为compileOnly
。参见https://generatewp.com/wp_tax_query/。
答案 1 :(得分:1)
在您的项目级build.gradle中,将您的google-services更新到版本3.1.2或更高版本,然后添加Crashlytics存储库和依赖项:
buildscript {
repositories {
// Add the following repositories:
google() // Google's Maven repository
maven {
url 'https://maven.fabric.io/public'
}
}
dependencies {
// ...
// Check for v3.1.2 or higher
classpath 'com.google.gms:google-services:4.3.2' // Google Services plugin
// Add dependency
classpath 'io.fabric.tools:gradle:1.31.0' // Crashlytics plugin
}
}
allprojects {
// ...
repositories {
// Check that you have the following line (if not, add it):
google() // Google's Maven repository
// ...
}
}
在应用程序级别的build.gradle中,添加Crashlytics依赖项:
apply plugin: 'com.android.application'
apply plugin: 'io.fabric'
dependencies {
// ...
// (Recommended) Add Analytics
implementation 'com.google.firebase:firebase-analytics:17.2.0'
// Add dependency
implementation 'com.crashlytics.sdk.android:crashlytics:2.10.1'
}