无法在android studio中添加依赖项
我将我的项目从eclipse导出到Generate gradle构建文件,然后作为非android项目导入到android studio。我将actionbarsherlock依赖项添加到gradle文件中并同步,它始终显示 错误:未能找到:com.actionbarsherlock:actionbarsherlock:4.4.0 build.gradle无法在android studio中添加依赖项,android,eclipse,android-studio,gradle,Android,Eclipse,Android Studio,Gradle,我将我的项目从eclipse导出到Generate gradle构建文件,然后作为非android项目导入到android studio。我将actionbarsherlock依赖项添加到gradle文件中并同步,它始终显示 错误:未能找到:com.actionbarsherlock:actionbarsherlock:4.4.0 build.gradle buildscript { repositories { mavenCentral()
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')
}
}
我找不到任何有助于解决此问题的解决方案…您是否在Android Studio中再次尝试导入ABS?我不确定您以前的eclipse项目的导入是否会在Android Studio中生效。
您可以尝试“文件->项目结构”,然后单击“添加”按钮再次添加ABS。请参阅如何在此处添加库,希望这会有所帮助
> 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