2

This was my first time using Android studio and I dont know what are those errors mean or what they implyenter image description here

[Render Problem Failed to load AppCompat ActionBar with unknown error. Missing Constraints in ConstraintLayout

This view is not constrained. It only has designtime positions, so it will jump to (0,0) at runtime unless you add the constraints The layout editor allows you to place widgets anywhere on the canvas, and it records the current position with designtime attributes (such as layout_editor_absoluteX). These attributes are not applied at runtime, so if you push your layout on a device, the widgets may appear in a different location than shown in the editor. To fix this, make sure a widget has both horizontal and vertical constraints by dragging from the edge connections.]

Render Problem

Gradle Project

enter image description here

enter image description here

Ramesh-X
  • 4,853
  • 6
  • 46
  • 67
AR_the_great
  • 23
  • 1
  • 1
  • 7

4 Answers4

13

Open, res --> values --> styles.xml, here you will find a line like this:

<!-- Base application theme. -->
<style name="AppTheme" parent="Theme.AppCompat.Light.NoActionBar">

Change DarkActionBar to NoActionBar

Prashant Pimpale
  • 10,349
  • 9
  • 44
  • 84
Arsam khan
  • 131
  • 6
  • Rather than adding unwanted dependencies, to your gradle, rendering problem notifying, java.lang.ClassNotFoundException: android.view. above mentioned way is the best solution change DarkActionBar to NoActionBar in styles.xml Apptheme. – Prasad PH Dec 05 '18 at 11:04
10

Please change com.android.support:appcompat-v7:28.0.0-alpha3 to com.android.support:appcompat-v7:28.0.0-alpha1 in build.gradle(Module: App).

And click File -> Invalidate Caches / Restart

Of course you need internet access.

It seems there is a bug in com.android.support:appcompat-v7:28.0.0-alpha3

Hossein Seifi
  • 1,380
  • 11
  • 29
  • Thanks brother! the buttons started to show up, but it gave me this error shown in the 1st image, can you also help me fix that one? "Missing Constraints in ConstraintLayout" – AR_the_great Jun 20 '18 at 05:00
  • It is not an error. It is a warning that means you have not yet set the constraint values for some views. Pay attention to Kervin Kurien's good answer. You will find how to solve it. – Hossein Seifi Jun 20 '18 at 05:15
  • I'm an android noob as well and it's the second time already I had to downgrade that appcompat thing in the build.gradle file. What is the link between this and the rendering problem ? Why the appcompat version selected by default is never stable and always alpha often with that kind of bug ? Does this bug affect everybody ? – Bogey Jammer Jul 13 '18 at 16:26
1

Missing Constraints in Constraint Layout :-

It means some constraints values are not given like distance from the top ,bottom left and right .Here's a link to solve this problem.

And another link if you want to know more about constraint layout

If you are first time using Android studio then you should start with some simple layouts like linear or relative layout.

Hardcoded text :-

Ths is not an error but a warning. As a general rule, you should never use hardcoded strings in your layout but always use string resources (which means the all strings are stored in one separate file where they are easily changeable for different languages and so on).

To convert a hard coded String to a string ressource:

1:put the curser on the hard coded string

2:press ALT + Enter

3:enter a name for your resource

4:click OK

Kevin Kurien
  • 812
  • 6
  • 14
  • Where can I find it? is on the activity_main.xml? where it says android:text="button" or on the extract resource where there is and option to change Resource name and resource value? I did that and what happened was it became "@string/add" is that correct? Thank you in advance! – AR_the_great Jun 20 '18 at 07:19
  • AR_the_great yes that should be correct . If you move your cursor on @string/add and press "ctrl" and left mouse click the it should take you to the resource file and if it doesn't then you did something wrong and if it does it is absolutely right – Kevin Kurien Jun 20 '18 at 09:13
0

Use stable version always

Always use stable version of libraries. If you are developing an app, you don't want to face these type of errors.

At the time of answering the current most stable version is 27.1.1 and second 28.0.0-rc02.

I suggest use 27.1.1 until 28 stable version release.

implementation 'com.android.support:appcompat-v7:27.1.1'
  • Sync again
  • No need of Invalidate/ Restart, Just restart would be okay. Or closing project and reopening from recent would be faster then restart.

Track the support library release.

Community
  • 1
  • 1
Khemraj Sharma
  • 57,232
  • 27
  • 203
  • 212