【问题标题】:Android Studio library error: mixing versions can lead to runtime crashes and @android:style/ missing resources nameAndroid Studio 库错误:混合版本可能导致运行时崩溃和@android:style/ 缺少资源名称
【发布时间】:2018-12-27 00:03:11
【问题描述】:

请原谅我的英语不好。我收到了这个错误

所有 com.android.support 库必须使用完全相同的版本规范(混合版本可能导致运行时崩溃)。找到版本 28.0.0、26.1.0。示例包括 com.android.support:animated-vector-drawable:28.0.0 和 com.android.support:support-v4:26.1.0 less... (Strg+F1) 有一些库或工具和库的组合不兼容,或者可能导致错误。一种这样的不兼容性是使用不是最新版本的 Android 支持库版本(或者特别是低于您的 targetSdkVersion 的版本)进行编译。问题 ID:GradleCompatible

如你所见:

Build.gradle(app) screenshot

我的图书馆:

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'

当我转到styles.xml 并在@android: 之后输入style时,我收到以下错误消息:

缺少资源名称 less... (Strg+F1) 验证 Android XML 文件中的资源引用。

如你所见:

styles.xml

我想添加这段代码:

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

我使用 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>

`

我认为这两个错误是相关的。我希望我的信息足够,有人可以帮助我。

如果有用:我正在关注本教程:YouTube Android Food Order App Part 3

谢谢!!:)

【问题讨论】:

  • &lt;style name="ExpandedAppbar" parent="@android:style/" /&gt; 在这行代码中,你能输入父级的内容吗?只是为了确定原因是否可以复制。 android studio 显示此类错误的原因有很多。我们需要非常具体地说明您要发送的内容,以便我们看到。另一方面,当我定义父母时,我仍然看到错误。
  • @Ronan 对不起,谢谢!我刚刚更正了!
  • @android:style/TextAppearance.Material.Titel 将其更改为 @android:style/TextAppearance.Material.Title。有错别字吗?让我知道我在这里。另外,请提供您的基本主题(应用程序和 AndroidManifest.xml 代码),以便我们判断问题
  • @Ronan 是的,错字。已经完成了。 :D
  • 您尝试运行代码了吗?另外,把 AndroidManifest.xml 文件扔到你的帖子里,否则我可能帮不了你!

标签: android android-studio android-library android-styles


【解决方案1】:

我希望这对你有用。

第一期:

出现此问题是因为您将某处设置为 26.1.0 作为库版本和 compileSdkVersion 26

如果您使用 28.0.0 作为库版本,请在适用的情况下使用此库版本。

在您的项目拥有的每个 gradle 文件中检查一次并生成 compileSdkVersion 28targetSdkVersion 28

第二期:

minSdkVersion 17 更改为minSdkVersion 21

【讨论】:

    猜你喜欢
    • 2017-08-15
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2019-06-27
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多