Search code examples
androidandroid-studioandroid-libraryandroid-styles

Android Studio library error: mixing versions can lead to runtime crashes and @android:style/ missing resources name


Please excuse for my bad english. I got this Error

All com.android.support libraries must use the exact same version specification (mixing versions can lead to runtime crashes). Found versions 28.0.0, 26.1.0. Examples include com.android.support:animated-vector-drawable:28.0.0 and com.android.support:support-v4:26.1.0 less... (Strg+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). Issue id: GradleCompatible

As you can see:

Build.gradle(app) screenshot

My library:

dependencies {
implementation 'com.cepheuen.elegant-number-button:lib:1.0.2'
implementation('com.github.jd-alexander:android-flat-button:v1.1')
implementation fileTree(include: ['*.jar'], dir: 'libs')
implementation 'com.android.support:appcompat-v7:28.0.0'
implementation 'com.android.support.constraint:constraint-layout:1.1.3'
implementation 'com.android.support:design:28.0.0'
testImplementation 'junit:junit:4.12'
implementation 'com.android.support:design:28.0.0'
androidTestImplementation 'com.android.support.test:runner:1.0.2'
androidTestImplementation 'com.android.support.test.espresso:espresso-core:3.0.2'
implementation 'com.google.firebase:firebase-core:16.0.6'
implementation 'com.google.firebase:firebase-database:16.0.5'
implementation 'com.rengwuxian.materialedittext:library:2.1.4'
implementation 'com.android.support:mediarouter-v7:28.0.0'
annotationProcessor("org.projectlombok:lombok:1.16.20")
compileOnly("org.projectlombok:lombok:1.16.20")
implementation 'com.android.support:cardview-v7:28.0.0'
implementation 'com.android.support:recyclerview-v7:28.0'
implementation 'com.squareup.picasso:picasso:2.5.2'
implementation 'com.firebaseui:firebase-ui-database:1.2.0'
implementation 'com.android.support:design:28.0.0'

And when I go to styles.xml and enter styleafter @android:, I get the the following error message:

Missing resource name less... (Strg+F1) Validates resource references inside Android XML files.

As you can see:

styles.xml

I want to add this code:

<style name="ExpandedAppbar" parent="@android:style/TextAppearance.Material.Title" />

I use Android Studio 3.2.1 compileSdkVersion 28 minSdkVersion 17 targetSdkVersion 28

AndroidManifest.xml:

`

<uses-permission android:name="android.permission.INTERNET" />

<application
    android:allowBackup="true"
    android:icon="@mipmap/ic_launcher"
    android:label="@string/app_name"
    android:roundIcon="@mipmap/ic_launcher_round"
    android:supportsRtl="true"
    android:theme="@style/AppTheme">
    <activity android:name=".MainActivity">
        <intent-filter>
            <action android:name="android.intent.action.MAIN" />

            <category android:name="android.intent.category.LAUNCHER" />
        </intent-filter>
    </activity>
    <activity android:name=".SignIn" />
    <activity android:name=".SignUp" />
    <activity
        android:name=".Home"
        android:label="@string/title_activity_home"
        android:theme="@style/AppTheme" />
    <activity android:name=".FoodList" />
    <activity android:name=".FoodDetail"></activity>
</application>

`

I think that both errors are related. I hope that my Informations are sufficent, and somebody can help me.

If it´s useful: I´m following this tutorial: YouTube Android Food Order App Part 3

Thanks!!:)


Solution

  • I hope this will work for you.

    For first issue:

    This issue occur because you setting somewhere 26.1.0 as library version and compileSdkVersion 26.

    If you are using 28.0.0 as your library version then use this library version where it applicable.

    Check once in every gradle file that your project have and make compileSdkVersion 28 and targetSdkVersion 28

    For second issue:

    change minSdkVersion 17 to minSdkVersion 21.