我正在尝试按照其官方文档和GitHub 上的最新配置中的所有步骤在我的项目中使用 Google App Invite 。
但是,它在调试和发布版本中都不起作用!它仅Snackbar
在两个版本中显示此消息:
未能启动
它不会在调试模式下留下任何堆栈跟踪,我已经通过使用我的 Google 开发者帐户中的 Alpha 测试安装它来尝试发布版本。这是我在发布版本上的完整项目配置:
安卓清单.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
}
}
...
应用级 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。
有什么解决办法吗?