0

Yesterday i was making some changes to my app, specificly ActionBar colors, i worked perfectly, i was able to preview on android studio without problems and run it on my device works perfectly, but this morning when i opened android studio, it wont preview and was throwing this exception:

java.lang.NullPointerException
    at android.graphics.Bitmap_Delegate.createBitmap(Bitmap_Delegate.java:599)
    at android.graphics.Bitmap_Delegate.createBitmap(Bitmap_Delegate.java:120)
    at android.graphics.Bitmap_Delegate.createBitmap(Bitmap_Delegate.java:102)
    at com.android.layoutlib.bridge.impl.ResourceHelper.getDrawable(ResourceHelper.java:236)
    at com.android.layoutlib.bridge.bars.ActionBarLayout.getDrawable(ActionBarLayout.java:222)
    at com.android.layoutlib.bridge.bars.ActionBarLayout.setupActionBar(ActionBarLayout.java:160)
    at com.android.layoutlib.bridge.bars.ActionBarLayout.<init>(ActionBarLayout.java:127)
    at com.android.layoutlib.bridge.impl.RenderSessionImpl.createActionBar(RenderSessionImpl.java:1627)
    at com.android.layoutlib.bridge.impl.RenderSessionImpl.inflate(RenderSessionImpl.java:355)
    at com.android.layoutlib.bridge.Bridge.createSession(Bridge.java:329)
    at com.android.ide.common.rendering.LayoutLibrary.createSession(LayoutLibrary.java:332)
    at com.android.tools.idea.rendering.RenderService$3.compute(RenderService.java:575)
    at com.android.tools.idea.rendering.RenderService$3.compute(RenderService.java:564)
    at com.intellij.openapi.application.impl.ApplicationImpl.runReadAction(ApplicationImpl.java:932)
    at com.android.tools.idea.rendering.RenderService.createRenderSession(RenderService.java:564)
    at com.android.tools.idea.rendering.RenderService.render(RenderService.java:691)
    at org.jetbrains.android.uipreview.AndroidLayoutPreviewToolWindowManager.doRender(AndroidLayoutPreviewToolWindowManager.java:604)
    at org.jetbrains.android.uipreview.AndroidLayoutPreviewToolWindowManager.access$1900(AndroidLayoutPreviewToolWindowManager.java:80)
    at org.jetbrains.android.uipreview.AndroidLayoutPreviewToolWindowManager$7$1.run(AndroidLayoutPreviewToolWindowManager.java:546)
    at com.intellij.openapi.progress.impl.ProgressManagerImpl$2.run(ProgressManagerImpl.java:178)
    at com.intellij.openapi.progress.ProgressManager.executeProcessUnderProgress(ProgressManager.java:209)
    at com.intellij.openapi.progress.impl.ProgressManagerImpl.executeProcessUnderProgress(ProgressManagerImpl.java:212)
    at com.intellij.openapi.progress.impl.ProgressManagerImpl.runProcess(ProgressManagerImpl.java:171)
    at org.jetbrains.android.uipreview.AndroidLayoutPreviewToolWindowManager$7.run(AndroidLayoutPreviewToolWindowManager.java:541)
    at com.intellij.util.ui.update.MergingUpdateQueue.execute(MergingUpdateQueue.java:320)
    at com.intellij.util.ui.update.MergingUpdateQueue.execute(MergingUpdateQueue.java:310)
    at com.intellij.util.ui.update.MergingUpdateQueue$2.run(MergingUpdateQueue.java:254)
    at com.intellij.util.ui.update.MergingUpdateQueue.flush(MergingUpdateQueue.java:269)
    at com.intellij.util.ui.update.MergingUpdateQueue.flush(MergingUpdateQueue.java:227)
    at com.intellij.util.ui.update.MergingUpdateQueue.run(MergingUpdateQueue.java:217)
    at com.intellij.util.concurrency.QueueProcessor.runSafely(QueueProcessor.java:238)
    at com.intellij.util.Alarm$Request$1.run(Alarm.java:327)
    at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:471)
    at java.util.concurrent.FutureTask$Sync.innerRun(FutureTask.java:334)
    at java.util.concurrent.FutureTask.run(FutureTask.java:166)
    at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1110)
    at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:603)
    at java.lang.Thread.run(Thread.java:722)

all activities even empty causes this problem

<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:paddingLeft="@dimen/activity_horizontal_margin"
android:paddingRight="@dimen/activity_horizontal_margin"
android:paddingTop="@dimen/activity_vertical_margin"
android:paddingBottom="@dimen/activity_vertical_margin"
tools:context="com.andujardev.money.AccountCreator">
</RelativeLayout>

the exception is thrown when rendering the preview

any help?

ask if need more info

EDIT: for some reason, the error has to do with the action bar, as i have a layout that doesnt show the action bar and it can render normally, i just cant find where the problem is as the program can compile and run any time i want.

5
  • 1
    no xml and no java code how can i know .....where is null pointer exception .......posting code will be great idea Commented Sep 10, 2014 at 17:11
  • What did you do to debug this? Commented Sep 10, 2014 at 17:12
  • it shows on the xml preview screen, the point is that even with an empty empty layout (with base <RelativeLayout .....>... </..>) throws this exception. BUT IT COMPILES RUN IN MY PHONE Commented Sep 10, 2014 at 17:26
  • the point is, i dont know WHICH (xml/Java) code to paste, because my app is running perfectly on my device, and compiled it after i was having the problem with Android-Studio Commented Sep 10, 2014 at 17:35
  • possible duplicate of Android XML File java.lang.nullpointerexception Commented May 12, 2015 at 17:00

2 Answers 2

2

SOLVED! seems that the app icon image that i used (which i changed last night) was not on correct format so the render library could not render the image properly, however my device was able to use it correctly.

Sign up to request clarification or add additional context in comments.

Comments

-2

From my answer at another post:

This exception usually occurs due to corrupt drawables. Make sure you are able to open and view all the drawable you have linked.

enter image description here

If you happen to see any error message of this sort or are unable to view your drawable then try replacing it again with the original file or if you have downloaded it then try re-downloading it.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.