gpt4 book ai didi

android - com.google.tagmanager.InstallReferrerReceiver 上的 ClassNotFoundException

转载 作者:行者123 更新时间:2023-12-04 13:42:37 29 4
gpt4 key购买 nike

我尝试将 Google Tag Manger 推荐人跟踪器添加到我的应用程序中。我使用此文档:https://developers.google.com/tag-manager/android/v4/ua

并添加到我的 list 下面的代码:

<service android:name="com.google.tagmanager.InstallReferrerService" />
<receiver android:name="com.google.tagmanager.InstallReferrerReceiver" android:exported="true">
<intent-filter>
<action android:name="com.android.vending.INSTALL_REFERRER" />
</intent-filter>
</receiver>

现在使用文档进行测试和验证:https://developers.google.com/analytics/solutions/testing-play-campaigns

我通过 adb 发送

echo 'am broadcast \
-a com.android.vending.INSTALL_REFERRER \
-n "pl.my.app/com.google.tagmanager.InstallReferrerReceiver" \
--es "referrer" \
"utm_source=test_source&utm_medium=test_medium&utm_term=test_term&utm_content=test_content&utm_campaign=test_name"; \
exit' | ./adb shell

我的应用程序崩溃了:

java.lang.RuntimeException: Unable to instantiate receiver com.google.tagmanager.InstallReferrerReceiver: java.lang.ClassNotFoundException: Didn't find class "com.google.tagmanager.InstallReferrerReceiver" on path: DexPathList[[zip file "/data/app/pl.my.app-2/base.apk"],nativeLibraryDirectories=[/data/app/pl.my.app-2/lib/arm, /vendor/lib, /system/lib]] at android.app.ActivityThread.handleReceiver(ActivityThread.java:2724) at android.app.ActivityThread.-wrap14(ActivityThread.java) at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1431) at android.os.Handler.dispatchMessage(Handler.java:102) at android.os.Looper.loop(Looper.java:148) at android.app.ActivityThread.main(ActivityThread.java:5443) at java.lang.reflect.Method.invoke(Native Method) at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:728) at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:618) Caused by: java.lang.ClassNotFoundException: Didn't find class "com.google.tagmanager.InstallReferrerReceiver" on path: DexPathList[[zip file "/data/app/pl.my.app-2/base.apk"],nativeLibraryDirectories=[/data/app/pl.my.app-2/lib/arm, /vendor/lib, /system/lib]] at dalvik.system.BaseDexClassLoader.findClass(BaseDexClassLoader.java:56) at java.lang.ClassLoader.loadClass(ClassLoader.java:511) at java.lang.ClassLoader.loadClass(ClassLoader.java:469) at android.app.ActivityThread.handleReceiver(ActivityThread.java:2719) at android.app.ActivityThread.-wrap14(ActivityThread.java)  at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1431)  at android.os.Handler.dispatchMessage(Handler.java:102)  at android.os.Looper.loop(Looper.java:148)  at android.app.ActivityThread.main(ActivityThread.java:5443)  at java.lang.reflect.Method.invoke(Native Method)  at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:728)  at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:618)  Suppressed: java.lang.ClassNotFoundException: com.google.tagmanager.InstallReferrerReceiver at java.lang.Class.classForName(Native Method) at java.lang.BootClassLoader.findClass(ClassLoader.java:781) at java.lang.BootClassLoader.loadClass(ClassLoader.java:841) at java.lang.ClassLoader.loadClass(ClassLoader.java:504) ... 10 more Caused by: java.lang.NoClassDefFoundError: Class not found using the boot class loader; no stack trace available

知道发生了什么吗?

我想我应该在 gladle 中添加一些东西。我认为

compile 'com.google.android.gms:play-services-tagmanager:9.4.0'

还不够。

最佳答案

TagManager 是 play-services-analytics 中的内容

将此添加到您的 build.gradle

compile 'com.google.android.gms:play-services-analytics:9.4.0'

正如谷歌文档中提到的,您的 Manifest 应该包含以下内容:

<!-- Used for install referrer tracking-->
<service android:name="com.google.android.gms.tagmanager.InstallReferrerService" />
<receiver
android:name="com.google.android.gms.tagmanager.InstallReferrerReceiver"
android:exported="true">
<intent-filter>
<action android:name="com.android.vending.INSTALL_REFERRER" />
</intent-filter>
</receiver>

您的包名称似乎有误:com.google.tagmanager.InstallReferrerService

关于android - com.google.tagmanager.InstallReferrerReceiver 上的 ClassNotFoundException,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/39041983/

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