Android Studio 3.1 Does Not Render Xml File Due To A Java Class Missing
Solution 1:
Yes, it happens. You can fix it easily.
First Method: Open build.gradle(Module: app) under Gradle Scripts and change version alpha3 to alpha1 and Sync now
implementation 'com.android.support:appcompat-v7:28.0.0-alpha1'
Second Method: Open style.xml under res -> values -> style.xml and change this line
style name="AppTheme" parent="Theme.AppCompat.Light.DarkActionBar">
put Base.
before Theme.AppCompat.Light.DarkActionBar like
style name="AppTheme" parent="Base.Theme.AppCompat.Light.DarkActionBar">
Hope problem will be solved.
Solution 2:
- Use Alpha/Beta at your Own Risk
- You are developing an app, so you don't want to face these types of issues. So I suggest you use always stable version of every dependency.
The issue you faced was due to using alpha version of AppCompat library. Use stable version to get rid of this issue now and in future.
1. Use android.support
stable version
Currently 27.1.1 is latest version of AppComactV7. You can see Maven Repo link to find out latest.
final def SUPPORT_VERSION = "27.1.1"
implementation "com.android.support:appcompat-v7:$SUPPORT_VERSION"
implementation "com.android.support:design:$SUPPORT_VERSION"// use only if already using
I use definitions to have same version for all support versions. Also ignore design library if you are not already using it.
2. Downgrade compileSdkVersion
and targetSdkVersion
(Optional)
You also need to downgrade your compileSdkVersion
& targetSdkVersion
to remove some gradle warnings.
so use below versions
compileSdkVersion 27
targetSdkVersion 27
Read about Alpha & Beta releases.
Solution 3:
Go to Gradle scripts>build.gradle(module app) > change 'com.android.support:appcompat-v7:28.0.0-alpha3' to 'com.android.support:appcompat-v7:28.0.0-alpha1'
You may have something other than alpha3 after "-v7:28.0.0-" whatever it is just change it to alpha1.
Solution 4:
You can fix it easily.
Open build.gradle(Module: app) under Gradle Scripts and update the version of appcompat to given below and Sync now
implementation 'com.android.support:appcompat-v7:28.0.0-alpha1'
Solution 5:
Use:
implementation 'com.android.support:appcompat-v7:27.1.1'
and of course
compileSdkVersion 27
Until version 28 full ver comes!
Post a Comment for "Android Studio 3.1 Does Not Render Xml File Due To A Java Class Missing"