1

Yesterday I updated my phone's software to the new Android Pie, and suddenly my android studio projecet stopped working, with the following code in the log:

E/AndroidRuntime: FATAL EXCEPTION: main
    Process: com.example.user.mahaluz, PID: 26774
    java.lang.IllegalArgumentException: Invalid Region.Op - only INTERSECT and DIFFERENCE are allowed
        at android.graphics.Canvas.checkValidClipOp(Canvas.java:779)
        at android.graphics.Canvas.clipRect(Canvas.java:918)
        at com.alamkanak.weekview.WeekView.drawHeaderRowAndEvents(WeekView.java:591)
        at com.alamkanak.weekview.WeekView.onDraw(WeekView.java:488)
        at android.view.View.draw(View.java:21859)
        at android.view.View.updateDisplayListIfDirty(View.java:20732)
        at android.view.View.draw(View.java:21585)
        at android.view.ViewGroup.drawChild(ViewGroup.java:4546)
        at android.view.ViewGroup.dispatchDraw(ViewGroup.java:4321)
        at android.view.View.updateDisplayListIfDirty(View.java:20718)
        at android.view.View.draw(View.java:21585)
        at android.view.ViewGroup.drawChild(ViewGroup.java:4546)
        at android.view.ViewGroup.dispatchDraw(ViewGroup.java:4321)
        at android.view.View.updateDisplayListIfDirty(View.java:20718)
        at android.view.View.draw(View.java:21585)
        at android.view.ViewGroup.drawChild(ViewGroup.java:4546)
        at android.view.ViewGroup.dispatchDraw(ViewGroup.java:4321)
        at android.view.View.updateDisplayListIfDirty(View.java:20718)
        at android.view.View.draw(View.java:21585)
        at android.view.ViewGroup.drawChild(ViewGroup.java:4546)
        at android.view.ViewGroup.dispatchDraw(ViewGroup.java:4321)
        at android.view.View.updateDisplayListIfDirty(View.java:20718)
        at android.view.View.draw(View.java:21585)
        at android.view.ViewGroup.drawChild(ViewGroup.java:4546)
        at android.view.ViewGroup.dispatchDraw(ViewGroup.java:4321)
        at android.view.View.updateDisplayListIfDirty(View.java:20718)
        at android.view.View.draw(View.java:21585)
        at android.view.ViewGroup.drawChild(ViewGroup.java:4546)
        at android.view.ViewGroup.dispatchDraw(ViewGroup.java:4321)
        at android.view.View.updateDisplayListIfDirty(View.java:20718)
        at android.view.View.draw(View.java:21585)
        at android.view.ViewGroup.drawChild(ViewGroup.java:4546)
        at android.view.ViewGroup.dispatchDraw(ViewGroup.java:4321)
        at android.view.View.updateDisplayListIfDirty(View.java:20718)
        at android.view.View.draw(View.java:21585)
        at android.view.ViewGroup.drawChild(ViewGroup.java:4546)
        at android.view.ViewGroup.dispatchDraw(ViewGroup.java:4321)
        at android.view.View.updateDisplayListIfDirty(View.java:20718)
        at android.view.View.draw(View.java:21585)
        at android.view.ViewGroup.drawChild(ViewGroup.java:4546)
        at android.view.ViewGroup.dispatchDraw(ViewGroup.java:4321)
        at android.view.View.draw(View.java:21862)
        at com.android.internal.policy.DecorView.draw(DecorView.java:1083)
        at android.view.View.updateDisplayListIfDirty(View.java:20732)
        at android.view.ThreadedRenderer.updateViewTreeDisplayList(ThreadedRenderer.java:725)
        at android.view.ThreadedRenderer.updateRootDisplayList(ThreadedRenderer.java:731)
        at android.view.ThreadedRenderer.draw(ThreadedRenderer.java:840)
        at android.view.ViewRootImpl.draw(ViewRootImpl.java:3909)
        at android.view.ViewRootImpl.performDraw(ViewRootImpl.java:3683)
        at android.view.ViewRootImpl.performTraversals(ViewRootImpl.java:2991)
        at android.view.ViewRootImpl.doTraversal(ViewRootImpl.java:1850)
        at android.view.ViewRootImpl$TraversalRunnable.run(ViewRootImpl.java:8455)
        at android.view.Choreographer$CallbackRecord.run(Choreographer.java:949)
        at android.view.Choreographer.doCallbacks(Choreographer.java:761)
        at android.view.Choreographer.doFrame(Choreographer.java:696)
        at android.view.Choreographer$FrameDisplayEventReceiver.run(Choreographer.java:935)
        at android.os.Handler.handleCallback(Handler.java:873)
        at android.os.Handler.dispatchMessage(Handler.java:99)
        at android.os.Looper.loop(Looper.java:214)
        at android.app.ActivityThread.main(ActivityThread.java:6981)
        at java.lang.reflect.Method.invoke(Native Method)
        at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:493)
        at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1445)
