0

我正在尝试为我的 android 应用程序实现 firebase 索引,当我尝试启动 URL 时,调试器无法附加,并且日志文件没有直接告诉我任何内容

我正在尝试在此处遵循本教程 https://firebase.google.com/docs/app-indexing/android/app

我还没有的一件事是我缺少服务器上的 /.well-known/assetlinks.json 。我正在等待它被部署。但我认为它不应该真正影响应用程序的启动方式。

我已将 firebase 添加到我的 Android 项目中

我已将 google-services.json 复制到 app 文件夹中

我已将 google-services 添加到我的项目级别 build.gradle

buildscript {
    repositories {
        maven { url "http://dl.bintray.com/populov/maven" }
        mavenCentral()
        jcenter()
    }
    dependencies {
        classpath 'com.android.tools.build:gradle:2.3.1'
        classpath 'com.google.gms:google-services:3.0.0'
    }
}


allprojects {
    repositories {
        maven { url "http://dl.bintray.com/populov/maven" }
        mavenCentral()
        maven { url "http://appboy.github.io/appboy-android-sdk/sdk" }
    }
}

我已将 com.google.firebase:firebase-appindexing:10.2.1' 添加到我的应用级 gradle 文件中:

apply plugin: 'com.android.application'


android {
    compileSdkVersion 25
    buildToolsVersion '25.0.2'

    defaultConfig {
        applicationId "boom"
        minSdkVersion 23
        targetSdkVersion 25
        testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
        versionCode 93
        versionName "5.0.1"//MUST NOT EXCEED 10 CHARS.
        multiDexEnabled true
    }
    dexOptions {
        javaMaxHeapSize "4g"
    }
    buildTypes {
        release {
            minifyEnabled false
            proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.txt'
            buildConfigField "boolean", "TEST_PROJECT", "false"
        }
        debug {
            minifyEnabled false
            proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.txt'
            buildConfigField "boolean", "TEST_PROJECT", "true"
            multiDexEnabled true
        }
    }
    android {
        lintOptions {
            checkReleaseBuilds false
            // Or, if you prefer, you can continue to check for errors in release builds,
            // but continue the build even when errors are found:
            abortOnError false
        }
    }
    productFlavors {
        prod {

        }
        mock {
            applicationId "boom"
        }
    }
}

dependencies {

    // Android JUnit Runner


    compile 'com.android.support:design:25.1.1'
    compile 'com.android.support.test:runner:0.5'
    compile 'com.android.support:design:25.1.1'
    compile 'com.android.support.test:runner:0.5'
    compile 'com.appboy:android-sdk-ui:1.15.+'
    compile 'com.google.code.gson:gson:2.4'
    compile 'com.facebook.android:facebook-android-sdk:4.22.0'
    compile 'com.google.android.gms:play-services:10.2.1'
    compile 'com.squareup.okhttp:okhttp:2.1.0'
    compile 'com.squareup.okio:okio:1.0.1'
    compile 'com.squareup.picasso:picasso:2.5.2'
    compile 'com.viewpagerindicator:library:2.4.1'
    compile 'com.github.chrisbanes.photoview:library:1.2.2'
    compile 'com.android.support.test:rules:0.5'
    compile 'com.facebook.stetho:stetho:1.3.1'
    compile 'com.facebook.stetho:stetho-okhttp:1.2.0'
    compile 'com.android.support:multidex:1.0.1'
    compile 'com.android.support:recyclerview-v7:25.1.1'
    compile 'com.android.support:appcompat-v7:25.1.1'
    compile 'com.android.support:preference-v7:25.1.1'
    compile 'com.android.support:support-annotations:25.1.1'
    compile 'com.android.support:support-v4:25.1.1'
    compile 'com.android.support:cardview-v7:25.1.1'
    compile 'com.google.firebase:firebase-appindexing:10.2.1'

//    Testing
    compile 'com.google.android.apps.common.testing.accessibility.framework:accessibility-test-framework:2.1'
    compile 'com.android.support.test.espresso:espresso-core:2.2.2'
    compile 'com.android.support.test.espresso:espresso-intents:2.2'
    compile 'com.android.support.test.espresso:espresso-contrib:2.2.2'
    testCompile 'com.android.support:support-annotations:25.1.1'
    testCompile 'com.android.support:design:25.1.1'
    testCompile 'org.mockito:mockito-core:2.4.0'
    testCompile 'org.powermock:powermock-api-mockito:1.7.0RC2'
    testCompile 'org.powermock:powermock-module-junit4-rule-agent:1.6.1'
    testCompile 'org.powermock:powermock-module-junit4-rule:1.6.1'
    testCompile 'org.powermock:powermock-module-junit4:1.6.1'
    testCompile 'org.robolectric:robolectric:3.3.1'
    testCompile 'org.robolectric:shadows-multidex:3.3.1'
    testCompile 'org.robolectric:shadows-support-v4:3.3.1'
    testCompile 'junit:junit:4.12'
}    

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

