android - IntelliJ IDEA 中 Android 项目的依赖处理

标签 android intellij-idea

我在将外部库用于我正在处理的 Android 项目时遇到问题。我正在尝试使用支持库 v7 和其他几个库。我将 jar 文件放在“libs”文件夹中,右键单击它们并单击 Add Library...

该项目编译正常,但当我制作并运行它时,会抛出一个 NoClassDefFoundError。

enter image description here

enter image description here

enter image description here

最佳答案

仅包含 jar 是不够的。

您应该将 v7-compat 作为库项目导入,并在询问包名称时告诉 IntelliJ 使用 android.support.v7.appcompat。注意 list 看起来或多或少像这样:

<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
      package="android.support.v7.appcompat">
    <uses-sdk android:minSdkVersion="7"/>
    <application />
</manifest>

导入 Android-Library 项目后,可能需要重新加载整个项目。

如果仍有问题,请将您的 appcompat-library *.iml 文件与 this file 进行比较

关于android - IntelliJ IDEA 中 Android 项目的依赖处理,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/20927200/

相关文章:

android - TextField 输入始终以大写开头

postgresql - 连接到 PostgreSQL 数据库时出现 PyCharm 错误

java spring项目没有读取所有依赖项

debugging - 如何调试 Intellij Idea 中存储为文本的 Groovy 命令

android - ADB:如何通过 ADB one liner 命令从最近的应用程序点击/关闭到完全

Android 推送通知 - Google Play

android - 更新到 Kotlin 1.3.30 会破坏 Dagger 2.21 的构建

intellij-idea - IntelliJ 根项目显示来自模块的 gradle 依赖项不可解析

java - IntelliJ IDEA 中的 Gradle 项目刷新失败

android - 多个类可以接收相同的广播接收器 Intent 吗