【发布时间】:2015-02-08 10:20:12
【问题描述】:
我从 Eclipse 导出我的项目以生成 gradle 构建文件,然后作为非 android 项目导入到 android studio。我在 gradle 文件中添加了 actionbarsherlock 依赖项并进行了同步,它总是显示
错误:找不到:com.actionbarsherlock:actionbarsherlock:4.4.0
build.gradle
buildscript {
repositories {
mavenCentral()
}
dependencies {
classpath 'com.android.tools.build:gradle:1.0.0'
}
}
apply plugin: 'com.android.application'
dependencies {
compile fileTree(dir: 'libs', include: '*.jar')
compile 'com.android.support:support-v4:21.0.3'
compile 'com.actionbarsherlock:actionbarsherlock:4.4.0@aar'
}
android {
compileSdkVersion 21
buildToolsVersion "21.1.2"
compileOptions {
sourceCompatibility JavaVersion.VERSION_1_7
targetCompatibility JavaVersion.VERSION_1_7
}
sourceSets {
main {
manifest.srcFile 'AndroidManifest.xml'
java.srcDirs = ['src']
resources.srcDirs = ['src']
aidl.srcDirs = ['src']
renderscript.srcDirs = ['src']
res.srcDirs = ['res']
assets.srcDirs = ['assets']
}
// Move the tests to tests/java, tests/res, etc...
instrumentTest.setRoot('tests')
// Move the build types to build-types/<type>
// For instance, build-types/debug/java, build-types/debug/AndroidManifest.xml, ...
// This moves them out of them default location under src/<type>/... which would
// conflict with src/ being used by the main source set.
// Adding new build types or product flavors should be accompanied
// by a similar customization.
debug.setRoot('build-types/debug')
release.setRoot('build-types/release')
}
}
如果我运行该项目,我会收到此错误
错误日志
> Could not find com.actionbarsherlock:actionbarsherlock:4.4.0.
Searched in the following locations:
file:/Applications/ADT Bundle/sdk/extras/android/m2repository/com/actionbarsherlock/actionbarsherlock/4.4.0/actionbarsherlock-4.4.0.pom
file:/Applications/ADT Bundle/sdk/extras/android/m2repository/com/actionbarsherlock/actionbarsherlock/4.4.0/actionbarsherlock-4.4.0.aar
file:/Applications/ADT Bundle/sdk/extras/google/m2repository/com/actionbarsherlock/actionbarsherlock/4.4.0/actionbarsherlock-4.4.0.pom
file:/Applications/ADT Bundle/sdk/extras/google/m2repository/com/actionbarsherlock/actionbarsherlock/4.4.0/actionbarsherlock-4.4.0.aar
我找不到任何可以帮助我解决这个问题的解决方案...
【问题讨论】:
-
看看如何在这里添加库希望这会有所帮助stackoverflow.com/questions/16577241/…
标签: android eclipse android-studio gradle