When I create a new application in Android Studio, a bunch of errors immediately appear. For example:

1) Render problem: Failed to find the style of floatingActionButtonStyle in currnt theme

2) Render problem: Couldn`t reslove resource @ style / Base.Widget.Design.CoordinatorLayout

3) Using privet resources: The resource @ string / appbar_scroling_view_behavior is maked as private in com.android.support.design

4) Missing styles. Is the crrect theme chosen for this layout?

5) Failed to instantiate one or more classes

values ​​styles.xml

<resources> <!-- Base application theme. --> <style name="AppTheme" parent="Base.Theme.AppCompat.Light.DarkActionBar"> <!-- Customize your theme here. --> <item name="colorPrimary">@color/colorPrimary</item> <item name="colorPrimaryDark">@color/colorPrimaryDark</item> <item name="colorAccent">@color/colorAccent</item> </style> <style name="AppTheme.NoActionBar"> <item name="windowActionBar">false</item> <item name="windowNoTitle">true</item> <item name="coordinatorLayoutStyle">@style/Base.Widget.Design.CoordinatorLayout</item> </style> <style name="AppTheme.AppBarOverlay" parent="Base.ThemeOverlay.AppCompat.Dark.ActionBar" /> <style name="AppTheme.PopupOverlay" parent="Base.ThemeOverlay.AppCompat.Light" /> 

styles.xml (v21)

 <resources> <style name="AppTheme.NoActionBar"> <item name="windowActionBar">false</item> <item name="windowNoTitle">true</item> <item name="android:statusBarColor">@android:color/transparent</item> <item name="coordinatorLayoutStyle">@style/Base.Widget.Design.CoordinatorLayout</item> </style> 

I tried to correct the errors with these answers:

1) fix error # 1

2) fix error # 2

but does not help. When creating an application, activity_main made a type - Navigation Drawer Activity. All sdk components are loaded. Why is that? Why did I not write so many errors when I did not even write a line of code, I didn’t even add an element to it.

  • Android Studio version? What template do you use? - Serge Markov
  • implementation gradle look / show - Jarvis_J
  • If you answer your question "why?", Then the answer is simple - Android Studio is quite a buggy product. Unfortunately. - Enikeyshik
  • Try upgrading to the latest versions in the sdk manager: build tools, platform-tools ( warning! this can break other projects and / or installed programming environments that use android sdk) is a safer, but difficult option: create an empty application and add the necessary functionality by hand. - asm
  • MB are you using studio 3.2?)) It’s very raw, full of it ... - George Chebotarev

1 answer 1

Why? I also wonder why the studio developers did not set a goal for themselves to create, assemble and launch at least "Hello World" out of the box from their own blanks, without throwing problems at the head of a newcomer who is not yet familiar with the tool.
The problem is that when creating a new project, the most recent release of the API is unconditionally used - now it is 28. But at the same time, the version of the support library must correspond to the version of the API, but its release is not yet available and the studio slips the buggy unfinished alfa .
To get rid of this good it is better to lower the version until the new API is brought to mind. Open build.gradle (Module: app) and correct the corresponding lines like this:

 compileSdkVersion 27 targetSdkVersion 27 implementation 'com.android.support:appcompat-v7:27.1.1' implementation 'com.android.support:design:27.1.1' 

After you complete the synchronization (the studio itself will tell) - if you have not installed API27, an error may appear with a suggestion to install it - use.
Next from the styles, delete Base. everywhere Base. And in principle, should earn.

  • Thanks for the answer. And what is this implementation 'com.android.support:support-v4:28.0.0-alpha3' line replaced with? I have it under com.android.support:appcompat-v7:28.0.0-alpha3 . And when I replace it as you said - this support library should not use a differnt version (28) than the conpileSdkVersion (27). Replaced, by analogy, with v7: 27.1.1 and received such an error - Failed to resolve: com. android.support:support-v7:27.1.1 - xomem
  • 'com.android.support:support-v4:27.1.1' or you can remove them both altogether - they are in the design artifact and are already spelled out. - woesss
  • Thank you very much! Everything is working. And how to understand that it is already possible to switch to API 28? Where to trace when google will release a normal release of API 28? And is it necessary at all? - homem
  • there is only an error - Reander problem: failed to find the style 'coordinatorLayoutStyle' in the current theme, and a warning - missing styles. is this correct theme chosen for this layout? Although I did not change any of those - xomem
  • <item name="coordinatorLayoutStyle">@style/Widget.Support.CoordinatorLayout</item> - try this. But in general, in the styles you need to understand and design as required by the design of the application. - woesss