0

I am trying to implement firebase indexing for my android app and when I try to launch an URL, the debugger fails to attach and the log files does not tell me anything directly

I'm trying to follow this tutorial here https://firebase.google.com/docs/app-indexing/android/app

The one thing that I don't have yet is that I'm missing the /.well-known/assetlinks.json on the server. I'm waiting for it to be deployed. But I think it should not really affect how the app starts.

I've added firebase to my Android project

I've copied google-services.json into the app folder

I've added google-services to my project level 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" }
    }
}

I've added com.google.firebase:firebase-appindexing:10.2.1' to my app level gradle file:

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'

I've included a new activity that registers for the event

<!-- 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>

When I try to launch a URL as stated here: https://firebase.google.com/docs/app-indexing/android/test

enter image description here

The debugger fails to attach: enter image description here

There is so much that happens in the log I know I won't be able to attach the entire log but I regex'd for all 'firebase' and can see this:

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

Please note that I'm still missing my '.well-known/assetlinks.json' file on the server yet but I think the issue will still persist when it's deployed.

Any idea how to debug this issue or even what to look for the in logs?

Update 1 Android Debug Bridge testing: I can start testing using the abd tool and according to the google setup manual, this should start the activity:

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

but it does not. I get a :

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 } }

So, I believe that my manifest is not set up correctly.

Update 2 Android Debug Bridge testing:

Ok, I have it working this way. I think the way we pass in the URL makes a big difference. If I take out the 'www.'part and replace it with 'http://', it works. For example:

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

Killesk
  • 2,734
  • 3
  • 22
  • 29

1 Answers1

0

Make sure you put in the correct URL

I was using 'www.boom.de/hello' and ''http://www.boom/de/hello for example

Use:

'http://boom.de/hello'

Killesk
  • 2,734
  • 3
  • 22
  • 29