android - OneSignal 和 Gradle 错误

标签 android android-gradle-plugin onesignal

我不知道我哪里错了,但这让我一直说

All com.android.support libraries must use the same exact version
specification (mixing versions can lead to runtime crashes.) Found
versions 25.3.1, 24.0.0. Examples include com.android.support:animated
vector-drawable:25.3.1 and com.android.support:customtabs-v7:24.0.0

我的build.gradle是

buildscript {
repositories {
    maven { url 'https://maven.fabric.io/public' }

    mavenCentral()
}

dependencies {
    classpath 'io.fabric.tools:gradle:1.22.1'
    classpath 'com.jakewharton.hugo:hugo-plugin:1.2.1'
  }
}
apply plugin: 'com.android.application'
apply plugin: 'io.fabric'
apply plugin: 'com.jakewharton.hugo'

repositories {
    maven { url 'https://maven.fabric.io/public' }
}


android {
  compileSdkVersion 25
  buildToolsVersion '25.0.3'
  defaultConfig {
    applicationId "cosmic.com.fest"
    minSdkVersion 16
    targetSdkVersion 25
    versionCode 1
    versionName "1.0"
    testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
    vectorDrawables.useSupportLibrary = true
}
buildTypes {
    release {
        minifyEnabled false
        proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
    }
}

compileOptions {
    sourceCompatibility JavaVersion.VERSION_1_8
    targetCompatibility JavaVersion.VERSION_1_8
}

flavorDimensions "server"

productFlavors {

    local {
        applicationId "cosmic.com.fest.local"
        dimension 'server'
    }

    dev {
        applicationId "cosmic.com.fest"
        dimension 'server'
    }
  }



defaultConfig {
    manifestPlaceholders = [onesignal_app_id: "something",
    onesignal_google_project_number: "something"]
  }
}

def ANDROID_SUPPORT_VERSION = "25.3.1"

dependencies {
  compile fileTree(dir: 'libs', include: ['*.jar'])
  androidTestCompile('com.android.support.test.espresso:espresso-core:2.2.2', {
    exclude group: 'com.android.support', module: 'support-annotations'
})

compile('com.crashlytics.sdk.android:crashlytics:2.6.8@aar') {
    transitive = true;
}
compile "com.android.support:appcompat-v7:$ANDROID_SUPPORT_VERSION"
compile 'com.android.support.constraint:constraint-layout:1.0.2'
compile 'com.afollestad.material-dialogs:core:0.8.6.1'
compile 'com.orhanobut:logger:1.15'
compile 'com.squareup.retrofit2:retrofit:2.3.0'
compile 'com.squareup.retrofit2:converter-gson:2.0.2'
compile "com.android.support:design:$ANDROID_SUPPORT_VERSION"
compile "com.android.support:support-vector-drawable:$ANDROID_SUPPORT_VERSION"
testCompile 'junit:junit:4.12'
compile 'org.apache.commons:commons-lang3:3.5'
compile "com.android.support:recyclerview-v7:$ANDROID_SUPPORT_VERSION"

compile 'com.google.firebase:firebase-messaging:10.2.6'

compile 'com.onesignal:OneSignal:3.5.6'

// Required for OneSignal, even if you have added FCM.
compile 'com.google.android.gms:play-services-gcm:10.2.6'

// Required for geotagging
compile "com.google.android.gms:play-services-location:10.2.6"

// play-services-analytics is only needed when using 8.1.0 or older.
compile 'com.google.android.gms:play-services-analytics:10.2.6'
}

我需要使用 Firebase 添加 OneSignal 通知才能获取 token 。

当我尝试this时解决方案,我的 appcompat 仍然会提示同样的问题。

最佳答案

解决了。

实际上,我将 ANDROID_SUPPORT_VERSION 更改为 24.0.0,这更改了所有库版本。一旦我这样做了,

compile 'com.android.support:appcompat-v7:24.0.0'

问题已解决。

关于android - OneSignal 和 Gradle 错误,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/44353283/

相关文章:

android - 如何从日历中获取与会者的电子邮件或姓名

android - v2 API 中的 Linkedin 登录个人资料图片 URL

android - 如何从谷歌地图获取经纬度触摸事件?

Java Android - iText - 使用 cellEvent writeSelectedRows

react-native - 找不到 lint-gradle-api.jar (com.android.tools.lint :lint-gradle-api:26. 1.2)

node.js - 有谁知道如何将curl命令转换为node.js以用于firebase云功能

android - 使用 Gradle 构建库 jar

android - 如何从属性文件中读取密码并使用它 build.gradle 文件?

node.js - 使用 OneSignal 向多个用户发送推送通知

php - 如何使用 One Signal + PHP + Server API 发送推送通知?