我已经包含了一个注册该事件的新活动

<!-- Firebase Indexing -->
<activity
    android:name=".new_app.firebaseindexing.FirebaseIndexingActivity"
    android:label="@string/app_name"
    android:exported="true"
    android:launchMode="singleTop"
    android:theme="@style/Theme.AppCompat.Light">
    <intent-filter android:label="@string/app_name" android:autoVerify="true">
        <action android:name="android.intent.action.VIEW" />
        <category android:name="android.intent.category.DEFAULT" />
        <category android:name="android.intent.category.BROWSABLE" />
        <!-- Accepts URIs that begin with "http://recipe-app.com/*" -->
        <data android:scheme="http"
            android:host="boom.de"
            android:pathPrefix="/schuhe" />
        <!-- Accepts URIs that begin with "https://recipe-app.com/*" -->
        <data android:scheme="https"
            android:host="boom.de"
            android:pathPrefix="/schuhe" />
    </intent-filter>
</activity>

当我尝试按照此处所述启动 URL 时: https ://firebase.google.com/docs/app-indexing/android/test

在此处输入图像描述

调试器无法附加: 在此处输入图像描述

日志中发生了很多事情,我知道我将无法附加整个日志,但我对所有“firebase”进行了正则表达式,并且可以看到:

05-03 11:01:25.102 31421-31421/? D/FirebaseApp: com.google.firebase.auth.FirebaseAuth is not linked. Skipping initialization.
05-03 11:01:25.112 31421-31421/? D/FirebaseApp: com.google.firebase.crash.FirebaseCrash is not linked. Skipping initialization.
05-03 11:01:25.144 31421-31421/? I/FA: To enable faster debug mode event logging run:
                                         adb shell setprop firebase.analytics.debug-mode com.samsung.android.samsungpass
05-03 11:01:25.160 31421-31421/? I/FirebaseInitProvider: FirebaseApp initialization successful
05-03 11:01:25.603 31488-31488/? D/FirebaseApp: com.google.firebase.auth.FirebaseAuth is not linked. Skipping initialization.
05-03 11:01:25.611 31488-31488/? D/FirebaseApp: com.google.firebase.crash.FirebaseCrash is not linked. Skipping initialization.
05-03 11:01:25.640 31488-31488/? I/FA: To enable faster debug mode event logging run:
                                         adb shell setprop debug.firebase.analytics.app tv.peel.app
05-03 11:01:25.648 31488-31488/? I/FirebaseInitProvider: FirebaseApp initialization successful
05-03 11:01:31.731 31832-31832/? I/FirebaseInitProvider: FirebaseApp initialization unsuccessful
05-03 11:01:36.395 32186-32186/? D/FirebaseApp: com.google.firebase.auth.FirebaseAuth is not linked. Skipping initialization.
05-03 11:01:36.799 32186-32186/? I/FirebaseCrashApiImpl: FirebaseCrashApiImpl created by ClassLoader p[DexPathList[[zip file "/data/data/com.google.android.gms/app_chimera/m/00000016/DynamiteModulesC_GmsCore_prodmnc_alldpi_release.apk"],nativeLibraryDirectories=[/data/user/0/com.google.android.gms/app_chimera/m/00000016/n/armeabi-v7a, /data/user/0/com.google.android.gms/app_chimera/m/00000016/n/armeabi, /system/lib, /vendor/lib]]]
05-03 11:01:36.905 32186-32186/? I/FA: To enable faster debug mode event logging run:
                                         adb shell setprop debug.firebase.analytics.app com.rsupport.mvagent
