更新时间:2023-11-19 08:57:10
我与jtwitter.jar库同样的问题。如果你运行的是Android工作室,你必须做一个干净的&放大器;建设(其中AS不真正做对了)。
I had the same issue with the jtwitter.jar library. If you're running Android Studio, you have to do a clean & build (which AS doesn't truly do right now).
转到您的命令行,导航到你的项目的根和执行 ./ gradlew干净
Go to your command line, navigate to your project root and execute ./gradlew clean
你这样做之前
请确保您的.jar文件添加到您的 /库
文件夹(如果您使用的是建立17或更高版本,它必须是库
,而不是 LIB
)。右键单击并选择的添加为图书馆... 的
Ensure that your .jar file is added to your /libs
folder (if you're using build 17 or later, it has to be libs
, and not lib
). Right-click and select Add as Library...
然后你将不得不编辑您的build.gradle文件(位于 / src目录
目录)。
Then you're going to have to edit your build.gradle file (located in your /src
directory).
这应该是这个样子:
buildscript {
repositories {
maven { url 'http://repo1.maven.org/maven2' }
}
dependencies {
classpath 'com.android.tools.build:gradle:0.4'
}
}
apply plugin: 'android'
dependencies {
compile files('libs/android-support-v4.jar')
}
android {
compileSdkVersion 17
buildToolsVersion "17.0.0"
defaultConfig {
minSdkVersion 5
targetSdkVersion 16
}
}
更改依赖
块看起来是这样的:
Change the dependencies
block to look like this:
dependencies {
compile files('libs/android-support-v4.jar')
compile files('[path/to/.jar]')
}
然后就可以生成并运行您的项目。
Then you can build and run your project.