【发布时间】:2025-11-20 16:30:01
【问题描述】:
我正在尝试将此依赖项 https://github.com/hoang8f/android-flat-button 添加到我的 android studio 项目中,我得到了
Error:(26, 13) Failed to resolve: info.hoang8f:fbutton:1.0.5
我可以轻松添加 google play services 依赖项,没有任何问题。
下面是我的 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 添加 parse sdk 时遇到了同样的问题,所以我单独添加了 jar 文件。
【问题讨论】:
-
我在我的
build.gradle中添加了compile 'info.hoang8f:fbutton:1.0.5',没关系,你可以试试Build->Rebuild project。 -
正如我在问题中所说,我已经清理/重建了项目,我的旧项目运行良好,只是新项目出现了这个问题
-
愚蠢的问题,但我需要问?这个库真的有必要吗?我认为您可以像这里一样制作自己的平面按钮*.com/questions/26346727/…
-
它不仅仅是关于“这个”库,当我尝试添加另一个库时,它会影响到我