0

Ever since the new repositories after com.android.support:appcompat-v7:28.0.0-alpha1 launched by google, all have failed to work when it comes to proper preview of the layout. I am forced to use com.android.support:appcompat-v7:28.0.0-alpha1 i.e. alpha1 in spite of the availability of new repositories such as

28.0.0-rc02 
28.0.0-rc01 
28.0.0-beta01   
28.0.0-alpha3

whenever i try to use any of the above mentioned ones i get the following error: enter image description here

Also i have already tried changing layout but none seem to work. Here is my gradle file:

apply plugin: 'com.android.application'

android {
    compileSdkVersion 28
    defaultConfig {
        applicationId "com.example.rish.myapplication"
        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-rc02'
    implementation 'com.android.support.constraint:constraint-layout:1.1.3'
    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'
}

Not that any other functionality in Android Studio is affected(as far as i have noticed) as the compiled app still runs properly but working without a preview is hard.

I know that similar questions are already out there but none of those things make sense except changing repository version. I wonder if this my PC's problem or has it something to do with google devs.?

OneCricketeer
  • 179,855
  • 19
  • 132
  • 245
Kebrum Otis
  • 25
  • 1
  • 6

4 Answers4

2

I fixed this problem by downloading all SDK versions that my app was using, it turned out that version 28 was not fully installed!

Kofmev
  • 21
  • 2
  • As of now the issue is fixed. Using `com.android.support:appcompat-v7:28.0.0` (this is stable is and now being used by Android Studio) instead of `com.android.support:appcompat-v7:28.0.0-XXXX` (`XXXX` being `rc` or `beta`) would solve the problem – Kebrum Otis Feb 14 '19 at 15:04
0

It looks there are some bugs in api 28 try to reduce it to api 27. make your compileSdkVersion to 27

compileSdkVersion 27

and your targetSdkVersion to 27

targetSdkVersion 27

and also

implementation 'com.android.support:appcompat-v7:27.1.1'

full code

apply plugin: 'com.android.application'

android {
compileSdkVersion 27
defaultConfig {
    applicationId "com.example.rish.myapplication"
    minSdkVersion 19
    targetSdkVersion 27
    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:27.1.1'
implementation 'com.android.support.constraint:constraint-layout:1.1.3'
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'
}

It works fine for me

otherwise change your theme to light it also worked for me.

I changed my style to Theme.AppCompat.Light.DarkActionBar

    <!-- Base application theme. -->
<style name="AppTheme" parent="Base.Theme.AppCompat.Light.DarkActionBar">
    <!-- Customize your theme here. -->
</style>

You can try any of Theme.AppCompat.Light style all works fine Don't also forget to change your theme from xml layout file and manifest file then rendering problem will gone.

0

Had the same problem and solved it by changing value in R.values.styles.xml.

 <style name="AppTheme"  
    parent="Base.Theme.AppCompat.Light.DarkActionBar">
  <!--customize your theme here-->
  </style>
0

As of now the issue is fixed. Using com.android.support:appcompat-v7:28.0.0 (this is stable is and now being used by Android Studio) instead of com.android.support:appcompat-v7:28.0.0-XXXX (XXXX being rc or beta) would solve the problem

Kebrum Otis
  • 25
  • 1
  • 6