I'm fairly new to Android Dev, and trying to understand how to incorporate open-source/third party extensions/plug-ins.
I've tried to include two different packages via the add to Gradle method, most recently the library at https://github.com/silvestrpredko/DotProgressBarExample/tree/master/app
which instructs to add the following Gradle dependency:
compile 'com.github.silvestrpredko:dot-progress-bar:0.1.4@aar'
Currently my Gradle looks like:
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'
}
And, as per docs I've created a layout with the following XML (relevant parties copied straight from the docs):
<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>
However, I'm getting this error:
/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
What is the correct way to incorporate these packages using custom XML?
You're missing the declaration of the custom
namespace, you can define it by adding onto your FrameLayout this attribute
xmlns:custom="http://schemas.android.com/apk/res-auto"
You must define the custom
namespace in your XML. If you look at the sample code here. You can see that in this sample the custom namespace has been declared. You should declare it too, like this:
<FrameLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
xmlns:custom="http://schemas.android.com/apk/res-auto"
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>
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With