TheFinestArtist / FinestWebView-Android

Beautiful and customizable Android Activity that shows web pages within an app.
https://finestwebview.web.app
2.32k stars 531 forks source link

Class Cast Exception #41

Closed PGMacDesign closed 8 years ago

PGMacDesign commented 8 years ago

Hi all, I am getting a Class cast exception when I try to open the activity.

java.lang.RuntimeException: Unable to start activity ComponentInfo{com.myapp.testapp/com.thefinestartist.finestwebview.FinestWebViewActivity}: java.lang.ClassCastException: android.graphics.drawable.BitmapDrawable cannot be cast to android.support.graphics.drawable.VectorDrawableCompat

It runs when I use the following code from within an activity:

//The Url privacy policy is just a standard web URL new FinestWebView.Builder(this).show(Constants.URL_PRIVACY_POLICY);

Is there something wrong with how I structured the builder? Or is the issue simply with the unchecked image casting?

-PGMacDesign

(PS, running 4.4.2, Kitkat, on API level 19)

TheFinestArtist commented 8 years ago

@PGMacDesign I am using VectorDrawable so I think you should use gradle version higher than 2.0.0 (classpath 'com.android.tools.build:gradle:2.0.0-rc3') and gradle wrapper distribution url higher than 2.10 (distributionUrl=https\://services.gradle.org/distributions/gradle-2.10-all.zip)

PGMacDesign commented 8 years ago

I just tested and confirmed that using gradle 2.0.0 or higher works and fixes the issue I was having. Specifically, in the build.gradle file, I adjusted this line: classpath 'com.android.tools.build:gradle:2.0.0' Under the dependencies section under the buildscript section. Thanks!