Cannot instantiate class android.support.v7.widget.SearchView

给你一囗甜甜゛ 提交于 2019-12-01 02:12:08

I had a similar probably that appeared on my release builds but not my debug builds when switching over to the v21 support library. Turned out to be an obfuscation problem, and adding this line to my proguard-rules.txt file fixed it:

-keep class android.support.v7.widget.SearchView { *; }

I had the same issue when I was using Android Studio and Gradle to build my project. I would like to add a SearchView of v7 compat.

The solution is to change gradle plugin version from 0.9.1 or others to 0.9.0. It is a temporary way I found. It maybe a bug of gradle plugin. Hope that helps.

    dependencies {
        classpath "com.android.tools.build:gradle:0.9.0"
    }

Problem was in bad v7 support library. After update everything fine.

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!