我正在尝试为我的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'到我的app level 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>
当我尝试启动此处所述的网址时: https://firebase.google.com/docs/app-indexing/android/test
在日志中发生了很多事情我知道我无法附加整个日志,但我正在使用所有&#39; firebase&#39;并且可以看到:
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
请注意,我仍然错过了我的&。39.。-known / assetlinks.json&#39;文件在服务器上但我认为问题在部署时仍然存在。
知道如何调试此问题,甚至想要查找日志中的内容吗?
更新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的方式有很大的不同。如果我取出了&#39;&#39;部分并将其替换为&#39; http://&#39;,则可行。例如:
adb shell am start -a android.intent.action.VIEW -d&#34; http://boom.de/schuhe/&#34; boom.android
答案 0 :(得分:0)