GVKun编程网logo

Java-Google AppInvite

10

在这篇文章中,我们将带领您了解Java-GoogleAppInvite的全貌,同时,我们还将为您介绍有关android–Appinvite_styles.xml:5:错误包括GooglePlaySer

在这篇文章中,我们将带领您了解Java-Google AppInvite的全貌,同时,我们还将为您介绍有关android – Appinvite_styles.xml:5:错误包括Google Play Services库到eclipse时、android – Google App Invite – 无法启动、android – Google AppInvites打破构建、android – Google AppInvite:发送短信时不发送电子邮件的知识,以帮助您更好地理解这个主题。

本文目录一览:

Java-Google AppInvite

Java-Google AppInvite

通过Google手册实现Google AppInvite-link.

启动邀请活动,然后在LogCat中获取下一个:

E/AppInviteAgent: Get suggested invitees Failed due to error code: 3
            No Android client ID is found for package name <MY_PACKAGE_NAME>. (APPINVITE_CLIENT_ID_ERROR)

E/AppInviteAgent: Create invitations Failed due to error code: 3
            No Android client ID is found for package name <MY_PACKAGE_NAME>. (APPINVITE_CLIENT_ID_ERROR)

然后,在onActivityResult方法中添加一个Log.d并获取LogCat:

onActivityResult: requestCode=0, resultCode=3

有人可以帮我吗?我尝试将其修复约2周.

UPD0

// my `build.gradle` file (project level)
  dependencies {
    classpath 'com.android.tools.build:gradle:2.0.0-beta6'
    classpath 'com.google.gms:google-services:2.0.0-beta6'

    // NOTE: Do not place your application dependencies here; they belong
    // in the individual module build.gradle files
  }
// my `build.gradle` file (app level)

compileSdkVersion 23
buildToolsversion '23.0.2'
// ... some code
dependencies {
     compile filetree(include: ['*.jar'], dir: 'libs')
     testCompile 'junit:junit:4.12'
     compile 'com.android.support:appcompat-v7:23.2.0'
     compile 'com.android.support:design:23.2.0'
     compile 'com.google.android.gms:play-services-ads:8.4.0'
     compile 'com.google.android.gms:play-services-appinvite:8.4.0'
     // for in-app-billing v3
     compile 'com.anjlab.android.iab.v3:library:1.0.31'
}
// and in the end of the file
// for Google Invite
apply plugin: 'com.google.gms.google-services'

// my methods in the MainActivity
private void onInviteClicked() {
        Intent intent = new AppInviteInvitation.IntentBuilder(
                getString(R.string.txt_invitation_title))
                .setMessage(getString(R.string.txt_invitation_message))
                .setCallToActionText(getString(R.string.txt_invitation_cta))
                .build();
        startActivityForResult(intent, REQUEST_INVITE);
}
// where REQUEST_INVITE - private static final int and equal 0;

// and onActivityResult - copy from `Google` manual
@Override
protected void onActivityResult(int requestCode, int resultCode, Intent data) {
    super.onActivityResult(requestCode, resultCode, data);
    new MyLogs("onActivityResult: requestCode=" + requestCode + ", resultCode=" + resultCode);

    if (requestCode == REQUEST_INVITE) {
        if (resultCode == RESULT_OK) {
            // Check how many invitations were sent and log a message
            // The ids array contains the unique invitation ids for each invitation sent
            // (one for each contact select by the user). You can use these for analytics
            // as the ID will be consistent on the sending and receiving devices.
            String[] ids = AppInviteInvitation.getInvitationIds(resultCode, data);
            new MyLogs(getString(R.string.sent_invitations_fmt, ids.length));
        } else {
            // Sending Failed or it was canceled, show failure message to the user
            new MyLogs("send_Failed");
        }
    }
}

解决方法:

您是否包含json配置文件?

android – Appinvite_styles.xml:5:错误包括Google Play Services库到eclipse时

android – Appinvite_styles.xml:5:错误包括Google Play Services库到eclipse时

我需要在我的应用中添加广告.所以我需要在我的项目中加入Google Play服务库.我已经安装了最新版本的Google Play服务(r29)并作为libProject添加到我的项目中.但是,当我添加此服务lib时,我收到以下错误:

workspace\Google_Play_Services_Lib\res\values-v21\appinvite_styles.xml:5: error: Error retrieving parent for item: No resource found that matches the given name '@android:style/Theme.Material.Light.DialogWhenLarge.NoActionBar'.

我怎么解决这个问题 ?感谢帮助..

最佳答案
刚刚将Project SDK更改为20(从21开始)并全部编译完成.

android – Google App Invite – 无法启动

android – Google App Invite – 无法启动