05-03 11:01:36.922 32186-32186/? I/FirebaseCrash: FirebaseCrash reporting initialized com.google.android.gms.internal.zzbks@8741b74
05-03 11:01:36.922 32186-32186/? I/FirebaseInitProvider: FirebaseApp initialization successful
05-03 11:01:38.877 32501-32501/? I/FirebaseInitProvider: FirebaseApp initialization unsuccessful
05-03 11:01:39.544 32571-32571/? D/FirebaseApp: com.google.firebase.auth.FirebaseAuth is not linked. Skipping initialization.
05-03 11:01:39.552 32571-32571/? D/FirebaseApp: com.google.firebase.crash.FirebaseCrash is not linked. Skipping initialization.
05-03 11:01:39.586 32571-32571/? I/FA: To enable faster debug mode event logging run:
                                         adb shell setprop debug.firebase.analytics.app com.phonepe.app
05-03 11:01:39.608 32571-32571/? I/FirebaseInitProvider: FirebaseApp initialization successful
05-03 11:01:40.736 3664-13927/? I/ActivityManager: Start proc 32751:com.samsung.android.samsungpass/u0a137 for broadcast com.samsung.android.samsungpass/com.google.firebase.iid.FirebaseInstanceIdInternalReceiver
05-03 11:01:40.825 32751-32751/? D/FirebaseApp: com.google.firebase.auth.FirebaseAuth is not linked. Skipping initialization.
05-03 11:01:40.841 32751-32751/? D/FirebaseApp: com.google.firebase.crash.FirebaseCrash is not linked. Skipping initialization.
05-03 11:01:40.886 32751-32751/? I/FA: To enable faster debug mode event logging run:
                                         adb shell setprop firebase.analytics.debug-mode com.samsung.android.samsungpass
05-03 11:01:40.907 32751-32751/? I/FirebaseInitProvider: FirebaseApp initialization successful
05-03 11:01:41.016 32751-309/? D/FirebaseInstanceId: topic sync succeeded
05-03 11:01:42.803 32751-459/? D/FirebaseInstanceId: topic sync succeeded

请注意,我仍然缺少服务器上的“.well-known/assetlinks.json”文件,但我认为问题在部署后仍然存在。

知道如何调试这个问题,甚至是在日志中寻找什么吗?

更新 1 Android Debug Bridge 测试:我可以使用 abd 工具开始测试,根据谷歌设置手册,这应该启动活动:

adb shell am start -a android.intent.action.VIEW -d "www.boom.de/schuhe/" boom.android

但事实并非如此。我得到一个:

Starting: Intent { act=android.intent.action.VIEW dat=http://www.boom.de/... pkg=boom launchParam=MultiScreenLaunchParams { mDisplayId=0 mFlags=0 } }
Error: Activity not started, unable to resolve Intent { act=android.intent.action.VIEW dat=http://www.boom.de/... flg=0x10000000 pkg=boomi launchParam=MultiScreenLaunchParams { mDisplayId=0 mFlags=0 } }

所以,我相信我的清单设置不正确。

更新 2 Android Debug Bridge 测试:

好的,我有它以这种方式工作。我认为我们传递 URL 的方式有很大的不同。如果我取出“www.”部分并用“http://”替换它,它就可以工作。例如:

adb shell am start -a android.intent.action.VIEW -d " http://boom.de/schuhe/ " boom.android

4

1 回答 1

0

确保输入正确的 URL

例如,我使用的是 'www.boom.de/hello' 和 '' http://www.boom/de/hello

利用:

' http://boom.de/hello '

于 2017-05-03T15:29:28.650 回答