E/UncaughtException: java.lang.IllegalArgumentException: Invalid Region.Op - only INTERSECT and DIFFERENCE are allowed
        at android.graphics.Canvas.checkValidClipOp(Canvas.java:779)
        at android.graphics.Canvas.clipRect(Canvas.java:918)
        at com.alamkanak.weekview.WeekView.drawHeaderRowAndEvents(WeekView.java:591)
        at com.alamkanak.weekview.WeekView.onDraw(WeekView.java:488)
        at android.view.View.draw(View.java:21859)
        at android.view.View.updateDisplayListIfDirty(View.java:20732)
        at android.view.View.draw(View.java:21585)
        at android.view.ViewGroup.drawChild(ViewGroup.java:4546)
        at android.view.ViewGroup.dispatchDraw(ViewGroup.java:4321)
        at android.view.View.updateDisplayListIfDirty(View.java:20718)
        at android.view.View.draw(View.java:21585)
        at android.view.ViewGroup.drawChild(ViewGroup.java:4546)
        at android.view.ViewGroup.dispatchDraw(ViewGroup.java:4321)
        at android.view.View.updateDisplayListIfDirty(View.java:20718)
        at android.view.View.draw(View.java:21585)
        at android.view.ViewGroup.drawChild(ViewGroup.java:4546)
        at android.view.ViewGroup.dispatchDraw(ViewGroup.java:4321)
        at android.view.View.updateDisplayListIfDirty(View.java:20718)
        at android.view.View.draw(View.java:21585)
        at android.view.ViewGroup.drawChild(ViewGroup.java:4546)
        at android.view.ViewGroup.dispatchDraw(ViewGroup.java:4321)
        at android.view.View.updateDisplayListIfDirty(View.java:20718)
        at android.view.View.draw(View.java:21585)
        at android.view.ViewGroup.drawChild(ViewGroup.java:4546)
        at android.view.ViewGroup.dispatchDraw(ViewGroup.java:4321)
        at android.view.View.updateDisplayListIfDirty(View.java:20718)
        at android.view.View.draw(View.java:21585)
        at android.view.ViewGroup.drawChild(ViewGroup.java:4546)
        at android.view.ViewGroup.dispatchDraw(ViewGroup.java:4321)
        at android.view.View.updateDisplayListIfDirty(View.java:20718)
        at android.view.View.draw(View.java:21585)
        at android.view.ViewGroup.drawChild(ViewGroup.java:4546)
        at android.view.ViewGroup.dispatchDraw(ViewGroup.java:4321)
        at android.view.View.updateDisplayListIfDirty(View.java:20718)
        at android.view.View.draw(View.java:21585)
        at android.view.ViewGroup.drawChild(ViewGroup.java:4546)
        at android.view.ViewGroup.dispatchDraw(ViewGroup.java:4321)
        at android.view.View.updateDisplayListIfDirty(View.java:20718)
        at android.view.View.draw(View.java:21585)
        at android.view.ViewGroup.drawChild(ViewGroup.java:4546)
        at android.view.ViewGroup.dispatchDraw(ViewGroup.java:4321)
        at android.view.View.draw(View.java:21862)
        at com.android.internal.policy.DecorView.draw(DecorView.java:1083)
        at android.view.View.updateDisplayListIfDirty(View.java:20732)
        at android.view.ThreadedRenderer.updateViewTreeDisplayList(ThreadedRenderer.java:725)
        at android.view.ThreadedRenderer.updateRootDisplayList(ThreadedRenderer.java:731)
        at android.view.ThreadedRenderer.draw(ThreadedRenderer.java:840)
        at android.view.ViewRootImpl.draw(ViewRootImpl.java:3909)
        at android.view.ViewRootImpl.performDraw(ViewRootImpl.java:3683)
        at android.view.ViewRootImpl.performTraversals(ViewRootImpl.java:2991)
        at android.view.ViewRootImpl.doTraversal(ViewRootImpl.java:1850)
        at android.view.ViewRootImpl$TraversalRunnable.run(ViewRootImpl.java:8455)
        at android.view.Choreographer$CallbackRecord.run(Choreographer.java:949)
        at android.view.Choreographer.doCallbacks(Choreographer.java:761)
        at android.view.Choreographer.doFrame(Choreographer.java:696)
        at android.view.Choreographer$FrameDisplayEventReceiver.run(Choreographer.java:935)
        at android.os.Handler.handleCallback(Handler.java:873)
        at android.os.Handler.dispatchMessage(Handler.java:99)
        at android.os.Looper.loop(Looper.java:214)
        at android.app.ActivityThread.main(ActivityThread.java:6981)
        at java.lang.reflect.Method.invoke(Native Method)
        at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:493)
        at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1445)

As far as I understood from reading about that error, it comes from changing updrading softwares and versions mismatches inside the build.gradle files, so these are my build.gradle files:

Project:app -

// Top-level build file where you can add configuration options common to all sub-projects/modules.

buildscript {

    repositories {
        google()
        jcenter()
        maven { url "http://jcenter.bintray.com"}

    }
    dependencies {
        classpath 'com.android.tools.build:gradle:3.3.1'


        // NOTE: Do not place your application dependencies here; they belong
        // in the individual module build.gradle files
        classpath 'com.google.gms:google-services:4.2.0'
    }
}

