Android Bootstrap Button(or any other Bootstrap widget) not working as it should

1.2k Views Asked by At

Hello friends I just imported the AndroidBootstrap module into my Android Project, and I end up with this :

app build.gradle :

apply plugin: 'com.android.application'

android {
    compileSdkVersion 23
    buildToolsVersion "23.0.3"
    useLibrary 'org.apache.http.legacy'

    defaultConfig {
        applicationId "com.mab.myresto"
        minSdkVersion 15
        targetSdkVersion 23
        versionCode 1
        versionName "1.0"
    }
    buildTypes {
        release {
            minifyEnabled false
            proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
        }
    }
}

dependencies {
    compile project (':AndroidBootstrap') // replace with Maven dependency in your app

    compile fileTree(dir: 'libs', include: ['*.jar'])
    testCompile 'junit:junit:4.12'
    compile 'com.android.support:appcompat-v7:23.4.0'
}

AndroidBootstrap build.gradle :

apply plugin: 'com.android.library'

android {
    compileSdkVersion 23
    buildToolsVersion "23.0.3"

    defaultConfig {
        minSdkVersion 14
        targetSdkVersion 23
        versionCode  1
        versionName  "1.0"
    }
}

dependencies {
    compile 'com.android.support:support-annotations:23.3.0'
    compile 'com.android.support:support-v4:23.3.0'
}

I removed this line apply from: 'push.gradle' from it as I saw in someother questions because with it, the gradle builde gives errors.

And my Activity Layout is something like this :

<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:tools="http://schemas.android.com/tools"
    xmlns:app="http://schemas.android.com/apk/res-auto"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:paddingBottom="@dimen/activity_vertical_margin"
    android:paddingLeft="@dimen/activity_horizontal_margin"
    android:paddingRight="@dimen/activity_horizontal_margin"
    android:paddingTop="@dimen/activity_vertical_margin"
    tools:context="com.mab.myresto.Login">

    <com.beardedhen.androidbootstrap.BootstrapButton
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:text="Se Connecter"
        app:bootstrapBrand="success"
        app:bootstrapSize="lg"
        app:buttonMode="regular"
        app:showOutline="false"
        app:roundedCorners="true"
        android:id="@+id/Btn_Connecter"
        android:layout_gravity="center_horizontal"
        android:layout_centerVertical="true"
        android:layout_centerHorizontal="true" />

</RelativeLayout>

But the button is not displayed as it should. I really dont know where the problem is, and the gradle builiding is just fine no errors ...

Thanks.

--- Edit ---

I just got this Rendedring error :

The following classes could not be instantiated:
- com.beardedhen.androidbootstrap.BootstrapButton (Open Class, Show Exception, Clear Cache)

Details :

