Android: how to get custom XML recognized

I am new to Android Dev and trying to figure out how to enable open source extensions / third-party plugins / plugins.

I tried to include two different packages using the add method in Gradle, and most recently the libraries 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 ' 

My Gradle currently looks like this:

 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, according to the documents, I created a layout with the following XML (the corresponding sides were copied directly from the documents):

 <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 get 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 include these packages using custom XML?

+6
source share
2 answers

You are missing a custom namespace declaration, you can define it by adding this attribute to your FrameLayout

 xmlns:custom="http://schemas.android.com/apk/res-auto" 
+3
source

You must define a custom namespace in your XML. If you look at the sample code here . You can see that a custom namespace was declared in this example. You should also announce 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> 
+1
source

All Articles