gpt4 book ai didi

java - 添加了两个库,现在项目无法编译

转载 作者:行者123 更新时间:2023-12-01 19:50:04 24 4
gpt4 key购买 nike

我尝试关注此视频:https://www.youtube.com/watch?v=a4o9zFfyIM4在我添加了他指示添加的两个库(RecyclerView 和 CardView)后,我的项目将不再编译。从那时起,我在款式、颜色等方面犯了无数错误。我现在有这些:

  1. 未找到样式属性 attr/colorAccent
  2. 找不到样式属性/colorPrimaryDark
  3. 找不到样式属性/colorPrimary
  4. 找不到资源样式/Theme.AppCompat.Light.DarkActionBar
  5. 链接引用失败

样式.xml

<resources>

<!-- Base application theme. -->
<style name="AppTheme" parent="Theme.AppCompat.Light.DarkActionBar">
<!-- Customize your theme here. -->
<item name="colorPrimary">@color/colorPrimary</item>
<item name="colorPrimaryDark">@color/colorPrimaryDark</item>
<item name="colorAccent">@color/colorAccent</item>
</style>

颜色.xml

<?xml version="1.0" encoding="utf-8"?>
<resources>
<color name="colorPrimary">#3f51b5</color>
<color name="colorPrimaryDark">#303F9F</color>
<color name="colorAccent">#FF4081</color>

在我添加这两个库之前,该项目运行得非常好,但现在它们把一切都搞乱了。我在这里真的很绝望。提前致谢

最佳答案

试试这个方法:

  1. 打开应用模块的 build.gradle 文件。

enter image description here

  • 将支持库添加到依赖项部分。

    dependencies {
    implementation 'com.android.support:appcompat-v7:27.1.1'
    implementation 'com.android.support:recyclerview-v7:27.1.1'
    implementation 'com.android.support:cardview-v7:27.1.1'
    }
  • 进一步阅读:

    关于java - 添加了两个库,现在项目无法编译,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/51635875/

    24 4 0
    Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
    广告合作:1813099741@qq.com 6ren.com