Android Studio 1.2.2 ClassNotFoundException android.widget.viewstub

I just installed Android Studio and whenever I start a project (even the default "Hello world" activity created by the IDE).

I have this exception which is raised :

java.lang.ClassNotFoundException: Didn't find class "android.widget.ViewStub" on path: DexPathList[[zip file "/data/app/com.example.noname.exceptiontest-2/base.apk"],nativeLibraryDirectories=[/vendor/lib /system/lib]]

I wished I had some logcat to show but it doesn't seems like this exception is logged in it.

It doesn't stop the project or any other project that I have from working, just a little bit frustrating to go through the stack of this exception every time I run my projects in debug.

After looking around the Internet it doesn't seem that that many people have this problem, only answer that would match my issue would be a problem with Android studio. However those answers dated from more than one year.

I just changed my computer and wanted to move from Eclipse to Android Studio to do some development on my free time. I don't have access to my previous environment for the moment to try to install Android studio and reproduce that error.

Does anyone have or already had this error ? (To reproduce New Hello world Activity, activate any exception in Android Studio and run in debug)

Cheers

Answers


ViewStub lays in a package called android.view, not android.widget. Change the import directive and see if it helps.


Old question, but I had this same issue with Android Studio 2.3

With a project that had 4 modules, the trouble was that I had a misspelling in one of the gradle.build files for one of the modules in the applicationId value.

defaultConfig {
        applicationId "com.my.project"
}

After fixing this, and verifying all of the AndroidManifest.xml values for package matched the build.gradle value above within each module, it worked.

<manifest xmlns:android="http://schemas.android.com/apk/res/android"
    package="com.my.project">

</manifest>

You may also need to go to File > Invalidate Caches / Restart... to clean it all out.


If you are getting this exception because you have set exception breakpoint, then instead of debugging, remove all breakpoints, just run the code,go to logcat and check the logs for the actual exception. You could be trying to access a nested component like button from the grandparent and therefore the error.


the method findClass(String name) of the classLoader that defined by yourself don't throws ClassNotFoundException.


Need Your Help

Multiple audio tracks for HTML5 video

javascript jquery html5 html5-video html5-audio

I'm building a video for my website with HTML5. Ideally, I'd have only one silent video file, and five different audio tracks in different languages that sync up with the video.

EKAlarms with relativeOffset

ios eventkit

I'm currently trying to write a method to compare EKAlarms to one another. The problem with this is between absoluteDate and relativeOffset. Comparing two alarms each with an absoluteDate is easy...