gpt4 book ai didi

android - OneSignal 和 Google gms 不兼容

转载 作者:行者123 更新时间:2023-11-30 00:02:36 27 4
gpt4 key购买 nike

我遇到了这个错误,您可以在下面看到。我发现导致错误的原因是我项目中的 gms 版本与 Onesignal 中使用的版本不兼容。

我已经检查了这些帖子中提出的每一个解决方案:

https://github.com/OneSignal/OneSignal-Android-SDK/issues/286

https://stackoverflow.com/questions/43430401/android-nosuchmethoderror-no-static-method-zzyljava-lang-object/43430478#comment86259725_43430478

Couldn't add OneSignal's Gradle plugin as suggested by OneSignal's official site.

删除 应用插件:'com.google.gms.google-services'和 类路径 'com.google.gms:google-services:3.2.0'来自 gradle 文件将解决此错误。但是我不能这样做,因为我想在我的项目中扩充 MapView 并且我需要 google-services。

这是我得到的错误:

java.lang.NoSuchMethodError: No static method zza(Ljava/lang/Object;Ljava/lang/Object;)Ljava/lang/Object; in class Lcom/google/android/gms/common/internal/zzbq; or its super classes (declaration of 'com.google.android.gms.common.internal.zzbq' appears in /data/app/com.blah.blah-1/base.apk:classes2.dex)
at com.google.firebase.provider.FirebaseInitProvider.attachInfo(Unknown Source)
at android.app.ActivityThread.installProvider(ActivityThread.java:6326)
at android.app.ActivityThread.installContentProviders(ActivityThread.java:5918)
at android.app.ActivityThread.handleBindApplication(ActivityThread.java:5857)
at android.app.ActivityThread.-wrap3(ActivityThread.java)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1699)
at android.os.Handler.dispatchMessage(Handler.java:102)
at android.os.Looper.loop(Looper.java:154)
at android.app.ActivityThread.main(ActivityThread.java:6682)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:1520)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1410)

我的build.gradle:

