由于OneSignal,解决依赖关系失败 [英] Failed resolving dependencies due to OneSignal

查看:403
本文介绍了由于OneSignal,解决依赖关系失败的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我发现以下问题:失败解决:com.android.support:customtabs:[26.0.0,26.1.0]
人们将其标记为重复(这是错误的!请参阅下一句)或者写了一些关于Maven或清理项目的内容等等。



我两天的问题完全相同(无法解析customtabs和support-v4),而且我之前没有更改过我的项目。所以我开始寻找可能的解决方案,并发现问题 - 这是OneSignal依赖 - 当我删除它时,一切正常。但是我已经在我的应用程序中实现了通知 - 并且现在不知道该怎么做。我试图编译最新的一个(在OneSignal页面上提到)

  compile'c​​om.onesignal:OneSignal:[3.6.0, 3.99.99)'

但结果是一样的。任何人都可以帮忙吗?

更新:

这个问题可以很容易地转载 - 请创建一个简单的项目添加下面提到的这种依赖关系(它来自官方OneSignal网站 https:// documentation.onesignal.com/v3.0/docs/android-sdk-setup ):

  compile'c​​om .onesignal:OneSignal:[3.6.0,3.99.99]'

更新2:



这些是我的依赖项:

  compile'c​​om.android.support:appcompat -v7:25.3.1'
compile'c​​om.android.support.constraint:constraint-layout:1.0.2'
compile'c​​om.google.firebase:firebase-auth:10.0.1'
编译'com.google.firebase:firebase-database:10.0.1'
编译'com.firebaseui:firebase-ui-database:1.1.0'
compile'c​​om.android.support :design:25.3.1'
compile'c​​om.onesignal:OneSignal:[3.6.0,3.99 .99]'

加入

  maven {
urlhttps://maven.google.com
}

到build.gradle解决了OneSignal的问题,但现在我遇到了Firebase问题:

  java.lang.NoSuchMethodError:没有静态方法zzdD(Ljava / lang / String;)类Lcom / google / android / gms / common / util / zzv中的Z;或其超类('com.google.android.gms.common.util.zzv'


解决方案

发生错误是因为您的依赖项中存在一些冲突的库。 文档,它表示:


自动依赖关系

OneSignal自动添加以下依赖项:


  • com.google.android.gms - 版本11

  • com.android.support - 版本26



请确保您的项目符合这些要求如果您遇到
a版本不匹配的版本错误,则更新版本。



有关更多详细信息,请参阅所有gms / firesbase库必须使用
完全相同的版本规范
部分。


你需要在你的项目中删除或使用相同的依赖项,如下所示:

  compile'c​​om.android.support:appcompat -v7:26.0。+'
compile'c​​om.android.support.constraint:constraint-layout:1.0.2'
compile'c​​om.google.firebase:firebase-auth:11.0。+'
compile'c​​om.google.firebase:firebase-database:11.0。+'
compile'c​​om.firebaseui:firebase-ui-database:1.1.0'
compile'c​​om.android.support :design:26.0。+'
compile'c​​om.onesignal:OneSignal:[3.6.0,3.99.99]'


I found the following question: Failed to resolve: com.android.support:customtabs:[26.0.0,26.1.0] People marked it as duplicate (which is wrong ! see next sentence) or wrote something about Maven or cleaning project etc.

I have exactly the same problem for two days (failed to resolve customtabs and support-v4) and I did not change anything in my project which has been previously working. So I started looking for possible solutions and I found the problem - it is the OneSignal dependency - when I remove it, everything works fine. But I have already implemented notifications in my app - and don't know what to do now. I tried to compile the newest one (mentioned on OneSignal page)

compile 'com.onesignal:OneSignal:[3.6.0,3.99.99)'

But the result is same. Can anyone help?

UPDATE:

The problem can be very easy reproduced - please create a simple project and add this dependency mentioned below (it is from official OneSignal website https://documentation.onesignal.com/v3.0/docs/android-sdk-setup):

 compile 'com.onesignal:OneSignal:[3.6.0, 3.99.99]'

UPDATE 2:

These are my dependencies:

compile 'com.android.support:appcompat-v7:25.3.1'
compile 'com.android.support.constraint:constraint-layout:1.0.2'
compile 'com.google.firebase:firebase-auth:10.0.1'
compile 'com.google.firebase:firebase-database:10.0.1'
compile 'com.firebaseui:firebase-ui-database:1.1.0'
compile 'com.android.support:design:25.3.1'
compile 'com.onesignal:OneSignal:[3.6.0, 3.99.99]'

Adding

maven {
        url "https://maven.google.com"
    }

to the build.gradle solved the problem with OneSignal, but now I have a problem with Firebase:

java.lang.NoSuchMethodError: No static method zzdD(Ljava/lang/String;)Z in class Lcom/google/android/gms/common/util/zzv; or its super classes (declaration of 'com.google.android.gms.common.util.zzv' 

解决方案

The error happens because you have some conflicted library in your dependency.

As in the documentation, it says:

Automatic Dependencies
OneSignal automatically adds the following dependencies;

  • com.google.android.gms - Version 11
  • com.android.support - Version 26

Please makes sure your project matches these versions if you run into a mismatch version error.

For more details see the All gms/firesbase libraries must use the exact same version specification section.

So, you need to remove or use the same dependencies in your project, something like this:

compile 'com.android.support:appcompat-v7:26.0.+'
compile 'com.android.support.constraint:constraint-layout:1.0.2'
compile 'com.google.firebase:firebase-auth:11.0.+'
compile 'com.google.firebase:firebase-database:11.0.+'
compile 'com.firebaseui:firebase-ui-database:1.1.0'
compile 'com.android.support:design:26.0.+'
compile 'com.onesignal:OneSignal:[3.6.0, 3.99.99]'

这篇关于由于OneSignal,解决依赖关系失败的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