我正在尝试将这个依赖项 https://github.com/hoang8f/android-flat-button 添加到我的Android Studio项目中,但我遇到了问题。
Error:(26, 13) Failed to resolve: info.hoang8f:fbutton:1.0.5
我能轻松添加 Google Play 服务的依赖,没有任何问题。
以下是我的 build.gradle 文件:
apply plugin: 'com.android.application'
android {
compileSdkVersion 22
buildToolsVersion "22.0.1"
defaultConfig {
applicationId "com.example.planner"
minSdkVersion 15
targetSdkVersion 22
versionCode 1
versionName "1.0"
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
}
dependencies {
compile fileTree(include: ['*.jar'], dir: 'libs')
compile 'com.android.support:appcompat-v7:22.2.1'
compile 'com.google.android.gms:play-services:7.5.0'
compile 'info.hoang8f:fbutton:1.0.5'
}
尝试的解决方案:1)Gradle处于在线模式而非离线模式。2)清理并构建/重建项目。3)更改为。
repositories {
mavenCentral()
}
在我的根gradle文件中
4.)工具->android->与gradle文件同步项目
仍然没有成功使其起作用。
P.S.:尽管这不影响问题,但我在尝试通过gradle添加解析sdk时遇到了同样的问题,因此我独立地添加了jar文件。
build.gradle
中添加了compile 'info.hoang8f:fbutton:1.0.5'
,并且它正常工作,你可以尝试Build-> Rebuild project
。 - tianyu