apply plugin: 'com.android.application'
android {
compileSdkVersion 27
buildToolsVersion '27.0.3'
defaultConfig
{
applicationId "com.parsdigit.helsa"
manifestPlaceholders = [onesignal_app_id : "4af7b2c1-a1a8-4b4a-ade3-d65289b38267",
// Project number pulled from dashboard, local value is ignored.
onesignal_google_project_number: "REMOTE"]
minSdkVersion 21
targetSdkVersion 27
versionCode 1
versionName "1.0"
vectorDrawables.useSupportLibrary = true
multiDexEnabled true
}
buildTypes
{
release
{
minifyEnabled true
shrinkResources true
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
debuggable true
}
}
aaptOptions {
cruncherEnabled = false
}

packagingOptions
{
exclude 'META-INF/DEPENDENCIES'
exclude 'META-INF/LICENSE'
exclude 'META-INF/LICENSE.txt'
exclude 'META-INF/license.txt'
exclude 'META-INF/NOTICE'
exclude 'META-INF/NOTICE.txt'
exclude 'META-INF/notice.txt'
exclude 'META-INF/ASL2.0'
}

lintOptions
{
checkReleaseBuilds false
}
dexOptions
{
preDexLibraries = false
jumboMode true
javaMaxHeapSize "4g"
}
}
dependencies
{
implementation 'com.android.support.constraint:constraint-layout:1.0.2'
compile fileTree(include: ['*.jar'], dir: 'libs')
compile 'com.squareup.okhttp3:okhttp:3.+'
compile 'com.android.support:multidex:1.0.2'
compile 'com.android.support:design:27.1.0'
compile 'com.android.support:appcompat-v7:27.1.0'
compile 'com.google.android.gms:play-services-maps:12.0.0'
compile 'com.android.support:recyclerview-v7:27.1.0'
compile 'com.onesignal:OneSignal:[3.8.3, 3.99.99]'
compile 'org.apache.httpcomponents:httpclient:4.5.4'
compile 'com.google.maps.android:android-maps-utils:0.4.3'
compile 'com.google.code.gson:gson:2.8.2'
compile 'uk.co.chrisjenx:calligraphy:2.2.0'
compile 'com.pixplicity.easyprefs:library:1.8.1@aar'
compile 'gun0912.ted:tedpermission:1.0.3'
compile 'com.kennyc:snackbar:2.5'
compile 'me.itangqi.waveloadingview:library:0.3.5'
compile 'com.daimajia.androidanimations:library:2.3@aar'
compile 'com.fujiyuu75:sequent:0.2.1'
compile 'pl.charmas.android:android-reactive-location:0.10@aar'
compile 'io.reactivex:rxjava:1.2.0'
compile 'me.zhanghai.android.materialratingbar:library:1.2.0'
compile 'cn.lightsky.infiniteindicator:library:1.2.2'
compile 'de.hdodenhof:circleimageview:2.2.0'
compile 'com.github.wooplr:Spotlight:1.2.3'
compile 'com.caverock:androidsvg:1.2.1'
compile 'com.github.bumptech.glide:glide:3.8.0'
compile project(':sidemenulibrary')
compile('com.github.ozodrukh:CircularReveal:1.1.1@aar') {
transitive = true;
}
compile 'org.greenrobot:eventbus:3.0.0'
compile 'com.nex3z:notification-badge:0.3.0'
compile 'com.github.Shashank02051997:FancyGifDialog-Android:1.1'
compile 'br.com.simplepass:loading-button-android:1.+'
compile 'com.github.blennerSilva:AwesomeDialog:2.0.5'
compile 'me.relex:circleindicator:1.2.2@aar'
compile 'com.airbnb.android:lottie:2.2.5'
compile 'net.yslibrary.keyboardvisibilityevent:keyboardvisibilityevent:2.1.0'
compile 'com.github.RobertApikyan:SegmentedControl:release_1.0.1'
compile 'com.github.skydoves:powermenu:2.0.1'
compile 'com.otaliastudios:cameraview:1.4.1'
compile 'com.github.Mostafa-MA-Saleh:EditCredit:1.5.0'
compile 'com.github.mreram:ShowCaseView:1.0.5'
compile 'com.mohamadamin:persianmaterialdatetimepicker:1.2.1'
compile 'com.alirezaafkar:sundatepicker:2.0.8'
compile('com.cedarmaps:CedarMapsSDK:2.0.0@aar') {
transitive = true
}
}
afterEvaluate
{
tasks.matching
{
it.name.startsWith('dex')
}
.each
{ dx ->
if (dx.additionalParameters == null) {
dx.additionalParameters = ['--multi-dex']
} else {
dx.additionalParameters += '--multi-dex'
}
}
}

应用插件:'com.google.gms.google-services'

我的顶层build.gradle:

buildscript {
repositories {
jcenter()
google()
}
dependencies {
classpath 'com.android.tools.build:gradle:3.1.0'
classpath 'com.google.gms:google-services:3.2.0'
// NOTE: Do not place your application dependencies here; they belong
// in the individual module build.gradle files
}
}
allprojects {
repositories {
maven { url "http://repo.cedarmaps.com/android/" }
jcenter()
mavenCentral()
maven { url 'https://jitpack.io' }
maven { url 'https://dl.bintray.com/kennyc1012/maven' }
maven { url "http://dl.bintray.com/glomadrian/maven" }
maven { url "https://maven.google.com" }
google()
}
}
task clean(type: Delete) {
delete rootProject.buildDir
}

最佳答案

呸!经过几个小时的努力终于解决了这个问题:

改变 类路径 'com.google.gms:google-services:3.2.0'到 类路径 'com.google.gms:google-services:3.2.1'

和更新 实现 'com.google.android.gms:play-services-maps:12.0.0'到 实现 'com.google.android.gms:play-services-maps:12.0.1'

关于android - OneSignal 和 Google gms 不兼容,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/49645215/

27 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com