带有Tealium AdIdentifier插件的Cordova应用在Android设备上启动时崩溃

时间:2019-05-13 12:34:59

标签: android cordova google-play-services

按照https://docs.tealium.com/platforms/cordova/install/https://docs.tealium.com/platforms/cordova/module-adid/的安装说明,我的应用在启动时崩溃。

错误消息是:

com.tealium.adidentifier.AdIdentifier$1.run

java.lang.ClassNotFoundException: Didn't find class 
"com.google.android.gms.ads.identifier.AdvertisingIdClient" on path: 
DexPathList[[zip file "/system/framework/org.apache.http.legacy.boot.jar", zip file 
"/data/app/tv.talpa.vi.nld.test-
2s3C4hjESlp1c4kXXrJEoA==/base.apk"],nativeLibraryDirectories=
[/data/app/tv.talpa.vi.nld.test-2s3C4hjESlp1c4kXXrJEoA==/lib/arm64, /system/lib64, 
/vendor/lib64]]

使用Cordova Android 8.0.0。

有什么想法吗?

1 个答案:

答案 0 :(得分:0)

通过在Gradle构建配置中强制添加Google Play服务来解决此问题:

allprojects {
  repositories {
    jcenter()
    maven { url 'https://maven.google.com' }
  }
}

buildscript {
  repositories {
    mavenCentral()
    jcenter()
  }
}
configurations.all {
  resolutionStrategy.eachDependency { DependencyResolveDetails details ->
  }

  resolutionStrategy {
    force 'com.google.android.gms:play-services-gcm:16.1.0'
  }
}

还用Tealium标记了这一点: https://github.com/Tealium/cordova-plugin/issues/37#issuecomment-508789280