Android Studio - CoordinatorLayout, AppBarLayout and FloatingActionButton not instantiated

2

I started by creating a new application, I changed the project theme and got the following error:

  

java.lang.IllegalArgumentException: You need to use a Theme.AppCompat   theme (or descendant) with the design library. at   android.support.design.widget.ThemeUtils.checkAppCompatTheme (ThemeUtils.java:34)     at   android.support.design.widget.CoordinatorLayout. (CoordinatorLayout.java:178)     at   android.support.design.widget.CoordinatorLayout. (CoordinatorLayout.java:172)     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:422)     at   org.jetbrains.android.uipreview.ViewLoader.createNewInstance (ViewLoader.java:458)     at   org.jetbrains.android.uipreview.ViewLoader.loadClass (ViewLoader.java:170)     at   org.jetbrains.android.uipreview.ViewLoader.loadView (ViewLoader.java:103)     at   com.android.tools.idea.rendering.LayoutlibCallbackImpl.loadView (LayoutlibCallbackImpl.java:190)     at   android.view.BridgeInflater.loadCustomView (BridgeInflater.java:247)     at   android.view.BridgeInflater.createViewFromTag (BridgeInflater.java:171)     at   android.view.LayoutInflater.createViewFromTag (LayoutInflater.java:704)     at android.view.LayoutInflater.inflate (LayoutInflater.java:492) at   android.view.LayoutInflater.inflate (LayoutInflater.java:394) at   com.android.layoutlib.bridge.impl.RenderSessionImpl.inflate (RenderSessionImpl.java:223)     at com.android.layoutlib.bridge.Bridge.createSession (Bridge.java:426)     at   com.android.ide.common.rendering.LayoutLibrary.createSession (LayoutLibrary.java:350)     at   com.android.tools.idea.rendering.RenderTask $ 2.compute (RenderTask.java:510)     at   com.android.tools.idea.rendering.RenderTask $ 2.compute (RenderTask.java:498)     at   com.intellij.openapi.application.impl.ApplicationImpl.runReadAction (ApplicationImpl.java:888)     at   com.android.tools.idea.rendering.RenderTask.createRenderSession (RenderTask.java:498)     at   com.android.tools.idea.rendering.RenderTask.access $ 600 (RenderTask.java:72)     at   com.android.tools.idea.rendering.RenderTask $ 3.call (RenderTask.java:610)     at   com.android.tools.idea.rendering.RenderTask $ 3.call (RenderTask.java:607)     at   com.android.tools.idea.rendering.RenderService.runRenderAction (RenderService.java:366)     at   com.android.tools.idea.rendering.RenderTask.render (RenderTask.java:607)     at   com.android.tools.idea.rendering.RenderTask.render (RenderTask.java:629)     at   com.intellij.android.designer.designSurface.AndroidDesignerEditorPanel $ 6.run (AndroidDesignerEditorPanel.java:480)     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:351) 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)

    
asked by anonymous 25.11.2015 / 22:09

2 answers

1

The error is self explanatory

  

You need to use a Theme.AppCompat theme (or descendant) with the   design library

If you are using the design library, you must use Theme Theme.AppCompat or some derivative of it.

    
25.11.2015 / 22:19
1

Use Theme.AppCompat as the parent of your themes in styles.xml

<style name="AppTheme" parent="Theme.AppCompat">
</style>
    
26.11.2015 / 02:03