Start a new topic

Android ArchitectView crash while called load method

Android ArchitectView crash while called load method


Hello

I have build a project and test it in my device. But i got an error when i test it. I build the project based on wikitude docomentation in this link http://www.wikitude.com/developer/documentation/android. Do you have a solution for this problem?

 

06-13 13:56:20.133 7241-7241/com.myproject I/InjectionManager: dispatchOnViewCreated > Target : com.myproject.SampleActivity isFragment :false

06-13 13:56:25.603 7241-7241/com.myproject D/AndroidRuntime: Shutting down VM

06-13 13:56:25.603 7241-7241/com.myproject E/AndroidRuntime: FATAL EXCEPTION: main

Process: com.myproject, PID: 7241

java.lang.RuntimeException: Unable to start activity ComponentInfo{com.myproject/com.myproject.SampleActivity}: java.lang.IllegalStateException: This method only has to be called right after the object has been constructed

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

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

at android.app.ActivityThread.access$900(ActivityThread.java:177)

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

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

at android.os.Looper.loop(Looper.java:135)

at android.app.ActivityThread.main(ActivityThread.java:5910)

at java.lang.reflect.Method.invoke(Native Method)

at java.lang.reflect.Method.invoke(Method.java:372)

at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:1405)

at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1200)

Caused by: java.lang.IllegalStateException: This method only has to be called right after the object has been constructed

at com.wikitude.architect.ArchitectView.onPostCreate(ProGuard:686)

at com.myproject.SampleActivity.onPostCreate(SampleActivity.java:33)

at android.app.Instrumentation.callActivityOnPostCreate(Instrumentation.java:1199)

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

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

at android.app.ActivityThread.access$900(ActivityThread.java:177) 

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

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

at android.os.Looper.loop(Looper.java:135) 

at android.app.ActivityThread.main(ActivityThread.java:5910) 

at java.lang.reflect.Method.invoke(Native Method) 

at java.lang.reflect.Method.invoke(Method.java:372) 

at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:1405) 

at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1200)

Hello Abid,

Can you please tell me when does this error happens (for example when you launch the app or when you try to do something specific) and what it is exactly that you are trying to achieve? Are you using Javascript API or Native API?

Thanks

@Override

public void onPostCreate(final Bundle savedInstanceState) {

super.onPostCreate( savedInstanceState );

 

if ( this.architectView != null ) {

 

this.architectView.onPostCreate();

 

try {

this.architectView.load("file:///android_asset/image.html");

} catch (IOException e1) {

e1.printStackTrace();

}

}

}

 

i got an error when in this line this.architectView.load("file:///android_asset/image.html"). and i am using javascript api.

Hello Abid,

Can you please refer to this forum post for more information on how to load ArchitectView? 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.

There may even be an error 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.

If you are still facing issues then report them back here.

Thanks
Login or Signup to post a comment