Start a new topic
Solved

Adding ArchitectView to layout causes app to crash

Adding ArchitectView to layout causes app to crash


I seem to be falling at the first hurdle.  I've followed the project setup steps in the documentation, but if I add an ArchitectView to the layout then the app crashes almost immediately (I see the black rectangle for the view, and then a crash).  I haven't added any code to the activity to remove that as a source of potential problems.  The layout is very simply:

<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout 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" android:paddingLeft="@dimen/activity_horizontal_margin"
android:paddingRight="@dimen/activity_horizontal_margin"
android:paddingTop="@dimen/activity_vertical_margin"
android:paddingBottom="@dimen/activity_vertical_margin" tools:context=".MainActivity"
android:id="@+id/baseLayout">

<com.wikitude.architect.ArchitectView android:id="@+id/architectView"
android:layout_width="fill_parent" android:layout_height="fill_parent"/>

</RelativeLayout>


 

There doesn't seem to be a meaningful error:

01-27 11:36:38.363 32164-32164/org.spaceskills.wikitudeapp W/ResourceType: Failure getting entry for 0x01080ac3 (t=7 e=2755) (error -75)
01-27 11:36:38.388 32164-32164/org.spaceskills.wikitudeapp D/PhoneWindow: *FMB* installDecor mIsFloating : false
01-27 11:36:38.388 32164-32164/org.spaceskills.wikitudeapp D/PhoneWindow: *FMB* installDecor flags : -2139029248
01-27 11:36:38.553 32164-32164/org.spaceskills.wikitudeapp I/WebViewFactory: Loading com.google.android.webview version 37 (1726107-arm) (code 119201)
01-27 11:36:38.563 32164-32164/org.spaceskills.wikitudeapp I/LibraryLoader: Loading: webviewchromium
01-27 11:36:38.568 32164-32164/org.spaceskills.wikitudeapp I/LibraryLoader: Time to load native libraries: 6 ms (timestamps 8157-8163)
01-27 11:36:38.568 32164-32164/org.spaceskills.wikitudeapp I/LibraryLoader: Expected native library version number "",actual native library version number ""
01-27 11:36:38.578 32164-32164/org.spaceskills.wikitudeapp W/ResourceType: Failure getting entry for 0x01080ac3 (t=7 e=2755) (error -75)
01-27 11:36:38.583 32164-32164/org.spaceskills.wikitudeapp V/WebViewChromiumFactoryProvider: Binding Chromium to main looper Looper (main, tid 1) {131085e}
01-27 11:36:38.583 32164-32164/org.spaceskills.wikitudeapp I/LibraryLoader: Expected native library version number "",actual native library version number ""
01-27 11:36:38.583 32164-32164/org.spaceskills.wikitudeapp I/chromium: Chromium logging enabled: level = 0, default verbosity = 0
01-27 11:36:38.603 32164-32164/org.spaceskills.wikitudeapp I/BrowserStartupController: Initializing chromium process, renderers=0
01-27 11:36:38.608 32164-32164/org.spaceskills.wikitudeapp W/art: Attempt to remove local handle scope entry from IRT, ignoring
01-27 11:36:38.618 32164-32164/org.spaceskills.wikitudeapp W/chromium: locale_file_path.empty()
01-27 11:36:38.623 32164-32164/org.spaceskills.wikitudeapp I/chromium: Load from apk succesful, fd=41 off=43776 len=2945
01-27 11:36:38.623 32164-32164/org.spaceskills.wikitudeapp I/chromium: Loading webviewchromium.pak from, fd:42 off:229524 len:643667
01-27 11:36:38.623 32164-32202/org.spaceskills.wikitudeapp W/AudioManagerAndroid: Requires BLUETOOTH permission
01-27 11:36:38.648 32164-32164/org.spaceskills.wikitudeapp I/: PLATFORM VERSION : JB-MR-2
01-27 11:36:38.718 32164-32208/org.spaceskills.wikitudeapp W/chromium: PAC support disabled because there is no system implementation
01-27 11:36:38.718 32164-32164/org.spaceskills.wikitudeapp W/chromium: SPDY proxy OFF at startup
01-27 11:36:38.738 32164-32164/org.spaceskills.wikitudeapp W/art: Attempt to remove local handle scope entry from IRT, ignoring
01-27 11:36:38.743 32164-32164/org.spaceskills.wikitudeapp W/AwContents: onDetachedFromWindow called when already detached. Ignoring
01-27 11:36:38.753 32164-32164/org.spaceskills.wikitudeapp W/art: Attempt to remove local handle scope entry from IRT, ignoring
01-27 11:36:38.753 32164-32164/org.spaceskills.wikitudeapp W/art: Attempt to remove local handle scope entry from IRT, ignoring
01-27 11:36:38.753 32164-32164/org.spaceskills.wikitudeapp W/art: Attempt to remove local handle scope entry from IRT, ignoring
01-27 11:36:38.753 32164-32164/org.spaceskills.wikitudeapp W/art: Attempt to remove local handle scope entry from IRT, ignoring
01-27 11:36:38.763 32164-32225/org.spaceskills.wikitudeapp D/OpenGLRenderer: Render dirty regions requested: true
01-27 11:36:38.768 32164-32164/org.spaceskills.wikitudeapp D/Atlas: Validating map...
01-27 11:36:38.783 32164-32164/org.spaceskills.wikitudeapp D/PhoneWindow: *FMB* isFloatingMenuEnabled mFloatingMenuBtn : null
01-27 11:36:38.783 32164-32164/org.spaceskills.wikitudeapp D/PhoneWindow: *FMB* isFloatingMenuEnabled return false
01-27 11:36:38.803 32164-32225/org.spaceskills.wikitudeapp I/OpenGLRenderer: Initialized EGL, version 1.4
01-27 11:36:38.818 32164-32225/org.spaceskills.wikitudeapp I/OpenGLRenderer: HWUI protection enabled for context ,  &this =0x9ea8e088 ,&mEglDisplay = 1 , &mEglConfig = -1281944652
01-27 11:36:38.823 32164-32225/org.spaceskills.wikitudeapp D/OpenGLRenderer: Get maximum texture size. GL_MAX_TEXTURE_SIZE is 8192
01-27 11:36:38.823 32164-32225/org.spaceskills.wikitudeapp D/OpenGLRenderer: Enabling debug mode 0
01-27 11:36:38.903 32164-32195/org.spaceskills.wikitudeapp A/libc: Fatal signal 11 (SIGSEGV), code 1, fault addr 0x6576697c in tid 32195 (GLThread 3888)
01-27 11:36:38.938 32164-32164/org.spaceskills.wikitudeapp I/Timeline: Timeline: Activity_idle id: android.os.BinderProxy@c3da103 time:12068531

 

The device that I'm testing on is a Samsung Tab S, Android 5.0.2, and ArchitectView.isDeviceSupported returns true.  The sample apk file included with the SDK also works fine.

Hi Matthew,

Please compare your layout set-up with the one from the sample app and check the Android documentation section for further details on the set-up.

Greetings

Nicola

Hi Nicola,

Thanks for your quick reply.  It was the steps in the Android documentation section that I followed.  I've been over it a few times, and I'm pretty sure that I've covered all of the steps (the uses-sdk line in the manifest was slightly outdated).

Only two layouts seemed to include the ArchitectView (sample_1.xml and sample_cam.xml).  I've tried swapping those in, but I get the exact same result.

 

If it helps there is an error when I switch to the design view in Android Studio; but I wasn't sure if it was supposed to be able to preview there:

 

java.lang.VerifyError: Expecting a stackmap frame at branch target 12
Exception Details:
  Location:
    com/wikitude/architect/ArchitectView.<clinit>()V @5: ifne
  Reason:
    Expected stackmap frame at this location.
  Bytecode:
    0x0000000: 1202 b605 d39a 0007 04a7 0004 03b3 04f9
    0x0000010: 1202 b605 d6b3 021d b805 d8b3 00d0 b1  

    at java.lang.Class.getDeclaredConstructors0(Native Method)
    at java.lang.Class.privateGetDeclaredConstructors(Class.java:2671)
    at java.lang.Class.getConstructor0(Class.java:3075)
    at java.lang.Class.getConstructor(Class.java:1825)
    at org.jetbrains.android.uipreview.ViewLoader.createNewInstance(ViewLoader.java:389)
    at org.jetbrains.android.uipreview.ViewLoader.loadClass(ViewLoader.java:170)
    at org.jetbrains.android.uipreview.ViewLoader.loadView(ViewLoader.java:103)
    at com.android.tools.idea.rendering.LayoutlibCallbackImpl.loadView(LayoutlibCallbackImpl.java:190)
    at android.view.BridgeInflater.loadCustomView(BridgeInflater.java:218)
    at android.view.BridgeInflater.createViewFromTag(BridgeInflater.java:145)
    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:223)
    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:510)
    at com.android.tools.idea.rendering.RenderTask$2.compute(RenderTask.java:498)
    at com.intellij.openapi.application.impl.ApplicationImpl.runReadAction(ApplicationImpl.java:888)
    at com.android.tools.idea.rendering.RenderTask.createRenderSession(RenderTask.java:498)
    at com.android.tools.idea.rendering.RenderTask.access$600(RenderTask.java:72)
    at com.android.tools.idea.rendering.RenderTask$3.call(RenderTask.java:610)
    at com.android.tools.idea.rendering.RenderTask$3.call(RenderTask.java:607)
    at com.android.tools.idea.rendering.RenderService.runRenderAction(RenderService.java:366)
    at com.android.tools.idea.rendering.RenderTask.render(RenderTask.java:607)
    at com.android.tools.idea.rendering.RenderTask.render(RenderTask.java:629)
    at com.intellij.android.designer.designSurface.AndroidDesignerEditorPanel$6.run(AndroidDesignerEditorPanel.java:480)
    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:351)
    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)

This looks like a resources error. You should check if all the images, styles etc. referenced in the xml are inside the resources folder.

Unfortunately I'm not even far enough forward to be using additional resources, unless I'm missing a step:


Create a new project

Add the wikitude library

Add the dependency and repository in the module gradle file

Set permissions and features in the manifest

Add an ArchitectView in the layout

Test app - crash.


I can get the Native API working, but I would have thought that the Javascript one would be easier.

Through trimming back the SampleCamActivity until it broke I've found that some overrides are mandatory (explained below in case anyone has the same problem):


onPostCreate - to prevent the app from crashing

onResume - to start the camera feed

onDestroy - to prevent a memory leak error when the app closes


The example activity also overrides onPause and onLowMemory.  In each case call the same methods for the super and the ArchitectView.

The documentation does say "It is very important to notify the ArchitectView about life-cycle events of the Activity".  I'd wrongly assumed that my problem was before that step.

Hi Matthew,
THX for sharing your findings. I assume everything is now working as expected?

Best regards

Andreas

Yes, everything seems fine now.  Thanks.
 

That was great, it worked for me as well, except that I had to also override all the other methods in order for it to not crash (onPostCreate,onLowMemory,onPause,onDestroy,onResume, and onCreate).

Your hint was quite valuable, saved my day

can you please post a link to the example that u referred to solve this problem..thnxx:)

Another one useful tip:

In Android there are 2 onPostCreate methods:


1) public void onPostCreate(Bundle savedInstanceState, PersistableBundle persistentState)

2) protected void onPostCreate( final Bundle savedInstanceState )


1-st one will give you an app crash.

Use second one and all will be fine.

Login or Signup to post a comment