android.content.res.Resources$NotFoundException: Could not resolve resource value: 0x7F02000D.
    at android.content.res.Resources_Delegate.throwException(Resources_Delegate.java:871)
    at android.content.res.Resources_Delegate.getColorStateList(Resources_Delegate.java:199)
    at android.content.res.Resources_Delegate.getColor(Resources_Delegate.java:176)
    at android.content.res.Resources.getColor(Resources.java:958)
    at com.beardedhen.androidbootstrap.utils.ColorUtils.resolveColor(ColorUtils.java:29)
    at com.beardedhen.androidbootstrap.api.defaults.DefaultBootstrapBrand.defaultFill(DefaultBootstrapBrand.java:66)
    at com.beardedhen.androidbootstrap.AwesomeTextView.updateBootstrapState(AwesomeTextView.java:231)
    at com.beardedhen.androidbootstrap.BootstrapButton.updateBootstrapState(BootstrapButton.java:149)
    at com.beardedhen.androidbootstrap.AwesomeTextView.initialise(AwesomeTextView.java:113)
    at com.beardedhen.androidbootstrap.AwesomeTextView.<init>(AwesomeTextView.java:68)
    at com.beardedhen.androidbootstrap.BootstrapButton.<init>(BootstrapButton.java:66)
    at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
    at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:62)
    at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45)
    at java.lang.reflect.Constructor.newInstance(Constructor.java:422)
    at org.jetbrains.android.uipreview.ViewLoader.createNewInstance(ViewLoader.java:465)
    at org.jetbrains.android.uipreview.ViewLoader.loadClass(ViewLoader.java:172)
    at org.jetbrains.android.uipreview.ViewLoader.loadView(ViewLoader.java:105)
    at com.android.tools.idea.rendering.LayoutlibCallbackImpl.loadView(LayoutlibCallbackImpl.java:176)
    at android.view.BridgeInflater.loadCustomView(BridgeInflater.java:247)
    at android.view.BridgeInflater.createViewFromTag(BridgeInflater.java:171)
    at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:704)
    at android.view.LayoutInflater.rInflate_Original(LayoutInflater.java:835)
    at android.view.LayoutInflater_Delegate.rInflate(LayoutInflater_Delegate.java:70)
    at android.view.LayoutInflater.rInflate(LayoutInflater.java:811)
    at android.view.LayoutInflater.rInflateChildren(LayoutInflater.java:798)
    at android.view.LayoutInflater.inflate(LayoutInflater.java:515)
    at android.view.LayoutInflater.inflate(LayoutInflater.java:394)
    at com.android.layoutlib.bridge.impl.RenderSessionImpl.inflate(RenderSessionImpl.java:229)
    at com.android.layoutlib.bridge.Bridge.createSession(Bridge.java:426)
    at com.android.ide.common.rendering.LayoutLibrary.createSession(LayoutLibrary.java:350)
    at com.android.tools.idea.rendering.RenderTask$2.compute(RenderTask.java:520)
    at com.android.tools.idea.rendering.RenderTask$2.compute(RenderTask.java:508)
    at com.intellij.openapi.application.impl.ApplicationImpl.runReadAction(ApplicationImpl.java:967)
    at com.android.tools.idea.rendering.RenderTask.createRenderSession(RenderTask.java:508)
    at com.android.tools.idea.rendering.RenderTask.access$600(RenderTask.java:75)
    at com.android.tools.idea.rendering.RenderTask$3.call(RenderTask.java:620)
    at com.android.tools.idea.rendering.RenderTask$3.call(RenderTask.java:617)
    at com.android.tools.idea.rendering.RenderService.runRenderAction(RenderService.java:371)
    at com.android.tools.idea.rendering.RenderTask.render(RenderTask.java:617)
    at com.android.tools.idea.rendering.RenderTask.render(RenderTask.java:639)
    at com.intellij.android.designer.designSurface.AndroidDesignerEditorPanel$7.run(AndroidDesignerEditorPanel.java:519)
    at com.intellij.util.ui.update.MergingUpdateQueue.execute(MergingUpdateQueue.java:337)
    at com.intellij.util.ui.update.MergingUpdateQueue.execute(MergingUpdateQueue.java:327)
    at com.intellij.util.ui.update.MergingUpdateQueue$3.run(MergingUpdateQueue.java:271)
    at com.intellij.util.ui.update.MergingUpdateQueue.flush(MergingUpdateQueue.java:286)
    at com.intellij.util.ui.update.MergingUpdateQueue.flush(MergingUpdateQueue.java:244)
    at com.intellij.util.ui.update.MergingUpdateQueue.run(MergingUpdateQueue.java:234)
    at com.intellij.util.concurrency.QueueProcessor.runSafely(QueueProcessor.java:238)
    at com.intellij.util.Alarm$Request$1.run(Alarm.java:352)
    at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511)
    at java.util.concurrent.FutureTask.run(FutureTask.java:266)
    at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
    at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
    at java.lang.Thread.run(Thread.java:745)
1

There are 1 best solutions below

0
On BEST ANSWER

It seems there is no problem at all, it was just a bug, running the AVD somehow fixed it ...