Start a new topic

Can't load AR experience in wikitude

Can't load AR experience in wikitude


Hi Jerome,

It is quite hard to analyse the obfuscated errors but please have a look at the Epson Sample application provided in the download section. Note that the Epson SDK is behind the Android/iOS SDK and only comes with an Eclipse-based sample project.

Best regards

Hi !

I have the same problem but I cannot find a solution. I create the assets folder as described above but it doesn't work !

I have this error on activity preview :

java.lang.NullPointerException

at com.wikitude.architect.ArchitectView.e(Unknown Source)

at com.wikitude.architect.ArchitectView.a(Unknown Source)

at com.wikitude.architect.ArchitectView.<init>(Unknown Source)

at com.wikitude.architect.ArchitectView.<init>(Unknown Source)

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:423)

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:170)

at android.view.BridgeInflater.loadCustomView(BridgeInflater.java:247)

at android.view.BridgeInflater.createViewFromTag(BridgeInflater.java:171)

...

 

And this erros in debug on Smart Glasses (Epson BT200) :

 


FATAL EXCEPTION: main

                                                                                 java.lang.RuntimeException: Unable to start activity ComponentInfo{org.orange.sas.epsonapplication/org.orange.sas.epsonapplication.TestActivity}: android.view.InflateException: Binary XML file line #12: Error inflating class com.wikitude.architect.ArchitectView

                                                                                     at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:1970)

                                                                                     at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:1995)

                                                                                     at android.app.ActivityThread.access$600(ActivityThread.java:128)

                                                                                     at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1161)

                                                                                     at android.os.Handler.dispatchMessage(Handler.java:99)

...

 

Thank you for your help !


 



 

 

Thank you very much for your answer.

I found the error myself this morning.

I had to put the asset folder into src/main and use .load("something/index.html");.

Thank you very much for the support though!

Please have a look at the provided Sample Application.

Using the path to the index.html (which must include the <script src="architect://architect.js"></script> tag)
should solve your issue.

I recomend you to also have a look at remote debugging of the WebView to find out if there are any JS errors in your code.

Kind regards,
Andreas

 

I tried your advice and other things, but I can't get my AR App to display anything.

I am using the html/css/js files and assets from the example app.

This is what I have: https://www.dropbox.com/s/ess3d93cjogqxfn/screenshot_1.png?dl=0

I tried .load("something"), .load("assets/something") and .load("somethign/index.html").

Thank you very much in advance :)

Good to hear that you were able to solve the issue.

Kind regards,
Andreas

Dear Andreas Hauser,

Thank you very much, your reply gave me near of 80% of solution.

My mistake was with asstes folder, I was create it as normal directory

While I must create it in android studio as this way

 right-click on the  folder and navigate to the new -> Folder-> Assets Folder.

and be sure for this:

Looking inside the .iml file of your project you will see the following line:

<option name="ASSETS_FOLDER_RELATIVE_PATH" value="/src/main/assets" />


Best Regards,

swe.anas

Hi again!
 

I guess there is an errot in your JS code. Have you tried loading it from assets root folder?
Please first try loading a valid sample application and then replace it with your own source code.

Also have a look at Android remote dubugging to find potential JS errors.

Kind regards,
Andreas

Hi Andreas Hauser,

Thank you for your reply.

Before I posted the thread, I tried many way to load file as 


* this.architectView.load(getAssets().open("miarec/index.html").toString());

 

* this.architectView.load("miarec/index.html");


and tried to change the folder to another place in project , but with no result.

Please write to me a true code, or if you have a sample project to Image Recognition - MULTIPLE TARGETS Attach it to me.

thank you

Hi there!
 

Please have a look at the provided Sample application, which also uses relative paths within the assets folder.
Calling architectView.load("index.html") will load file from application's assets folder and architectView.load("yourpath/index.html") the index html-file in yourpath, relative to the assets root directory, no need to use absolute assets-directory.

Kind regards,
Andreas

 

I need to create AR app to do as in this link:http://www.wikitude.com/external/doc/documentation/latest/android/imagerecognition.html#multipletarget

I wrote a code and tried it, it open a camera, but I think it can't load to use AR experience (index.html)

This is a MainActivity.java code:

NOTE: the path of index.html in th project is: assets/miarec/index.hmtl

 

