我对Android Dev还是相当陌生,并试图了解如何合并开源/第三方扩展/插件。
我试图通过add to Gradle方法包括两个不同的包,最近的库在https://github.com/silvestrpredko/DotProgressBarExample/tree/master/app
它指示添加以下Gradle依赖项:
compile 'com.github.silvestrpredko:dot-progress-bar:0.1.4@aar'
目前,我的Gradle如下所示:
apply plugin: 'com.android.application'
android {
compileSdkVersion 23
buildToolsVersion "23.0.3"
defaultConfig {
applicationId "com.e.crispens.tuna"
minSdkVersion 16
targetSdkVersion 23
versionCode 1
versionName "1.0"
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
}
repositories {
jcenter()
}
dependencies {
compile fileTree(dir: 'libs', include: ['*.jar'])
testCompile 'junit:junit:4.12'
compile 'com.android.support:appcompat-v7:23.4.0'
compile 'com.android.support:support-v4:23.4.0'
compile 'com.github.silvestrpredko:dot-progress-bar:0.1.4@aar'
}
而且,根据文档,我使用以下XML创建了布局(相关各方直接从文档中复制):
<FrameLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
tools:context="com.e.crispens.tuna.StringFragment">
<com.github.silvestrpredko.dotprogressbar.DotProgressBar
android:id="@+id/dot_progress_bar"
android:layout_width="match_parent"
android:layout_height="50dp"
custom:amount="5"
custom:duration="@android:integer/config_mediumAnimTime"
custom:endColor="@color/light_blue_A400"
custom:startColor="@color/light_blue_A700"/>
</FrameLayout>
但是,我收到此错误:
/Users/crispensmith/AndroidStudioProjects/Tuna/app/src/main/res/layout/fragment_string.xml
Error:(7) Error parsing XML: unbound prefix
Error:Execution failed for task ':app:processDebugResources'.
> com.android.ide.common.process.ProcessException: org.gradle.process.internal.ExecException: Process 'command '/Users/crispensmith/Library/Android/sdk/build-tools/23.0.3/aapt'' finished with non-zero exit value 1
使用自定义XML合并这些软件包的正确方法是什么?
您缺少custom
名称空间的声明,可以通过在FrameLayout上添加此属性来对其进行定义
xmlns:custom="http://schemas.android.com/apk/res-auto"
本文收集自互联网,转载请注明来源。
如有侵权,请联系 [email protected] 删除。
我来说两句