尝试使用通过Android Studio 1.0 RC 2中的“项目结构”>“依赖项”窗口导入(作为Maven文件依赖项)的外部库时出现这些错误。
W/dalvikvm﹕ Unable to resolve superclass of Lcom/melnykov/fab/FloatingActionButton$1; (1487)
W/dalvikvm﹕ Link of class 'Lcom/melnykov/fab/FloatingActionButton$1;' failed
我的
build.gradle
文件:apply plugin: 'com.android.application'
android {
compileSdkVersion 21
buildToolsVersion "21.1.1"
defaultConfig {
applicationId "user.appname"
minSdkVersion 18
targetSdkVersion 21
versionCode 1
versionName "1.0"
}
compileOptions {
sourceCompatibility JavaVersion.VERSION_1_7
targetCompatibility JavaVersion.VERSION_1_7
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
}
dependencies {
compile fileTree(dir: 'libs', include: ['*.jar'])
compile 'com.android.support:appcompat-v7:21.0.2'
compile 'com.android.support:recyclerview-v7:21.0.2'
compile 'com.android.support:cardview-v7:21.0.2'
compile 'com.melnykov:floatingactionbutton:1.1.0'
}
我四处搜寻,大多数解决方案都是针对Eclipse中的项目的,涉及将Java构建路径设置为Order and Export,但是我似乎在Android Studio中找不到类似的设置。
谢谢!
最佳答案
鉴于您添加了
repositories {
mavenCentral()
}
对于您的
build.gradle
,我认为您的问题是由于gradle无法访问外部资源而引起的。您是代理人吗?
我解决了这个问题,在我的.gradle目录中添加了文件
gradle.properties
。它是这样的:systemProp.http.proxyHost=myproxy.mydomain.it
systemProp.http.proxyPort=myproxyport
systemProp.http.proxyUser=myproxyuser
systemProp.http.proxyPassword=XXXXXXXX
systemProp.https.proxyHost=myproxy.mydomain.it
systemProp.https.proxyPort=myproxyport
systemProp.https.proxyUser=myproxyuser
systemProp.https.proxyPassword=XXXXXXXX
systemProp.http.nonProxyHosts=*.nonproxyrepos.com|localhost
systemProp.https.nonProxyHosts=*.nonproxyrepos.com|localhost