Render error in Android Studio 3.0 Layout Editor

后端 未结 11 2043
离开以前
离开以前 2020-11-28 07:20

I just started learning Kotlin for android development and started an empty project and added an activity. I have added the required gradle dependencies as said in Kotlin do

相关标签:
11条回答
  • 2020-11-28 07:30

    rendering failed in Android Studio android.support.v7.widget.AppCompatImageView

    Environment I was working on:
    Android Studio 3.0.1

    Cause was found to be in app/build.gradle file:

    apply plugin: 'com.android.application'
    
    android {
        compileSdkVersion 24           -----> 1
        buildToolsVersion "24.0.0"     -----> 2
    
        defaultConfig {
            applicationId "com.example.some_project"
            minSdkVersion 15
            targetSdkVersion 24        -----> 3
            versionCode 1
            versionName "1.0"
        }
        buildTypes {
            release {
                minifyEnabled false
                proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
            }
        }
    }
    
    dependencies {
        compile fileTree(dir: 'libs', include: ['*.jar'])
        compile 'com.android.support:appcompat-v7:24.0.0'        -----> 4
    }
    

    I changed some of the respective lines to be as follows:

    compileSdkVersion 26                       <------------ 1
    buildToolsVersion "26.0.3"                 <------------ 2
    
    targetSdkVersion 26                        <------------ 3
    
    compile 'com.android.support:appcompat-v7:26.1.0'  <---- 4
    

    And I didn't need to change anything in the styles.xml file. Most of the answers above had suggested to change following line:

    <style name="AppTheme" parent="Theme.AppCompat.Light">
    

    into following:

    <style name="AppTheme" parent="Base.Theme.AppCompat.Light">
    

    But I didn't want to do it. It seems like that, Google Android has moved the Theme(s) API from Base package to a more root package, when they have upgraded the API.

    0 讨论(0)
  • 2020-11-28 07:34

    I solved the issue by upgrading the gradle plugin version to 3.0.0-alpha2 and using gradle wrapper gradle-4.0-milestone-1-all.zip.

    I logged the issue in android studio issue tracker - https://issuetracker.google.com/u/1/issues/62251892

    0 讨论(0)
  • 2020-11-28 07:36

    error is :

    implementation 'com.android.support:appcompat-v7:26.0.0-beta2' 
    

    change :

    implementation 'com.android.support:appcompat-v7:26.0.0-beta1'
    
    0 讨论(0)
  • 2020-11-28 07:40

    I'm facing same issue when i tried autofill. but This will working for me. Make sure you add these dependencies:

    compile "com.android.support:support-core-utils:26.0.0-beta2"
    compile "com.android.support:support-v4:26.0.0-beta2"
    compile "com.android.support:support-v13:26.0.0-beta2"
    compile "com.android.support:appcompat-v7:26.0.0-beta2"
    compile 'com.android.support:design:26.0.0-beta2'
    

    and

    classpath 'com.android.tools.build:gradle:2.3.3'                  
    
    0 讨论(0)
  • 2020-11-28 07:41

    I also have this problem, solved as follows: modify the appcompat-v7:26.0.0-beta2 on build.gradle (modle:app) to appcompat-v7:26.0.0-beta1.

    0 讨论(0)
  • 2020-11-28 07:44

    Dude I'm also having same issue using Android Studio 3.0, I got an solution by just make some changes in style file under the value folder of res.

    Here it is...

    <!-- 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>
    

    I have added "Base." in parent to make it work properly!

    0 讨论(0)
提交回复
热议问题