Another Juan
Another Juan

Reputation: 1

cant render because of appcompat

My android studio cant seem to render properly because of the com.android.support:appcompat-v7:28.0.0-rc01 though i'm not too sure

Here's the error message that displays

All com.android.support libraries must use the exact same version specification (mixing versions can lead to runtime crashes). Found versions 28.0.0-rc01, 26.1.0. Examples include com.android.support:animated-vector-drawable:28.0.0-rc01 and com.android.support:support-media-compat:26.1.0 less... (Ctrl+F1) There are some combinations of libraries, or tools and libraries, that are incompatible, or can lead to bugs. One such incompatibility is compiling with a version of the Android support libraries that is not the latest version (or in particular, a version lower than your targetSdkVersion)

Here's my gradle build(project)

    // Top-level build file where you can add configuration options common to all sub-projects/modules.

    buildscript {

        repositories {
            google()
            jcenter()
        }
        dependencies {
            classpath 'com.android.tools.build:gradle:3.1.4'


            // NOTE: Do not place your application dependencies here; they belong
            // in the individual module build.gradle files
            classpath 'com.google.gms:google-services:4.0.1'
        }
    }

    allprojects {
        repositories {
            google()
            jcenter()
        }
    }

    task clean(type: Delete) {
        delete rootProject.buildDir
    }

and here's my gradle build(module)

//noinspection GradleCompatible
apply plugin: 'com.android.application'

android {
    compileSdkVersion 28
    defaultConfig {
        applicationId "com.example.jbdelosreyes.finalmvp"
        minSdkVersion 19
        targetSdkVersion 28
        versionCode 1
        versionName "1.0"
        testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
    }
    buildTypes {
        release {
            minifyEnabled false
            proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
        }
    }
}

dependencies {
    implementation fileTree(dir: 'libs', include: ['*.jar'])
    implementation 'com.android.support:appcompat-v7:28.0.0-rc01'
    implementation 'com.android.support.constraint:constraint-layout:1.1.2'
    implementation 'com.google.firebase:firebase-core:16.0.1'
    implementation 'com.google.firebase:firebase-firestore:17.0.4'
    testImplementation 'junit:junit:4.12'
    androidTestImplementation 'com.android.support.test:runner:1.0.2'
    androidTestImplementation 'com.android.support.test.espresso:espresso-core:3.0.2'
}

apply plugin: 'com.google.gms.google-services'

Upvotes: 0

Views: 318

Answers (3)

user8427383
user8427383

Reputation:

try it in Your build :

   buildscript {

    repositories {
    google()
    jcenter()
}
        dependencies {
    classpath 'com.android.tools.build:gradle:3.0.1'

    // NOTE: Do not place your application 
     dependencies here; they belong
    // in the individual module build.gradle files
}
      }

       allprojects {
      repositories {
    maven {
        url "https://maven.google.com"
    }

    maven { url 'https://jitpack.io' }

    google()
    jcenter()
     }
     }

      task clean(type: Delete) {
      delete rootProject.buildDir
       }

in Gradle.Build :

   apply plugin: 'com.android.application'

   android {
   compileSdkVersion 25
   buildToolsVersion "26.0.2"

    defaultConfig {
    applicationId "com.example.naser.arabic"
    minSdkVersion 15
    targetSdkVersion 25
    versionCode 1
    versionName "1.0"
    testInstrumentationRunner 
    "android.support.test.runner.AndroidJUnitRunner"
     }
     buildTypes {
     release {
        minifyEnabled true
        proguardFiles 
        getDefaultProguardFile('proguard- 
        android.txt'), 'proguard-rules.pro'
        }
        }
        sourceSets { main { assets.srcDirs = 
        ['src/main/assets', 'src/main/assets/'] } }
        compileOptions {
        targetCompatibility 1.8
         sourceCompatibility 1.8
       }
       }

      dependencies {
      compile fileTree(include: ['*.jar'], dir: 
      'libs')

           androidTestCompile('
            com.android.support.test.espresso:es 
           presso-core:2.2.2', {
              exclude group: 'com.android.support', 
        module: 
      'support-annotations'
         })
        compile 'com.android.support:appcompat- 
        v7:25.3.1'
        compile files('libs/universal-image-loader- 
        1.9.3.jar')
        compile 
         'com.android.support.constraint:constraint- 
        layout:1.0.0-alpha7'
        compile 'com.android.support:design:25.3.1'
         compile 'com.android.support:support- 
        v4:25.3.1'}

Upvotes: 0

user5484179
user5484179

Reputation:

It's more a hack than Answer.

TL;DR

This is happening because in support lib 28.0.0-rc01 there is a bug related to rending the Appcompat ActionBar with unknown error.

How to use design view until Android team fixes the bug?

  1. Goto app -> build.gradel file
  2. compileSdkVersion 27 27 not 28
  3. targetSdkVersion 27 27 not 28
  4. implementation 'com.android.support:appcompat-v7:27.1.1' 27.1.1 not 28.0.0-rc01

P.S.:- This doesn't mean that downgrading is a good option or answer but for now it is!

Upvotes: 0

Jaswant Singh
Jaswant Singh

Reputation: 10759

Set your

compileSdkVersion to 27
targetSdkVersion to 27

And

appCompat version to 

27.1.1

Upvotes: 0

Related Questions