My project can't render the layout in preview. My Android Studio version 3.1.2. Im using API 28. This my activity_main.xml
<?xml version="1.0" encoding="utf-8"?>
<android.support.constraint.ConstraintLayout
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
tools:context=".MainActivity"
android:id="@+id/frame_container">
<TextView
android:layout_width="match_parent"
android:layout_height="match_parent"
android:text="Hello World"
android:gravity="center"/>
</android.support.constraint.ConstraintLayout>
It's simple, just to print Hello World to layout, but it can't show. The error like below :
I search the solve problem, the solution is using API 26. And i try, everything is normal, preview success. But i create Fragment Activity, the problems come back, preview can't show. If you have new solution, please help me!
I met the same problem recently despite it being a wizard simple project.
I tried with 23 level (Mashmallow) without any changes. I uninstalled Android Studio, reinstalled it, it made no changes, error was still there...
Then I realized the problem was coming from a dependency (probably recently updated from Google with an error). The solution is to use the previous release.
Go to File -> Project Structure -> Modules app -> Dependencies Tab. The default used by wizard during project creation is com.android.support:appcompat-v7:28.0.0-alpha3
Simply modify to com.android.support:appcompat-v7:27.1.1
in app\res\values\styles.xml change
<style name="AppTheme" parent="Theme.AppCompat.Light.DarkActionBar">
to
<style name="AppTheme" parent="Base.Theme.AppCompat.Light.DarkActionBar">
(Render error in Android Studio 3.0 Layout Editor)
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With