我正在尝试在我的项目中使用Google App Invite,遵循其官方 documentation和 GitHub的最新配置中的所有步骤.

但是,它在调试和发布版本中都不起作用!它只在两个版本中显示此Snackbar消息:

Failed to start

它不会在调试模式下留下任何堆栈跟踪,我已经尝试使用我的Google Developer帐户中的Alpha Testing安装发行版.这是我在发布版本上的完整项目配置:

Android Manifest.xml

<manifest xmlns:android="http://schemas.android.com/apk/res/android"
    package="com.package.name">

    <application
        ... >
        <Meta-data
            android:name="com.google.android.gms.version"
            android:value="@integer/google_play_services_version" />
    </application>
    ...
</manifest>

项目级build.gradle

// Top-level build file where you can add configuration options common to all sub-projects/modules.

buildscript {
    repositories {
        jcenter()
    }
    dependencies {
        classpath ''com.android.tools.build:gradle:2.0.0-beta6''
        classpath ''com.google.gms:google-services:2.0.0-beta6''
        // I''ve tried classpath ''com.google.gms:google-services:2.0.0-alpha5'' too

        // NOTE: Do not place your application dependencies here; they belong
        // in the individual module build.gradle files
    }
}
...

App-Level build.gradle

apply plugin: ''com.android.application''

android {
    compileSdkVersion 23
    buildToolsversion "23.0.2"

    defaultConfig {
        applicationId "com.package.name"
        minSdkVersion 14
        targetSdkVersion 23
        versionCode 1
        versionName "1.0"
    }
    ...
}
...
dependencies {
    ...
    compile ''com.google.android.gms:play-services-appinvite:8.4.0''
}

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

Intent inviteIntent = new AppInviteInvitation.IntentBuilder(getString(R.string.invitation_title))
    .setMessage(getString(R.string.invitation_message))
    .setDeepLink(Uri.parse(getString(R.string.invitation_deep_link)))
    .setCustomImage(Uri.parse(getString(R.string.invitation_custom_image)))
    .setCallToActionText(getString(R.string.invitation_cta))
    .build();
startActivity(inviteIntent);

我还将Google Developers Console中的配置文件添加到我项目的app /目录中,其中包括软件包名称和发布密钥中的SHA-1.

有解决方案吗

解决方法

我终于找到了答案.实际上,使用startActivityForResult(intent,requestCode);是必需的,而不仅仅是startActivity(intent);让它工作.我无法理解为什么它是强制性的,因为一些开发人员(比如我自己)不需要回调动作IMO.

android – Google AppInvites打破构建

android – Google AppInvites打破构建

这是我们应用程序的build.gradle的一部分:
tasks.withType(com.android.build.gradle.tasks.PackageApplication) { pkgTask ->
    pkgTask.jniFolders = new HashSet<File>()
    pkgTask.jniFolders.add(new File(projectDir,'libs'))
}

由于某些原因设置AppInvites,构建开始失败并出现以下错误:

* What went wrong:
A problem occurred configuring project ':app'.
> Cannot set the value of read-only property 'jniFolders' on task ':app:packageProdDebug'.

解决方法

当我尝试使用即时运行时,同样的错误.

通过添加它来修复:

android {
  sourcesets {
    main {
      jniLibs.srcDir new File(buildDir,'lib')
    {
  }
}

参考:https://groups.google.com/forum/#!topic/adt-dev/OqDyZ5VN-QM

android – Google AppInvite:发送短信时不发送电子邮件

android – Google AppInvite:发送短信时不发送电子邮件

我正在使用谷歌库

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

我的appinvite库版本是

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

使用appinvites时,我可以使用短信和电子邮件轻松发送邀请.但是在接收端只接收短信,我无法发送电子邮件.

它是库中的错误还是我错过了其他的东西?

编辑:我的代码中的其他所有内容都遵循谷歌的appinvite guidelines.

解决方法

我尝试了App发明演示应用程序 here,并按照步骤操作.

我可以发送电子邮件,也可以收到.

您可以尝试将源代码here与您的源代码进行比较.

也许你忘了在开始时连接Googleapiclient.请注意,在顶部build.gradle中,它包含:

classpath ''com.android.tools.build:gradle:1.3.0''
classpath ''com.google.gms:google-services:1.3.0-beta1''

我们今天的关于Java-Google AppInvite的分享就到这里,谢谢您的阅读,如果想了解更多关于android – Appinvite_styles.xml:5:错误包括Google Play Services库到eclipse时、android – Google App Invite – 无法启动、android – Google AppInvites打破构建、android – Google AppInvite:发送短信时不发送电子邮件的相关信息,可以在本站进行搜索。

本文标签: