Git Product home page Git Product logo

Comments (20)

jamie-beardedhen avatar jamie-beardedhen commented on July 17, 2024

I reproduced this on my machine using the artefact, but not when including as a library project. The two possibilities are that this is a bug in Android Studio, or something wrong with the library code.

Do you know if this occurs for all view previews?

from android-bootstrap.

jamie-beardedhen avatar jamie-beardedhen commented on July 17, 2024

I've included the stack trace for future reference. My initial thoughts are that the AttributeSet might be getting passed in as null which would throw an exception in initialise(). However, I'm not sure how best to test this without pushing a new release.

    at com.beardedhen.androidbootstrap.BootstrapCircleThumbnail.initialise(BootstrapCircleThumbnail.java:148)
    at com.beardedhen.androidbootstrap.BootstrapCircleThumbnail.<init>(BootstrapCircleThumbnail.java:71)
    at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
    at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:57)
    at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45)
    at java.lang.reflect.Constructor.newInstance(Constructor.java:526)
    at org.jetbrains.android.uipreview.ViewLoader.createNewInstance(ViewLoader.java:379)
    at org.jetbrains.android.uipreview.ViewLoader.loadView(ViewLoader.java:99)
    at com.android.tools.idea.rendering.LayoutlibCallback.loadView(LayoutlibCallback.java:172)
    at android.view.BridgeInflater.loadCustomView(BridgeInflater.java:207)
    at android.view.BridgeInflater.createViewFromTag(BridgeInflater.java:132)
    at android.view.LayoutInflater.rInflate_Original(LayoutInflater.java:806)
    at android.view.LayoutInflater_Delegate.rInflate(LayoutInflater_Delegate.java:64)
    at android.view.LayoutInflater.rInflate(LayoutInflater.java:782)
    at android.view.LayoutInflater.inflate(LayoutInflater.java:504)
    at android.view.LayoutInflater.inflate(LayoutInflater.java:385)
    at com.android.layoutlib.bridge.impl.RenderSessionImpl.inflate(RenderSessionImpl.java:401)
    at com.android.layoutlib.bridge.Bridge.createSession(Bridge.java:329)
    at com.android.ide.common.rendering.LayoutLibrary.createSession(LayoutLibrary.java:350)
    at com.android.tools.idea.rendering.RenderService$5.compute(RenderService.java:688)
    at com.android.tools.idea.rendering.RenderService$5.compute(RenderService.java:677)
    at com.intellij.openapi.application.impl.ApplicationImpl.runReadAction(ApplicationImpl.java:932)
    at com.android.tools.idea.rendering.RenderService.createRenderSession(RenderService.java:677)
    at com.android.tools.idea.rendering.RenderService.render(RenderService.java:815)
    at org.jetbrains.android.uipreview.AndroidLayoutPreviewToolWindowManager.doRender(AndroidLayoutPreviewToolWindowManager.java:646)
    at org.jetbrains.android.uipreview.AndroidLayoutPreviewToolWindowManager.access$1700(AndroidLayoutPreviewToolWindowManager.java:82)
    at org.jetbrains.android.uipreview.AndroidLayoutPreviewToolWindowManager$7$1.run(AndroidLayoutPreviewToolWindowManager.java:589)
    at com.intellij.openapi.progress.impl.ProgressManagerImpl$2.run(ProgressManagerImpl.java:178)
    at com.intellij.openapi.progress.ProgressManager.executeProcessUnderProgress(ProgressManager.java:209)
    at com.intellij.openapi.progress.impl.ProgressManagerImpl.executeProcessUnderProgress(ProgressManagerImpl.java:212)
    at com.intellij.openapi.progress.impl.ProgressManagerImpl.runProcess(ProgressManagerImpl.java:171)
    at org.jetbrains.android.uipreview.AndroidLayoutPreviewToolWindowManager$7.run(AndroidLayoutPreviewToolWindowManager.java:584)
    at com.intellij.util.ui.update.MergingUpdateQueue.execute(MergingUpdateQueue.java:320)
    at com.intellij.util.ui.update.MergingUpdateQueue.execute(MergingUpdateQueue.java:310)
    at com.intellij.util.ui.update.MergingUpdateQueue$2.run(MergingUpdateQueue.java:254)
    at com.intellij.util.ui.update.MergingUpdateQueue.flush(MergingUpdateQueue.java:269)
    at com.intellij.util.ui.update.MergingUpdateQueue.flush(MergingUpdateQueue.java:227)
    at com.intellij.util.ui.update.MergingUpdateQueue.run(MergingUpdateQueue.java:217)
    at com.intellij.util.concurrency.QueueProcessor.runSafely(QueueProcessor.java:238)
    at com.intellij.util.Alarm$Request$1.run(Alarm.java:327)
    at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:471)
    at java.util.concurrent.FutureTask.run(FutureTask.java:262)
    at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145)
    at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615)
    at java.lang.Thread.run(Thread.java:745)

from android-bootstrap.

fmakdemir avatar fmakdemir commented on July 17, 2024

I have an idea to what is happening as I came across this before with another attribute. Android Studio is changing the way they parse attributes. For instance they were switching enum parsing from integer to string in my previous case. My temporary solution was View.isInEditMode to check if it was in preview windows.
Error stack trace:

    at com.beardedhen.androidbootstrap.BootstrapButton.setBootstrapType(BootstrapButton.java:304)
    at com.beardedhen.androidbootstrap.BootstrapButton.initialise(BootstrapButton.java:191)
    at com.beardedhen.androidbootstrap.BootstrapButton.<init>(BootstrapButton.java:108)
    at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
    at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:57)
    at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45)
    at java.lang.reflect.Constructor.newInstance(Constructor.java:526)
    at org.jetbrains.android.uipreview.ViewLoader.createNewInstance(ViewLoader.java:379)
    at org.jetbrains.android.uipreview.ViewLoader.loadView(ViewLoader.java:99)
    at com.android.tools.idea.rendering.LayoutlibCallback.loadView(LayoutlibCallback.java:172)
    at android.view.BridgeInflater.loadCustomView(BridgeInflater.java:206)
    at android.view.BridgeInflater.createViewFromTag(BridgeInflater.java:131)
    at android.view.LayoutInflater.rInflate_Original(LayoutInflater.java:756)
    at android.view.LayoutInflater_Delegate.rInflate(LayoutInflater_Delegate.java:64)
    at android.view.LayoutInflater.rInflate(LayoutInflater.java:728)
    at android.view.LayoutInflater.inflate(LayoutInflater.java:492)
    at android.view.LayoutInflater.inflate(LayoutInflater.java:373)
    at com.android.layoutlib.bridge.impl.RenderSessionImpl.inflate(RenderSessionImpl.java:391)
    at com.android.layoutlib.bridge.Bridge.createSession(Bridge.java:337)
    at com.android.ide.common.rendering.LayoutLibrary.createSession(LayoutLibrary.java:350)
    at com.android.tools.idea.rendering.RenderService$5.compute(RenderService.java:688)
    at com.android.tools.idea.rendering.RenderService$5.compute(RenderService.java:677)
    at com.intellij.openapi.application.impl.ApplicationImpl.runReadAction(ApplicationImpl.java:932)
    at com.android.tools.idea.rendering.RenderService.createRenderSession(RenderService.java:677)
    at com.android.tools.idea.rendering.RenderService.render(RenderService.java:815)
    at org.jetbrains.android.uipreview.AndroidLayoutPreviewToolWindowManager.doRender(AndroidLayoutPreviewToolWindowManager.java:646)
    at org.jetbrains.android.uipreview.AndroidLayoutPreviewToolWindowManager.access$1700(AndroidLayoutPreviewToolWindowManager.java:82)
    at org.jetbrains.android.uipreview.AndroidLayoutPreviewToolWindowManager$7$1.run(AndroidLayoutPreviewToolWindowManager.java:589)
    at com.intellij.openapi.progress.impl.ProgressManagerImpl$2.run(ProgressManagerImpl.java:178)
    at com.intellij.openapi.progress.ProgressManager.executeProcessUnderProgress(ProgressManager.java:209)
    at com.intellij.openapi.progress.impl.ProgressManagerImpl.executeProcessUnderProgress(ProgressManagerImpl.java:212)
    at com.intellij.openapi.progress.impl.ProgressManagerImpl.runProcess(ProgressManagerImpl.java:171)
    at org.jetbrains.android.uipreview.AndroidLayoutPreviewToolWindowManager$7.run(AndroidLayoutPreviewToolWindowManager.java:584)
    at com.intellij.util.ui.update.MergingUpdateQueue.execute(MergingUpdateQueue.java:320)
    at com.intellij.util.ui.update.MergingUpdateQueue.execute(MergingUpdateQueue.java:310)
    at com.intellij.util.ui.update.MergingUpdateQueue$2.run(MergingUpdateQueue.java:254)
    at com.intellij.util.ui.update.MergingUpdateQueue.flush(MergingUpdateQueue.java:269)
    at com.intellij.util.ui.update.MergingUpdateQueue.flush(MergingUpdateQueue.java:227)
    at com.intellij.util.ui.update.MergingUpdateQueue.run(MergingUpdateQueue.java:217)
    at com.intellij.util.concurrency.QueueProcessor.runSafely(QueueProcessor.java:238)
    at com.intellij.util.Alarm$Request$1.run(Alarm.java:327)
    at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:471)
    at java.util.concurrent.FutureTask.run(FutureTask.java:262)
    at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145)
    at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615)
    at java.lang.Thread.run(Thread.java:745)

from android-bootstrap.

fmakdemir avatar fmakdemir commented on July 17, 2024

There was a way to make a local maven reporsitory but I have no experience with maven. Maybe the one that helped for current one can help with local maven as well.

from android-bootstrap.

 avatar commented on July 17, 2024

it is clear from the code that layout is null at https://github.com/Bearded-Hen/Android-Bootstrap/blob/master/AndroidBootstrap/src/com/beardedhen/androidbootstrap/BootstrapButton.java#L304

from android-bootstrap.

jamie-beardedhen avatar jamie-beardedhen commented on July 17, 2024

@lucastan it doesn't seem too obvious to me why the layout should be null at this point (and only for preview mode in AS, when using gradle dependencies). I haven't had much time to investigate this issue, so any further insight from anyone is appreciated.

from android-bootstrap.

 avatar commented on July 17, 2024

But thats what the exception stack trace indicated right? Unless the line
number is wrong

On Tuesday, December 30, 2014, jamie-beardedhen [email protected]
wrote:

@lucastan https://github.com/lucastan it doesn't seem too obvious to me
why the layout should be null at this point (and only for preview mode in
AS, when using gradle dependencies). I haven't had much time to investigate
this issue, so any further insight from anyone is appreciated.


Reply to this email directly or view it on GitHub
#76 (comment)
.

from android-bootstrap.

fmakdemir avatar fmakdemir commented on July 17, 2024

Problem is we can't reproduce the error if it is library. It is only generated when in Android studio preview and maven artifact is used. Maybe it is because inflater can't inflate maven artifact layouts

from android-bootstrap.

 avatar commented on July 17, 2024

Does it work if it is used directly as a module in android studio instead
of as a gradle/maven dependency?

On Wednesday, December 31, 2014, Fmakdemir [email protected] wrote:

Problem is we can't reproduce the error if it is library. It is only
generated when in Android studio preview and maven artifact is used. Maybe
it is because inflater can't inflate maven artifact layouts


Reply to this email directly or view it on GitHub
#76 (comment)
.

from android-bootstrap.

astigan avatar astigan commented on July 17, 2024

Yes, if you check out the example project (which uses the library source code) the preview works fine. The rendering only fails when the dependency is added via gradle.

from android-bootstrap.

mfkp avatar mfkp commented on July 17, 2024

Still experiencing this problem with AS 1.1 Preview 2.
Would be great to find a way to make it work with gradle.

from android-bootstrap.

jamie-beardedhen avatar jamie-beardedhen commented on July 17, 2024

I'm planning on setting up a local Maven repository at some point to investigate this issue. If anyone has any advice on how to do this or feels like investigating on their own machine, that would also be great.

from android-bootstrap.

jamie-beardedhen avatar jamie-beardedhen commented on July 17, 2024

I encountered a similar issue on another project and managed to stop the rendering popup by using View.isInEditMode(). This approach should work here, the only downside is that the rendering of the View might not be accurate if it can't load fonts etc.

from android-bootstrap.

jamie-beardedhen avatar jamie-beardedhen commented on July 17, 2024

Fixed as part of sample project creation

from android-bootstrap.

DeathKnightMo avatar DeathKnightMo commented on July 17, 2024

My solution is download the source and import as a module in Android Studio. In BoostrapButton.java line 185 ,there is multiple id (R.id.layout) from bootstrap_button.xml and placeholder.xml, change android id to "layout_button" in bootstrap_button.xml and change it to “R.id.layout_button” in line 185, last
build the project,it's will work fine.

from android-bootstrap.

jamie-beardedhen avatar jamie-beardedhen commented on July 17, 2024

@DeathKnightMo does this mean you're still seeing the issue in a recent version of the library?

from android-bootstrap.

DeathKnightMo avatar DeathKnightMo commented on July 17, 2024

@jamie-beardedhen yes, my android studio is v1.1.0 .

from android-bootstrap.

jamie-beardedhen avatar jamie-beardedhen commented on July 17, 2024

@DeathKnightMo weird, you're definitely using the 1.2.1 maven artefact? I've been using FontAwesomeText in an unrelated project without issue - is this only happening for certain views/layouts?

from android-bootstrap.

simonwielens avatar simonwielens commented on July 17, 2024

Seeing this issue with1.2.1 jar with android studio 1.1.0
I created a new project with Android Studio, min API level of 19, and started with a blank activity. I added the dependency and added the button xml & namespace from the readme.md and built the project

from android-bootstrap.

jamie-beardedhen avatar jamie-beardedhen commented on July 17, 2024

Is this still reproducible in v2.0.0?

from android-bootstrap.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.