NoSuchMethodError:没有静态方法将BottomNavigation视图结合起来

时间:2018-06-27 12:36:40

标签: android build.gradle native-ads

我在项目中使用了AdMob原生广告。加入后 库('com.google.android.gms:play-services-ads:15.0.0')我的 应用程序崩溃了。

这是我的应用gradle文件。

 apply plugin: 'com.android.application'
    apply plugin: 'io.fabric'
    apply plugin: 'kotlin-android'
    apply plugin: 'kotlin-android-extensions'
    apply plugin: 'com.github.dcendents.android-maven'

    group = 'com.github.jitpack'

    buildscript {
        repositories {
            maven { url 'https://maven.fabric.io/public' }
        }

        dependencies {
            classpath 'io.fabric.tools:gradle:1.+'
        }
    }
    android {
        compileSdkVersion 27
        buildToolsVersion "27.0.3"
        defaultConfig {
            applicationId "xxx xxx xxx"
            minSdkVersion 16
            targetSdkVersion 27
            versionCode 8
            versionName "1.0.7"
            multiDexEnabled true
            testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
            ndk {

                abiFilters "armeabi", "armeabi-v8a", "x86", "mips"
            }
            javaCompileOptions {
                annotationProcessorOptions {
                    includeCompileClasspath false
                }
            }

        }


        lintOptions {
            disable 'NamespaceTypo'
            disable 'MissingTranslation'
            checkReleaseBuilds false
            abortOnError false
            disable 'RestrictedApi'
        }

        buildTypes {
            release {
                minifyEnabled false
                proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
            }
            debug {
                minifyEnabled false
                debuggable true
                ext.enableCrashlytics = true

            }
        }

        allprojects {
            repositories {
                maven { url 'https://jitpack.io' }
            }
        }

        dexOptions {
            jumboMode true
            javaMaxHeapSize "4g"
            preDexLibraries false
        }

        sourceSets {
            main {
                aidl.srcDirs = ['src/main/java']
                jniLibs.srcDirs = ['libs']
            }

            // Move the tests to tests/java, tests/res, etc...
            androidTest.setRoot('tests')

            // Move the build types to build-types/<type>
            // For instance, build-types/debug/java, build-types/debug/AndroidManifest.xml, ...
            // This moves them out of them default location under src/<type>/... which would
            // conflict with src/ being used by the main source set.
            // Adding new build types or product flavors should be accompanied
            // by a similar customization.
            debug.setRoot('build-types/debug')
            release.setRoot('build-types/release')
        }

    }
    repositories {
        mavenCentral()
        maven { url 'https://maven.fabric.io/public' }
    }
    dependencies {
        implementation fileTree(dir: 'libs', include: ['*.jar'])

        implementation project(':alphabetsindexfastscrollrecycler')
        implementation project(':swipe-reveal-layout')
        implementation project(':android-support-v4-preferencefragment')

        implementation files('libs/libphonenumber-5.0v1.5.jar')

        androidTestCompile('com.android.support.test.espresso:espresso-core:2.2.2', {
            exclude group: 'com.android.support', module: 'support-annotations'
        })

        implementation('com.crashlytics.sdk.android:crashlytics:2.8.0@aar') {
            transitive = true;

        }

        implementation('io.fabric.sdk.android:fabric:1.4.1@aar') {
            transitive = true;
        }
        testCompile "org.jetbrains.kotlin:kotlin-test-junit:$kotlin_version"
        testCompile "org.jetbrains.kotlin:kotlin-stdlib:$kotlin_version"
        implementation "org.jetbrains.kotlin:kotlin-stdlib-jre7:$kotlin_version"
        implementation('com.paypal.sdk:paypal-android-sdk:2.15.3')
                { exclude group: 'io.card' }


      /*  compile('com.google.firebase:firebase-messaging:9.4.0') {
            exclude group: 'com.google.android', module: 'gms-actions'
        }*/
        implementation 'com.android.support:multidex:1.0.2'
        implementation 'com.github.dmytrodanylyk.realm-browser:library:0.0.3'
        implementation 'com.android.support:appcompat-v7:27.0.1'

        implementation 'com.android.support.constraint:constraint-layout:1.0.0-beta3'
        implementation 'com.android.support:support-v4:27.0.1'
        implementation 'com.nineoldandroids:library:2.4.0'
        implementation 'com.mcxiaoke.volley:library-aar:1.0.0'

        implementation 'com.google.code.gson:gson:2.8.0'
        implementation 'com.github.d-max:spots-dialog:0.7@aar'
        implementation 'com.github.silvestrpredko:dot-progress-bar:1.1'
        implementation 'com.github.blennerSilva:AwesomeDialog:2.0.1'
        implementation 'com.github.bumptech.glide:glide:3.7.0'
        implementation 'com.pkmmte.view:circularimageview:1.1'
        implementation 'com.amulyakhare:com.amulyakhare.textdrawable:1.0.1'
        implementation 'com.google.android.gms:play-services-ads:15.0.0'


        testCompile 'junit:junit:4.12'
        implementation project(':library')
    }

    repositories {
        mavenCentral()
    }
  

这是错误日志

     

java.lang.NoSuchMethodError:没有静态方法   类别中的CombineMeasuredStates(II)I   Landroid / support / v7 / widget / ViewUtils;或其超一流   (“ android.support.v7.widget.ViewUtils”的声明出现在   /data/app/xxx-1/base.apk:classes2.dex)           在android.support.design.internal.BaselineLayout.onMeasure(BaselineLayout.java:68)           在android.view.View.measure(View.java:19883)           在android.view.ViewGroup.measureChildWithMargins(ViewGroup.java:6085)           在android.widget.FrameLayout.onMeasure(FrameLayout.java:185)           在android.view.View.measure(View.java:19883)           在android.support.design.internal.BottomNavigationMenuView.onMeasure(BottomNavigationMenuView.java:142)

1 个答案:

答案 0 :(得分:3)

最后,我通过添加底部导航视图的设计库解决了我的问题。其他库版本保持不变。

compileSdkVersion 27 buildToolsVersion“ 27.0.3”

实现'com.android.support:appcompat-v7:27.0.1'
实施'com.android.support:support-v4:27.0.1' 实施'com.android.support:design:27.0.1'