allprojects {
    repositories {
        google()
        jcenter()
        maven { url 'https://jitpack.io' }
    }
}

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

Module:app -

apply plugin: 'com.android.application'

android {
    compileSdkVersion 28
    buildToolsVersion '28.0.3'
    defaultConfig {
        applicationId "com.example.user.mahaluz"
        minSdkVersion 16
        targetSdkVersion 28
        versionCode 1
        versionName "1.0"
        multiDexEnabled true
        testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
    }
    buildTypes {
        release {
            minifyEnabled false
            proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
        }
    }
}

dependencies {
    implementation fileTree(dir: 'libs', include: ['*.jar'])
    //noinspection GradleCompatible
    testImplementation 'junit:junit:4.12'

    //google maps api
    implementation 'com.google.android.gms:play-services-maps:16.1.0'
    implementation 'com.google.android.gms:play-services-location:16.0.0'
    implementation 'com.google.android.gms:play-services-places:16.0.0'

    //Firebase
    implementation 'com.google.firebase:firebase-crash:16.2.1'
    implementation 'com.firebase:firebase-client-android:2.5.2'
    implementation 'com.google.firebase:firebase-core:16.0.7'
    implementation 'com.google.firebase:firebase-database:16.0.6'
    implementation ("com.firebaseui:firebase-ui-database:2.1.1") {
        exclude group: "com.android.support", module: "recyclerview-v7"
    }
    implementation 'com.google.firebase:firebase-storage:16.0.5'
    implementation 'com.google.firebase:firebase-firestore:18.0.0'
    implementation 'com.google.firebase:firebase-messaging:17.3.4'
    implementation 'com.google.firebase:firebase-auth:16.1.0'
    implementation 'com.google.android.gms:play-services-auth:16.0.1'

    //Calendar
    implementation 'com.github.alamkanak:android-week-view:1.2.6'
    implementation 'com.github.sundeepk:compact-calendar-view:3.0.0'
    implementation 'com.github.khacpv:Calendar-Day-View:1.0.5'
    //noinspection GradleCompatible
    implementation 'com.android.support:appcompat-v7:28.0.0'
    implementation 'com.android.support:design:28.0.0'
    implementation 'com.android.support.constraint:constraint-layout:1.1.3'
    implementation 'com.android.support:support-v4:28.0.0'
    implementation 'com.android.support:multidex:1.0.3'
    implementation 'com.android.support:cardview-v7:28.0.0'
    implementation 'com.android.support:recyclerview-v7:28.0.0'
    //Image tools
    implementation 'com.theartofdev.edmodo:android-image-cropper:2.7.0'
    implementation 'com.squareup.picasso:picasso:2.5.2'
    implementation 'de.hdodenhof:circleimageview:2.1.0'
    //Validation
    implementation 'com.basgeekball:awesome-validation:2.0'
    //Notification badge
    implementation 'com.nex3z:notification-badge:0.1.0'
    //Others
    implementation 'com.kevin:loopview:1.4.1'

    androidTestImplementation 'com.android.support.test:runner:1.0.2'
    androidTestImplementation 'com.android.support.test.espresso:espresso-core:3.0.2'
}
apply plugin: 'com.google.gms.google-services'
com.google.gms.googleservices.GoogleServicesPlugin.config.disableVersionCheck = true

It's important to mention that the app works on my log in activity, and after logging in and reaching the activity afterwards, and after finishing its onCreate() method, it crashes with the Log code above. Any help would be appriciated :)

Phantômaxx
  • 37,901
  • 21
  • 84
  • 115
Adi Harel
  • 505
  • 1
  • 5
  • 10
  • 1
    post code of `WeekView.java` as error at this line `com.alamkanak.weekview.WeekView.drawHeaderRowAndEvents(WeekView.java:591)` – Kishore Jethava Feb 11 '19 at 13:24
  • @KishoreJethava it can't be the problem, it worked just fine until i updated the software on my device, plus, this class is from implementation I got from github, I didn't create it – Adi Harel Feb 11 '19 at 13:34
  • @PPartisan it's not a duplicate, what happend there is that they used deprecated method which I don't have in my code, i double and triple checked... – Adi Harel Feb 11 '19 at 13:42
  • 1
    @Fantomas This is indeed the same error, but it has a different solution, as the problem lies in a library; the correct duplicate target is https://stackoverflow.com/questions/50231950 Maybe you can change it and save a few hours of research to others who come here with the same problem :) – Adinia Aug 28 '19 at 15:14
  • @Adinia Added to the other duplicate. They both seem to work, for different cases. – Phantômaxx Aug 29 '19 at 09:00
  • 1
    @Fantômas That works, thank you! Although the first one is more of a list of workarounds, while the second one is specifically fixing this error when it happens in this specific library `com.alamkanak.weekview.WeekView.drawHeaderRowAndEvents(WeekView.java:591)` – Adinia Aug 29 '19 at 09:07

0 Answers0