【问题标题】:Firebase dependencies, firebase-crash:10.0.1'Firebase 依赖项,firebase-crash:10.0.1'
【发布时间】:2017-01-11 10:25:18
【问题描述】:

如果有人对此有任何解释,请帮助我理解。

问题是:

如果我在依赖项中使用它,

compile 'com.google.firebase:firebase-crash:10.0.1'  

那么下面的代码在布局中是不可见的。

  <android.support.v4.view.PagerTabStrip
                android:id="@+id/pager_header"
                android:layout_width="match_parent"
                android:layout_height="wrap_content"
                android:layout_gravity="top"
                android:background="@color/colorAccent"
                android:paddingBottom="@dimen/_7dp"
                android:paddingTop="@dimen/_7dp"
                android:textAppearance="@style/MyCustomTabTextAppearance"
                android:textColor="@color/colorWhite" />

但是如果我像这样降级 firebase,

 compile 'com.google.firebase:firebase-crash:9.4.0'

那么下面的代码就可见了。

<android.support.v4.view.PagerTabStrip
                    android:id="@+id/pager_header"
                    android:layout_width="match_parent"
                    android:layout_height="wrap_content"
                    android:layout_gravity="top"
                    android:background="@color/colorAccent"
                    android:paddingBottom="@dimen/_7dp"
                    android:paddingTop="@dimen/_7dp"
                    android:textAppearance="@style/MyCustomTabTextAppearance"
                    android:textColor="@color/colorWhite" />

这是我的应用程序依赖项。

   dependencies {
        compile fileTree(include: ['*.jar'], dir: 'libs')
        testCompile 'junit:junit:4.12'
        compile 'com.android.support:appcompat-v7:23.3.0'
        compile 'com.android.support:design:23.3.0'
        compile 'com.android.support:recyclerview-v7:23.3.0'
        compile 'com.android.support:cardview-v7:23.3.0'
        compile 'com.squareup.okhttp3:okhttp:3.2.0'
        compile 'com.nineoldandroids:library:2.4.0'
        compile 'com.android.support:palette-v7:23.3.0'
        compile 'io.github.kexanie.library:MathView:0.0.6'
        compile 'jp.wasabeef:blurry:2.0.2'
        compile 'com.mcxiaoke.volley:library-aar:1.0.0'
        compile('com.crashlytics.sdk.android:crashlytics:2.5.7@aar') {
            transitive = true;
        }
        compile 'com.google.firebase:firebase-crash:10.0.1'
    }
    apply plugin: 'com.google.gms.google-services'

这是我项目的依赖项。

// 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.2.2'
        classpath 'com.jfrog.bintray.gradle:gradle-bintray-plugin:1.3.1'
        classpath 'com.github.dcendents:android-maven-gradle-plugin:1.3'
        classpath 'com.google.gms:google-services:3.0.0'
        classpath 'com.google.firebase:firebase-plugins:1.0.4'
    }
}

allprojects {
    repositories {
        jcenter()
    }
}

task clean(type: Delete) {
    delete rootProject.buildDir
}

【问题讨论】:

  • @Shekar 请发布您的 gradle 依赖项
  • 我粘贴了依赖项。
  • Sagar-Gangawane,我找到了解决方案。请检查一下。

标签: android firebase firebase-crash-reporting


【解决方案1】:

我找到了解决此问题的方法。

在我们的 MainActivity 中,像这样初始化 PagerTabStrip。

PagerTabStrip pagerTabStrip = (PagerTabStrip) findViewById(R.id.pager_header);

((ViewPager.LayoutParams) pagerTabStrip.getLayoutParams()).isDecor = true;

要记住的一点是,它不会对 Studio 中的布局预览产生影响。但是,如果您运行,那么您将能够在您的设备中看到正确的输出。

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 2020-12-03
    • 1970-01-01
    • 1970-01-01
    • 2019-08-12
    • 2020-11-09
    • 2017-04-12
    • 2018-11-22
    相关资源
    最近更新 更多