处理依赖于IntelliJ IDEA的Android项目 [英] Dependency handling for Android project in IntelliJ IDEA
问题描述
我使用的是外部库与Android项目我工作遇到麻烦。我试图使用支持库V7和几个其他库。我把jar文件中的库文件夹,右键单击它们,然后点击添加库...
。
I'm having trouble using external libs with a Android project I'm working on. I'm trying to use the Support Library v7 and a couple other libraries. I put the jar files in the 'libs' folder and right clicked on them and clicked Add Library...
.
该项目编译正常,但当我提出并运行它的NoClassDefFoundError异常。
The project is compiling fine but when I make and run it a NoClassDefFoundError is thrown.
推荐答案
这是不够的,包括JAR。
It is not enough to include the jar.
您应该导入V7-compat的一个库项目,并在询问了包的名字告诉的IntelliJ使用 android.support.v7.appcompat
。请注意,该清单看起来或多或少是这样的:
You should import the v7-compat as a library project and when asked for the package name tell IntelliJ to use android.support.v7.appcompat
. Take care that the manifest looks more or less like this:
<?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的库项目,可能需要重新加载整个项目后。
After importing the Android-Library project it might be necessary to reload the whole project.
如果您仍然有问题,比较这个文件
If you still have problems, compare your appcompat-library *.iml file with this file
这篇关于处理依赖于IntelliJ IDEA的Android项目的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!