import android.support.v7.app.ActionBarActivity;
import android.os.Bundle;
import android.view.Menu;
import android.view.MenuItem;
import android.widget.Toast;
import com.wikitude.architect.ArchitectView;
import java.io.IOException;

public class MainActivity extends ActionBarActivity {

ArchitectView architectView;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);

this.architectView = (ArchitectView)this.findViewById( R.id.architectView );
final ArchitectView.ArchitectConfig config = new ArchitectView.ArchitectConfig( "3Axht4JgkVsnCHOuwl76PM0NDRnpRNL5PwwrPd1kgIN7aAP5sGJxBp3hvA3SIE+zrzwaqvulTUb7hhYz1/iQJiY9M3K8825GHJkssi5nHP8ZhtdoIo0z2fV2PkGUY9DzmVG/z2f3Uu8FKyulXFFegYEQZcvSCVIYvBmI6y0MIAFTYWx0ZWRfX6IIZxx4haqZxXDO5sj4bWkWKn2INx38uRuDKzaF6TVj7NV2MpeQeOvWWWGx7TKLL8DfOO8W4ARCSicBw6Vmejq7WMFQuMvte1y+r6rxZ2irjTBd8IpiAezUX8cxpy26SNbd1Gm+PWdjizE3Yqqr3/mi5NcDWlGm3GICiCeFvDNFgwryW7kPG6JTjhWA3GiUTfUE7AAJI349ZbtisyhP8YLzRvPUIc8t9nKs0aEMCme3e3CNiacl7rAuUWI7YNYD28GQ9EpTwAL8F29tV1n3dcXhxyuKfyptft71DI1SVVQ67/3UNml6bA06R3ZZiwyYD1f9l/Kfz5Q6RaFGXBL6vKHKwSt0vfeul2lmB4N1FJ+6GCSsB8cvIyhq3QtMQhbG9CiihTlsF9WVQdIVtbXFuGo=" /* license key */ );
this.architectView.onCreate( config );

}

@Override
protected void onPostCreate( final Bundle savedInstanceState ) {
super.onPostCreate( savedInstanceState );

if ( this.architectView != null ) {

// call mandatory live-cycle method of architectView
this.architectView.onPostCreate();

try {
// load content via url in architectView, ensure '<script src="architect://architect.js"></script>' is part of this HTML file, have a look at wikitude.com's developer section for API references

String s= getAssets().open("miarec/index.html").toString();
this.architectView.load(getAssets().open("miarec/index.html").toString());



} catch (IOException e1) {
e1.printStackTrace();
}
}
}

@Override
public boolean onCreateOptionsMenu(Menu menu) {
// Inflate the menu; this adds items to the action bar if it is present.
getMenuInflater().inflate(R.menu.menu_main, menu);
return true;
}

@Override
public boolean onOptionsItemSelected(MenuItem item) {
// Handle action bar item clicks here. The action bar will
// automatically handle clicks on the Home/Up button, so long
// as you specify a parent activity in AndroidManifest.xml.
int id = item.getItemId();

//noinspection SimplifiableIfStatement
if (id == R.id.action_settings) {
return true;
}

return super.onOptionsItemSelected(item);
}

@Override
public void onResume() {
super.onResume();

this.architectView.onResume();
}

@Override
protected void onPause() {
super.onPause();

// call mandatory live-cycle method of architectView
if ( this.architectView != null ) {
this.architectView.onPause();


}


}

@Override
protected void onStop() {
super.onStop();
}

@Override
protected void onDestroy() {
super.onDestroy();

// call mandatory live-cycle method of architectView
if ( this.architectView != null ) {
this.architectView.onDestroy();
}
}

@Override
public void onLowMemory() {
super.onLowMemory();
if ( this.architectView != null ) {
this.architectView.onLowMemory();
}
}

This is a activity_main.xml:

 

<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">

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

</RelativeLayout>

I get this warning in android studio xml preview:

 

Rendering Problems The following classes could not be instantiated:
- com.wikitude.architect.ArchitectView (Open Class, Show Exception)
Tip: Use View.isInEditMode() in your custom views to skip code or show
sample data when shown in the IDE Exception Details
java.lang.NullPointerException   at
com.wikitude.architect.ArchitectView.e  at
com.wikitude.architect.ArchitectView.a  at
com.wikitude.architect.ArchitectView.<init>  at
com.wikitude.architect.ArchitectView.<init>  at

Thank you very much
Login or Signup to post a comment