Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Exception in editor mode (preview not work) #876

Open
LSDsl opened this issue Sep 28, 2018 · 13 comments
Open

Exception in editor mode (preview not work) #876

LSDsl opened this issue Sep 28, 2018 · 13 comments

Comments

@LSDsl
Copy link

LSDsl commented Sep 28, 2018

The following classes could not be instantiated:
- com.prolificinteractive.materialcalendarview.MaterialCalendarView

java.lang.NullPointerException
	at com.prolificinteractive.materialcalendarview.MaterialCalendarView.setupChildren(MaterialCalendarView.java:425)
	at com.prolificinteractive.materialcalendarview.MaterialCalendarView.<init>(MaterialCalendarView.java:404)
	at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
	at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:62)
	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:401)
	at org.jetbrains.android.uipreview.ViewLoader.loadClass(ViewLoader.java:184)
	at org.jetbrains.android.uipreview.ViewLoader.loadView(ViewLoader.java:142)
	at com.android.tools.idea.rendering.LayoutlibCallbackImpl.loadView(LayoutlibCallbackImpl.java:229)
	at android.view.BridgeInflater.loadCustomView(BridgeInflater.java:421)
	at android.view.BridgeInflater.loadCustomView(BridgeInflater.java:432)
	at android.view.BridgeInflater.createViewFromTag(BridgeInflater.java:336)
	at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:730)
	at android.view.LayoutInflater.rInflate_Original(LayoutInflater.java:863)
	at android.view.LayoutInflater_Delegate.rInflate(LayoutInflater_Delegate.java:72)
	at android.view.LayoutInflater.rInflate(LayoutInflater.java:837)
	at android.view.LayoutInflater.rInflateChildren(LayoutInflater.java:824)
	at android.view.LayoutInflater.inflate(LayoutInflater.java:515)
	at android.view.LayoutInflater.inflate(LayoutInflater.java:394)
	at com.android.layoutlib.bridge.impl.RenderSessionImpl.inflate(RenderSessionImpl.java:327)
	at com.android.layoutlib.bridge.Bridge.createSession(Bridge.java:386)
	at com.android.tools.idea.layoutlib.LayoutLibrary.createSession(LayoutLibrary.java:193)
	at com.android.tools.idea.rendering.RenderTask.createRenderSession(RenderTask.java:450)
	at com.android.tools.idea.rendering.RenderTask.lambda$inflate$3(RenderTask.java:590)
	at java.util.concurrent.FutureTask.run(FutureTask.java:266)
	at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511)
	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)
@softmarshmallow
Copy link

same problme here.

@quentin41500
Copy link
Member

Most likely a problem with styles or android studio, not the library.

@NinoDLC
Copy link

NinoDLC commented Oct 11, 2018

same here

@cengizahmet
Copy link

same problem for me. Android studio is reaching max memory capacity and not responding. 3889 of 3933M with com.prolificinteractive.materialcalendarview.MaterialCalendarView

@kito22
Copy link

kito22 commented Oct 21, 2018

same here.

@NikolayMenzhulin
Copy link

Same here.

@pdaniel37
Copy link

pdaniel37 commented Feb 18, 2019

Same here
(edit) i solved problem for me, using version 1.6.0 instead of 2.0.1, curiously 1.6.1 and above not works (had the same problem)

@danilozanaga
Copy link

With last version of AS, it did not design rendering even on these versions:

  • 2.0.1
  • 2.0.0
  • 1.6.0
  • 1.4.3

@AHerbel
Copy link

AHerbel commented Apr 29, 2019

Same problem here. This is the stack trace on AS 3.4 and gradle tools version 3.4.0:

java.lang.NoClassDefFoundError: Could not initialize class com.prolificinteractive.materialcalendarview.format.TitleFormatter
at com.prolificinteractive.materialcalendarview.TitleChanger.(TitleChanger.java:21)
at com.prolificinteractive.materialcalendarview.MaterialCalendarView.(MaterialCalendarView.java:273)
at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:62)
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:403)
at org.jetbrains.android.uipreview.ViewLoader.loadClass(ViewLoader.java:186)
at org.jetbrains.android.uipreview.ViewLoader.loadView(ViewLoader.java:144)
at com.android.tools.idea.rendering.LayoutlibCallbackImpl.loadView(LayoutlibCallbackImpl.java:309)
at android.view.BridgeInflater.loadCustomView(BridgeInflater.java:418)
at android.view.BridgeInflater.loadCustomView(BridgeInflater.java:429)
at android.view.BridgeInflater.createViewFromTag(BridgeInflater.java:333)
at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:730)
at android.view.LayoutInflater.rInflate_Original(LayoutInflater.java:863)
at android.view.LayoutInflater_Delegate.rInflate(LayoutInflater_Delegate.java:72)
at android.view.LayoutInflater.rInflate(LayoutInflater.java:837)
at android.view.LayoutInflater.rInflateChildren(LayoutInflater.java:824)
at android.view.LayoutInflater.inflate(LayoutInflater.java:515)
at android.view.LayoutInflater.inflate(LayoutInflater.java:394)
at com.android.layoutlib.bridge.impl.RenderSessionImpl.inflate(RenderSessionImpl.java:326)
at com.android.layoutlib.bridge.Bridge.createSession(Bridge.java:391)
at com.android.tools.idea.layoutlib.LayoutLibrary.createSession(LayoutLibrary.java:195)
at com.android.tools.idea.rendering.RenderTask.createRenderSession(RenderTask.java:540)
at com.android.tools.idea.rendering.RenderTask.lambda$inflate$5(RenderTask.java:666)
at java.util.concurrent.CompletableFuture$AsyncSupply.run(CompletableFuture.java:1590)
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)

@sampengilly
Copy link

sampengilly commented Jun 6, 2019

Still getting the null pointer exception above (though for line 427) in Android Studio 3.5 beta. NPE seems to line up with the calendarMode field. Setting the calendar mode explicitly on the view with app:mcv_calendarMode="month" seems to have no effect here.

Edit: Using library version 2.0.1

@LeonardoRick
Copy link

Same problem here, any updates?

@sampengilly
Copy link

There hasn't been a master commit since Jan 24, 2019... I think this repo is no longer being maintained

@MacStevins
Copy link

So, I discovered the fix on the Design Editor problem.

I downloaded the source code and opened up Android Studio. Then I tried to separate the calendarMode variable from the state builder, then instantiate it like this; calendarMode = CalendarMode.values()[calendarModeIndex];

Then I built the project, and a org.threeten.bp.zone.ZoneRulesException: No time-zone data files registered occurred, and googled about that exception and found this.

After finding the answer, adding the missing statement, and returning the state builder back. A new exception popped up (As of writing this, it didn't occurred, but it did happened);

java.lang.NullPointerException
at com.prolificinteractive.materialcalendarview.TitleChanger.change(TitleChanger.java:59)

So I tried to add a != null on the if statement, and it worked!

I don't know if this is breaking the license or something, but alot of people including me is having this problem, but I'm not gonna use my version of the library and I'm gonna wait for the update.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests