android中不支持动态链接创建依赖项

时间:2018-02-03 07:18:42

标签: android firebase-dynamic-links

我使用firebase读取附加了动态链接的数据,但它显示编译时错误。我的APP级别gradle如下所示。

apply plugin: 'com.android.application'

android {
    compileSdkVersion 26
    buildToolsVersion "26.0.1"
    defaultConfig {
        applicationId "in.bitstreet.com.itdwallet"
        minSdkVersion 15
        targetSdkVersion 26
        versionCode 1
        versionName "1.0"
        testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"

        // Add the following two lines

        renderscriptTargetApi 18

        renderscriptSupportModeEnabled true
    }


    buildTypes {
        release {
            minifyEnabled false
            proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
        }
    }

    aaptOptions {
        cruncherEnabled = false
    }
}

dependencies {
    compile fileTree(include: ['*.jar'], dir: 'libs')
    androidTestCompile('com.android.support.test.espresso:espresso-core:2.2.2', {
        exclude group: 'com.android.support', module: 'support-annotations'
    })


    compile project(':pinentry')

    compile 'com.android.support:appcompat-v7:26.0.0-alpha1'
    compile 'com.android.support.constraint:constraint-layout:1.0.2'
    compile 'com.android.support:design:24.2.0'
    compile 'com.android.support:support-v4:26.+'
    compile 'com.google.code.gson:gson:2.2.2'

    compile 'com.squareup.retrofit2:retrofit:2.3.0'
    compile 'com.squareup.retrofit2:converter-gson:2.3.0'
    compile 'com.squareup.retrofit2:converter-scalars:2.3.0'

    compile 'org.apache.directory.studio:org.apache.commons.codec:1.8'
    compile 'com.amulyakhare:com.amulyakhare.textdrawable:1.0.1'
    compile 'jp.wasabeef:blurry:2.1.1'

    compile 'com.google.firebase:firebase-core:9.4.0'
    compile 'com.google.firebase:firebase-messaging:9.4.0'
   compile 'com.google.firebase:firebase-invites:9.4.0'


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

    testCompile 'junit:junit:4.12'
}

//for fire base pushnotification
apply plugin: 'com.google.gms.google-services'

以及我在SplashscreenActivity.java中的onCreate()中添加以下代码的代码,显示错误无法解析符号FirebaseDynamicLinks和PendingDynamicLinkData

 FirebaseDynamicLinks.getInstance()
                .getDynamicLink(getIntent())
                .addOnSuccessListener(this, new OnSuccessListener<PendingDynamicLinkData>() {
                    @Override
                    public void onSuccess(PendingDynamicLinkData pendingDynamicLinkData) {
                        // Get deep link from result (may be null if no link is found)
                        Uri deepLink = null;
                        if (pendingDynamicLinkData != null) {
                            deepLink = pendingDynamicLinkData.getLink();
                            String data = deepLink.getQueryParameter("data");
                        }
                    }
                })
                .addOnFailureListener(this, new OnFailureListener() {
                    @Override
                    public void onFailure(@NonNull Exception e) {
                        Log.w(TAG, "getDynamicLink:onFailure", e);
                    }
                });

请指导我。

1 个答案:

答案 0 :(得分:1)

你是一个非常古老的SDK版本!无论您拥有9.4.0(适用于Firebase和Google Play服务),请尝试更新至11.8.0。值得注意的是App Invites已移至Firebase邀请,因此您可以放弃对com.google.android.gms:play-services-appinvite的依赖。

compile 'com.google.firebase:firebase-core:11.8.0'
compile 'com.google.firebase:firebase-messaging:11.8.0'
compile 'com.google.firebase:firebase-invites:11.8.0'
// Delete  compile 'com.google.android.gms:play-services-appinvite:9.4.0'