1

My app is crashing when starting with this error:

 FATAL EXCEPTION: main
Process: com.shotguntheapp.android, PID: 32127
java.lang.NoSuchMethodError: No static method setOnApplyWindowInsetsListener(Landroid/view
at android.support.v7.app.AppCompatDelegateImplV9.createSubDecor(AppCompatDelegateImpl
at android.support.v7.app.AppCompatDelegateImplV9.ensureSubDecor(AppCompatDelegateImpl
at android.support.v7.app.AppCompatDelegateImplV9.setContentView(AppCompatDelegateImpl
at android.support.v7.app.AppCompatActivity.setContentView(AppCompatActivity.java:143)
at com.shotguntheapp.android.Activities.MainActivity.onCreate(MainActivity.java:45)
at android.app.Activity.performCreate(Activity.java:6289)
at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1118)
at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2446)
at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2576)
at android.app.ActivityThread.access$1000(ActivityThread.java:155)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1421)
at android.os.Handler.dispatchMessage(Handler.java:102)
at android.os.Looper.loop(Looper.java:148)
at android.app.ActivityThread.main(ActivityThread.java:5539)

                                                                           at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:726)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:616)

I've already done some research and found all bring me to the same answer: I have to upgrade all my dependencies. Unfortunately, my android dependencies are all in the latest version. Here is my App Gradle script:

apply plugin: 'com.android.application'
//apply plugin: 'io.fabric'


android {
    compileSdkVersion 25
    buildToolsVersion '25.0.1'
defaultConfig {
    applicationId "com.shotguntheapp.android"
    minSdkVersion 17
    targetSdkVersion 25
    versionCode 1
    versionName "6.0"
    testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
}
buildTypes {
    release {
        minifyEnabled true
        proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
    }
}
productFlavors {
    staging {
        applicationId "com.shotguntheapp.android.staging"
        versionName "6.0-staging"
    }
    production {
        applicationId "com.shotguntheapp.android"
        versionName "6.0"
    }
}
}

//buildscript {
//    repositories {
//        jcenter()
//        mavenCentral()
//        maven { url 'https://maven.fabric.io/public' }
//    }
//    dependencies {
//        classpath 'com.android.tools.build:gradle:1.5.0'
//        // The Fabric Gradle plugin uses an open ended version to react
//        // quickly to Android tooling updates
//        classpath 'io.fabric.tools:gradle:1.+'
//    }
//}

repositories {
flatDir {
    dirs 'libs'
}
maven {
    url "https://jitpack.io"
}
mavenCentral()
maven { url 'https://maven.fabric.io/public' }
maven {
    url "http://maven.batch.com/release"
}
}

dependencies {
compile fileTree(include: ['*.jar'], dir: 'libs')
androidTestCompile('com.android.support.test.espresso:espresso-core:2.2.2', {
    exclude group: 'com.android.support', module: 'support-annotations'
})
compile project('libs:paymentkit')
compile project('libs:materiallockview')
//    compile('com.crashlytics.sdk.android:crashlytics:2.6.5@aar') {
//        transitive = true;
//    }
compile 'com.android.support:appcompat-v7:25.0.1'
compile 'com.android.support:design:25.0.1'
compile 'com.android.support:support-v4:25.0.1'
compile 'com.android.support:support-annotations:25.0.1'
compile 'com.facebook.android:facebook-android-sdk:4.6.0'
compile 'com.daprlabs.aaron:swipedeck:2.0.6'
compile 'com.mcxiaoke.volley:library-aar:1.0.1'
compile 'com.facebook.rebound:rebound:0.3.8'
compile 'com.wefika:horizontal-picker:1.1.1'
compile 'com.mixpanel.android:mixpanel-android:4.6.4'
compile 'com.google.android.gms:play-services-auth:10.0.1'
compile 'com.google.android.gms:play-services-plus:10.0.1'
compile 'com.google.android.gms:play-services-maps:10.0.1'
compile 'com.google.android.gms:play-services-gcm:10.0.1'
compile 'com.google.firebase:firebase-core:10.0.1'
compile 'com.google.android.gms:play-services-location:10.0.1'
compile 'com.stripe:stripe-android:+'
compile 'com.orhanobut:dialogplus:1.11@aar'
compile 'com.facebook.fresco:fresco:0.14.1'
compile 'com.facebook.shimmer:shimmer:0.1.0@aar'
compile 'com.parse:parse-android:1.+'
compile 'com.google.code.gson:gson:2.4'
compile 'com.squareup.okhttp:okhttp:2.4.0'
compile 'io.smooch:core:latest.release'
compile 'io.smooch:ui:latest.release'
compile 'jp.wasabeef:fresco-processors:2.0.0'
compile 'com.batch.android:batch-sdk:1.5.+'
compile 'io.branch.sdk.android:library:1.+'
compile 'io.card:android-sdk:5.3.0'
compile 'pl.droidsonroids.gif:android-gif-drawable:1.1.11'
compile 'cn.trinea.android.view.autoscrollviewpager:android-auto-scroll-view-pager:1.1.2'
compile 'com.google.code.gson:gson:2.4'
testCompile 'junit:junit:4.12'

}

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

Thank'you for your help!

  • Are you running this on a device or an emulator? What version of Android is the device (or emulator) running? Post the code of `MainActivityonCreate()`. – David Wasser Dec 12 '16 at 17:18
  • @DavidWasser I'm currently running it in a device (OnePlus X with marshmallow). It's crashing when doing the setContentView: [onCreate](http://img11.hostingpics.net/pics/259833Capturedecran20161213a134211.png) – Pritesh Asvine Dec 13 '16 at 12:40
  • Did you try to go back to version 24 as described here: http://stackoverflow.com/questions/39034938/no-static-method-setonapplywindowinsetslistener-exception-in-android Sometimes the "latest" isnt' so great :-( – David Wasser Dec 13 '16 at 12:59
  • My project is using the [BottomNavigationView](https://developer.android.com/reference/android/support/design/widget/BottomNavigationView.html) which is only available from 25th version :( – Pritesh Asvine Dec 13 '16 at 13:11
  • Oh well. You probably have to wait until Google fixes the support library. Oops. – David Wasser Dec 13 '16 at 13:16
  • I don't think it's a problem of Android. There is maybe something in my code or it's conflicting with an other library :/ – Pritesh Asvine Dec 13 '16 at 16:41
  • Looks to me like a problem in the compatibility library. You could try going back to version 24 of the libraries and commenting out your `BottomNavigationView`, just to verify. – David Wasser Dec 13 '16 at 17:11
  • You could post the content of your layout XML file that you use in `setContentView()` – David Wasser Dec 13 '16 at 17:15
  • Here is my [activity_main.xml](http://img11.hostingpics.net/pics/135467Capturedecran20161213a182552.png) and my [content_main.xml](http://img11.hostingpics.net/pics/829810Capturedecran20161213a182639.png) I'll try to downgrade the version to 24, I will give you some news once done! – Pritesh Asvine Dec 13 '16 at 17:34
  • 1
    @DavidWasser I have updated my code with the new version 25.1.0. My app is still crashing but the problem is now different. It is showing: java.lang.VerifyError: Verifier rejected class com.shotguntheapp.android.Activities.MainActivity Here is the a [screenshot](http://img11.hostingpics.net/pics/266738Capturedecran20161214a154154.png) of the error log – Pritesh Asvine Dec 14 '16 at 14:43

0 Answers0