android studio 导入viewpagerindicator,Gradle – 无法使用gradle依赖项在Android Studio中导入viewpagerindicator...

所以我试图使用actionbarsherlock和viewpagerindicator,由于某种原因,viewpagerindicator库由于某种原因没有导入.任何人都有任何想法?

apply plugin: 'android'

android {

compileSdkVersion 19

buildToolsVersion "19.0.1"

defaultConfig {

minSdkVersion 9

targetSdkVersion 19

versionCode 1

versionName "1.0"

}

buildTypes {

release {

runProguard false

proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.txt'

}

}

}

repositories {

mavenCentral()

}

dependencies {

compile 'com.actionbarsherlock:actionbarsherlock:4.4.0@aar'

compile 'com.viewpagerindicator:library:2.4.0'

}

dependencies {

compile project(':libraries:facebook')

}

此导入错误“无法解析符号viewpageindicator

import com.viewpagerindicator.TabPageIndicator;

这些是我的“消息gradle任务”

Execution failed for task ':app:processDebugResources'.

> com.android.ide.common.internal.LoggedErrorException: Failed to run command:

C:\android-sdk\build-tools\19.0.1\aapt.exe package -f --no-crunch -I C:\android-sdk\platforms\android-19\android.jar -M C:\myAppName\app\build\manifests\debug\AndroidManifest.xml -S C:\myAppName\app\build\res\all\debug -A C:\myAppName\app\build\assets\debug -m -J C:\myAppName\app\build\source\r\debug -F C:\myAppName\app\build\libs\app-debug.ap_ --debug-mode --custom-package com.myAppName.app --output-text-symbols C:\myAppName\app\build\symbols\debug

Error Code:

1

Output:

C:\myAppName\app\build\res\all\debug\values\values.xml:911: error: Error: No resource found that matches the given name: attr 'vpiTabPageIndicatorStyle'.

C:\myAppName\app\build\res\all\debug\values\values.xml:914: error: Error retrieving parent for item: No resource found that matches the given name 'Widget.TabPageIndicator'.

C:\myAppName\app\build\res\all\debug\values\values.xml:934: error: Error: No resource found that matches the given name: attr 'fadeDelay'.

C:\myAppName\app\build\res\all\debug\values\values.xml:933: error: Error: No resource found that matches the given name: attr 'fadeLength'.

C:\myAppName\app\build\res\all\debug\values\values.xml:931: error: Error: No resource found that matches the given name: attr 'selectedColor'.

C:\myAppName\app\src\main\res\values\styles.xml

No resource found that matches the given name: attr 'vpiTabPageIndicatorStyle'.

Error retrieving parent for item: No resource found that matches the given name 'Widget.TabPageIndicator'.

No resource found that matches the given name: attr 'fadeDelay'.

No resource found that matches the given name: attr 'fadeLength'.

No resource found that matches the given name: attr 'selectedColor'.

解决方法:

您无法通过导入ViewPagerIndicator

compile 'com.viewpagerindicator:library:2.4.0'

因为Maven工件只是Java库的一个jar,但是VPI依赖于jar中没有的Android资源.

具有AAR打包的Maven工件确实具有资源并且可以工作,但VPI不是这样打包的.它有apklib包装,但Android Gradle插件不支持.

您需要下载源代码并将其设置为android-library模块.

您没有具体说明您正在运行的Android Studio版本,但我愿意打赌您导入的问题不起作用的原因是您运行的是早于0.4.3的内容;从那时起,该区域就已经修复了错误.

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值