title: Thrown exception of java.lang.NullPointerException after importing image to my Main Activity XML file
body: <p>So i tried to copy an image downloaded from the internet to my android studio mainactivity xml file via copying the image and pasting it onto the drawable resource folder, But for some reason, I got an error of "Failed to instantiate one or more classes" This is the first time I'm getting this error as my previous images copied the exact same way had no errors except for other images such as this one. Does it have something to do with PNG or JPG format?I tried to resync the project with Gradle files but its still the same. What should I do to solve this exception? Thank You.</p>
  
  <p>1) <a href="https://i.stack.imgur.com/LWivS.png" rel="nofollow noreferrer">the process of copying and pasting image to drawable</a></p>
  
  <p>2) <a href="https://i.stack.imgur.com/ohay3.png" rel="nofollow noreferrer">The error itself after pasting the image</a></p>
  
  <pre><code>java.lang.NullPointerException
  at android.content.res.Resources_Delegate.getValue(Resources_Delegate.java:788)
  at android.content.res.Resources.getValue(Resources.java:1286)
  at android.support.v7.widget.AppCompatDrawableManager.createDrawableIfNeeded(AppCompatDrawableManager.java:236)
  at android.support.v7.widget.AppCompatDrawableManager.getDrawable(AppCompatDrawableManager.java:199)
  at android.support.v7.widget.AppCompatDrawableManager.getDrawable(AppCompatDrawableManager.java:190)
  at android.support.v7.content.res.AppCompatResources.getDrawable(AppCompatResources.java:100)
  at android.support.v7.widget.AppCompatImageHelper.loadFromAttributes(AppCompatImageHelper.java:54)
  at android.support.v7.widget.AppCompatImageView.&lt;init&gt;(AppCompatImageView.java:66)
  at android.support.v7.widget.AppCompatImageView.&lt;init&gt;(AppCompatImageView.java:56)
  at sun.reflect.GeneratedConstructorAccessor1111.newInstance(Unknown Source)
  at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45)
  at java.lang.reflect.Constructor.newInstance(Constructor.java:423)
  at org.jetbrains.android.uipreview.ViewLoader.createNewInstance(ViewLoader.java:475)
  at org.jetbrains.android.uipreview.ViewLoader.loadClass(ViewLoader.java:250)
  at org.jetbrains.android.uipreview.ViewLoader.loadClass(ViewLoader.java:213)
  at com.android.tools.idea.rendering.LayoutlibCallbackImpl.loadClass(LayoutlibCallbackImpl.java:193)
  at android.view.BridgeInflater.loadCustomView(BridgeInflater.java:333)
  at android.view.BridgeInflater.onCreateView(BridgeInflater.java:152)
  at android.view.LayoutInflater.onCreateView(LayoutInflater.java:717)
  at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:785)
  at android.view.BridgeInflater.createViewFromTag(BridgeInflater.java:222)
  at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:727)
  at android.view.LayoutInflater.rInflate_Original(LayoutInflater.java:858)
  at android.view.LayoutInflater_Delegate.rInflate(LayoutInflater_Delegate.java:70)
  at android.view.LayoutInflater.rInflate(LayoutInflater.java:834)
  at android.view.LayoutInflater.rInflateChildren(LayoutInflater.java:821)
  at android.view.LayoutInflater.inflate(LayoutInflater.java:518)
  at android.view.LayoutInflater.inflate(LayoutInflater.java:397)
  at com.android.layoutlib.bridge.impl.RenderSessionImpl.inflate(RenderSessionImpl.java:324)
  at com.android.layoutlib.bridge.Bridge.createSession(Bridge.java:429)
  at com.android.ide.common.rendering.LayoutLibrary.createSession(LayoutLibrary.java:368)
  at com.android.tools.idea.rendering.RenderTask$2.compute(RenderTask.java:567)
  at com.android.tools.idea.rendering.RenderTask$2.compute(RenderTask.java:549)
  at com.intellij.openapi.application.impl.ApplicationImpl.runReadAction(ApplicationImpl.java:863)
  at com.android.tools.idea.rendering.RenderTask.createRenderSession(RenderTask.java:549)
  at com.android.tools.idea.rendering.RenderTask.lambda$inflate$1(RenderTask.java:680)
  at java.util.concurrent.FutureTask.run(FutureTask.java:266)
  at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
  at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
  at java.lang.Thread.run(Thread.java:745)
  </code></pre>
  
  <p>Edit: Also, When i try to compile the code, my project would'nt start unless i delete the image file in my drawable folder due to this error : `Error:Execution failed for task ':app:mergeDebugResources'.</p>
  
  <blockquote>
    <p>C:\Users\TP_baseline\AndroidStudioProjects\COMTProject(MeloWide)\app\src\main\res\drawable\icons8-Medal-80.png: Error: '-' is not a valid file-based resource name character: File-based resource names must contain only lowercase a-z, 0-9, or underscore`  </p>
  </blockquote>