The solution to this problem depends on the version of the Android support library you're using:
Support library 26.0.0-beta2
This android support library version has a bug causing the mentioned problem
In your Gradle build file use:
compile 'com.android.support:appcompat-v7:26.0.0'
with:
buildToolsVersion '26.0.0'
and
classpath 'com.android.tools.build:gradle:3.0.0-alpha8'
everything should work fine now.
Library version 28 (beta)
These new versions seem to suffer from similar difficulties again.
In your res/values/styles.xml
modify the AppTheme
style from
<style name="AppTheme" parent="Theme.AppCompat.Light.DarkActionBar">
to
<style name="AppTheme" parent="Base.Theme.AppCompat.Light.DarkActionBar">
(note the added Base.
)
Or alternatively downgrade the library until the problem is fixed:
implementation 'com.android.support:appcompat-v7:28.0.0-alpha1'
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…