Google App 邀请:java.lang.ClassNotFoundException:未找到类"com.google.android.gms.appinvite.AppInviteInvita



我试图使用新的Google邀请api,当我试图发送邀请时,我得到一个异常。我已经添加到我的gradle文件:

compile 'com.google.android.gms:play-services-appinvite:7+'

和我的代码编译良好。不知道怎么了。下面是例外:

Process: mypackage, PID: 17623
    java.lang.NoClassDefFoundError: Failed resolution of: Lcom/google/android/gms/appinvite/AppInviteInvitation$IntentBuilder;
            at mypackage.MyActivity.sendInvitation(MyActivity.java:452)
            at mypackage.MyActivity$35.share(MyActivity.java:2749)
            at mypackage.dialogs.VideoListDialog$VideoListAdapter$ViewHolder.onClick(VideoListDialog.java:236)
            at android.view.View.performClick(View.java:4780)
            at android.view.View$PerformClick.run(View.java:19866)
            at android.os.Handler.handleCallback(Handler.java:739)
            at android.os.Handler.dispatchMessage(Handler.java:95)
            at android.os.Looper.loop(Looper.java:135)
            at android.app.ActivityThread.main(ActivityThread.java:5254)
            at java.lang.reflect.Method.invoke(Native Method)
            at java.lang.reflect.Method.invoke(Method.java:372)
            at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:903)
            at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:698)
     Caused by: java.lang.ClassNotFoundException: Didn't find class "com.google.android.gms.appinvite.AppInviteInvitation$IntentBuilder" on path: DexPathList[[zip file "/data/app/mypackage-2/base.apk"],nativeLibraryDirectories=[/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 mypackage.MyActivity.sendInvitation(MyActivity.java:452)
            at mypackage.MyActivity$35.share(MyActivity.java:2749)
            at mypackage.dialogs.VideoListDialog$VideoListAdapter$ViewHolder.onClick(VideoListDialog.java:236)
            at android.view.View.performClick(View.java:4780)
            at android.view.View$PerformClick.run(View.java:19866)
            at android.os.Handler.handleCallback(Handler.java:739)
            at android.os.Handler.dispatchMessage(Handler.java:95)
            at android.os.Looper.loop(Looper.java:135)
            at android.app.ActivityThread.main(ActivityThread.java:5254)
            at java.lang.reflect.Method.invoke(Native Method)
            at java.lang.reflect.Method.invoke(Method.java:372)
            at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:903)
            at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:698)
    Suppressed: java.lang.ClassNotFoundException: com.google.android.gms.appinvite.AppInviteInvitation$IntentBuilder
            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)
            ... 14 more
     Caused by: java.lang.NoClassDefFoundError: Class not found using the boot class loader; no stack available

看起来我错过了说明中的两个部分:

将依赖项添加到项目的顶层build.gradle:

classpath 'com.google.gms:google-services:1.3.0-beta1'

将插件添加到应用级build.gradle:

apply plugin: 'com.google.gms.google-services'

相关内容

  • 没有找到相关文章

最新更新