Start a new topic

android.view.InflateException: Binary XML file line #6: Error inflating cla

android.view.InflateException: Binary XML file line #6: Error inflating cla


Hi there!

Could you please check if the issue still occurs on latest Wikitude SDK 4.x and let me know the outcome?

Link to Download latest Wikitude SDK

Hi!

with the new 4.0 SDK it's happend 100% of the times.

The error is diffrent.

Thanks

Dov

This is the log:

 

07-30 22:02:22.930: E/AndroidRuntime(10870): java.lang.RuntimeException: Unable to start activity ComponentInfo{com.iapps.threatsscanner/com.iapps.threatsscanner.ScannerActivity}: java.lang.RuntimeException: java.lang.RuntimeException: Fail to connect to camera service

07-30 22:02:22.930: E/AndroidRuntime(10870): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:1970)

07-30 22:02:22.930: E/AndroidRuntime(10870): at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:1995)

07-30 22:02:22.930: E/AndroidRuntime(10870): at android.app.ActivityThread.handleRelaunchActivity(ActivityThread.java:3365)

07-30 22:02:22.930: E/AndroidRuntime(10870): at android.app.ActivityThread.access$700(ActivityThread.java:128)

07-30 22:02:22.930: E/AndroidRuntime(10870): at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1165)

07-30 22:02:22.930: E/AndroidRuntime(10870): at android.os.Handler.dispatchMessage(Handler.java:99)

07-30 22:02:22.930: E/AndroidRuntime(10870): at android.os.Looper.loop(Looper.java:137)

07-30 22:02:22.930: E/AndroidRuntime(10870): at android.app.ActivityThread.main(ActivityThread.java:4514)

07-30 22:02:22.930: E/AndroidRuntime(10870): at java.lang.reflect.Method.invokeNative(Native Method)

07-30 22:02:22.930: E/AndroidRuntime(10870): at java.lang.reflect.Method.invoke(Method.java:511)

07-30 22:02:22.930: E/AndroidRuntime(10870): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:993)

07-30 22:02:22.930: E/AndroidRuntime(10870): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:760)

07-30 22:02:22.930: E/AndroidRuntime(10870): at dalvik.system.NativeStart.main(Native Method)

07-30 22:02:22.930: E/AndroidRuntime(10870): Caused by: java.lang.RuntimeException: java.lang.RuntimeException: Fail to connect to camera service

07-30 22:02:22.930: E/AndroidRuntime(10870): at com.wikitude.architect.ArchitectView.onCreate(Unknown Source)

07-30 22:02:22.930: E/AndroidRuntime(10870): at com.iapps.threatsscanner.ScannerActivity.onCreate(ScannerActivity.java:177)

07-30 22:02:22.930: E/AndroidRuntime(10870): at android.app.Activity.performCreate(Activity.java:4562)

07-30 22:02:22.930: E/AndroidRuntime(10870): at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1053)

07-30 22:02:22.930: E/AndroidRuntime(10870): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:1934)

07-30 22:02:22.930: E/AndroidRuntime(10870): ... 12 more

07-30 22:02:22.930: E/AndroidRuntime(10870): Caused by: java.lang.RuntimeException: Fail to connect to camera service

07-30 22:02:22.930: E/AndroidRuntime(10870): at android.hardware.Camera.native_setup(Native Method)

07-30 22:02:22.930: E/AndroidRuntime(10870): at android.hardware.Camera.<init>(Camera.java:349)

07-30 22:02:22.930: E/AndroidRuntime(10870): at android.hardware.Camera.open(Camera.java:326)

07-30 22:02:22.930: E/AndroidRuntime(10870): at com.wikitude.architect.ArchitectView.b(Unknown Source)

07-30 22:02:22.930: E/AndroidRuntime(10870): at com.wikitude.architect.ArchitectView.<init>(Unknown Source)

07-30 22:02:22.930: E/AndroidRuntime(10870): at java.lang.reflect.Constructor.constructNative(Native Method)

07-30 22:02:22.930: E/AndroidRuntime(10870): at java.lang.reflect.Constructor.newInstance(Constructor.java:417)

07-30 22:02:22.930: E/AndroidRuntime(10870): at android.view.LayoutInflater.createView(LayoutInflater.java:586)

07-30 22:02:22.930: E/AndroidRuntime(10870): at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:680)

07-30 22:02:22.930: E/AndroidRuntime(10870): at android.view.LayoutInflater.rInflate(LayoutInflater.java:739)

07-30 22:02:22.930: E/AndroidRuntime(10870): at android.view.LayoutInflater.inflate(LayoutInflater.java:489)

07-30 22:02:22.930: E/AndroidRuntime(10870): at android.view.LayoutInflater.inflate(LayoutInflater.java:396)

07-30 22:02:22.930: E/AndroidRuntime(10870): at android.view.LayoutInflater.inflate(LayoutInflater.java:352)

07-30 22:02:22.930: E/AndroidRuntime(10870): at com.android.internal.policy.impl.PhoneWindow.setContentView(PhoneWindow.java:280)

07-30 22:02:22.930: E/AndroidRuntime(10870): at android.app.Activity.setContentView(Activity.java:1892)

07-30 22:02:22.930: E/AndroidRuntime(10870): at com.iapps.threatsscanner.ScannerActivity.onCreate(ScannerActivity.java:153)

07-30 22:02:22.930: E/AndroidRuntime(10870): ... 15 more

 

Hi again,

Seems as if you're device's camera is not accessible.
Could you please try restarting it and check behavior on another S3 or Android device?
We have an S3 in the office but are not able to repproduce the issue.

Kind regards

Hi!

Thanks for the quick replay and check!

 

which OS version you have? mine is 4.03.

I must point two points.

1. On the first time it's works good (not when returning from close screen). 

2. when I only change the "wikitudesdk.jar" to the 3 version it's working again. and 1 to 5 tries it's crash with anther issue.

 

just to verify the bug - when the app is running. close the screen with the close button. then open it (either with the close or home button) and open the lock screen.

In SDK 3 it will works and sometimes (1 to 4-5)  you will get NullPointerException

In SDK 4 it will crash 100% consistently all the times.

 

Thanks again,

Dov

We tested on the official Android 4.1.2 OTA version of the Samsung S3.
Please check the delivered apk that comes with the Wikitude Android SDK (WikitudeSDK_Android_4_0_0/Examples/apk) and let me know the results.
Could you please also check on other devices and check if there an OS update of your device solves the issue?

Kind regards

Hi,

while testing on your APK it's work! so I will try to isolate the problem.

I don't want to update the device because I want to support from 4.03.

I will let you know if I will found somting.

If you have any suggestion I will be happy to here it. (send the code, js , etc...)

 

Dov

Hi,

fixed!

while trying to isolate the problem and compare exactly with the sdk I found two difference if the manifest:

1. <supports-screens

android:smallScreens="false" android:largeScreens="true"

android:normalScreens="true" android:anyDensity="true" 

android:xlargeScreens="true" />

2. android:configChanges="orientation|screenSize"

After adding 1, the crash occure 25% of the times. and after adding 2, it's didn't happend anymore.

I guss you know better why? (-:

tnx,

Dov 

Hello! 

 

I am having a difficult time to get camera view to work with Navigation Drawer pattern. I load wikitude world in a separate fragment. NavigationDrawer works perfect. I load different layouts with my fragment successfully. As soon as I try loading wikitude Camera View application crash. I have downloaded a new SDK just today so I believe I am up to date. 

 

Please advise me. I am getting this error message: 

 


android.view.InflateException: Binary XML file line #6: Error inflating class com.wikitude.architect.ArchitectView

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


 

 

I created a separate Fragment for Wikitude World:

 

"public class MyCameraViewFragment extends Fragment "

 


 

I tried using FrameLayout as well as LinearLayout

 


<?xml version="1.0" encoding="utf-8"?>

<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"

    android:layout_width="fill_parent"

    android:layout_height="fill_parent"

    android:orientation="horizontal">

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

</LinearLayout>


 

 

 

I think I inflate correctly: 

 

 

    @Override

    public View onCreateView(LayoutInflater inflater, ViewGroup container,

                             Bundle savedInstanceState) {

        // Inflate the layout for this fragment

        return inflater.inflate(R.layout.fragment_my_camera_view, container, false);

    }


 

 

Here is how I instantiate Fragment from my main activity:

 


        FragmentManager fragmentManager = getSupportFragmentManager();

 

            MyCameraViewFragment myCameraViewFragment = MyCameraViewFragment.newInstance();

            fragmentManager.beginTransaction()

                    .replace(R.id.container,myCameraViewFragment)

                    .commit();


 

 

I do call all lifecycle methods but I think the code does not reach here: 

 


 

    @Override

    public void onAttach(Activity activity) {

        super.onAttach(activity);

 

    }

 

    @Override

    public void onDetach() {

        super.onDetach();

 

    }

 

 

 

 

 

 

    @Override

    public void onResume() {

        super.onResume();

        if ( this.architectView != null ) {

 

            // call mandatory live-cycle method of architectView

            this.architectView.onResume();

 

        }

 

    }

 

    @Override

    public void onPause() {

        super.onPause();

 

        // call mandatory live-cycle method of architectView

        if ( this.architectView != null ) {

            this.architectView.onPause();

 

        }

 

 

    }

 

    @Override

    public void onStop() {

        super.onStop();

    }

 

    @Override

    public void onDestroy() {

        super.onDestroy();

        if ( this.architectView != null ) {

            this.architectView.onDestroy();

        }

    }

 

 

    @Override

    public void onLowMemory() {

        super.onLowMemory();

        if ( this.architectView != null ) {

            this.architectView.onLowMemory();

        }

    }

 


 

 

 

Hi, please check that the activity in your application is declared as "extends FragmentActivity" instead of "extends Activity", this could be a part of the problem if your application uses fragments.

Gabriele, thank you very much for your response! 

Yes. The main activity that creates fragments extends FragmentActivity

public class MainActivity extends FragmentActivity

        implements NavigationDrawerFragment.NavigationDrawerCallbacks

{

 ...

}

 

When navigation item on the left is tapped I create new fragment and replace existing one: 

 


 @Override

    public void onNavigationDrawerItemSelected(int position) {

        // update the main content by replacing fragments

        FragmentManager fragmentManager = getSupportFragmentManager();

 

        if(position==0)

       {

          fragmentManager.beginTransaction()

                    .replace(R.id.container,MyCameraViewFragment.newInstance()) // Wikitude Architect 

                    .commit();

 

        } else {

        fragmentManager.beginTransaction()

                .replace(R.id.container, PlaceholderFragment.newInstance(position + 1))

                .commit();

        }

 

    }

 

 

If I load different layout.xml in MyCameraViewFragment. Then there is no exception and can switch between pages and load different layouts. As soon as I load xml file that holds ArchitectView, I start getting exception and application crashes. 

 


<?xml version="1.0" encoding="utf-8"?>

<FrameLayout xmlns:android="http://schemas.android.com/apk/res/android"

    android:layout_width="fill_parent"

    android:layout_height="fill_parent"

    android:orientation="horizontal">

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

</FrameLayout>

 

 

Do you see what else can trigger the exception message mentioned above? 


 

Gabriele, I think I was able to reproduce the problem...

 

I have noticed another error message in log file. Please see below:  

 

myapplication4.app D/ArchitectView? Exception while getting Camera Parameters

    java.lang.RuntimeException: Fail to get camera info

            at android.hardware.Camera._getCameraInfo(Native Method)

 

I was getting this error message even with proper permissions in AndroidManifest file... I restarted the device and it started working properly. The good news is that there is no problem with Fragments or Navigation Drawer now. It works stable until I turn off device screen with Camera View on. When I turn the screen back on my application crashes. And this happens consistently on Samsung Galazy Nexus Android 4.2.1 API 17 device... After it crashes a few times like this, then I need to restart device again because I start getting error message -  "Exception while getting Camera Parameters" and of course application crashes with the same error message I created this Post with. It cannot inflate the architect world view.... 

 

I tried another device - HTC EVE 3D Android 4.0.3 API 15. My application behaves differently on this device. It never crashes when I turn off  the device screen while the Camera View with Architect world is on. I tried many times turning off and on and it never crashes. This is a very good news. Navigation Drawer and fragements also work properly. The device is older, API is older but application works much stable. 

 

Target images get recognized and image drawables(overlays) display well on either device.

 

However with the new Wikitude SDK for Android  Video Drawable on ether device fail to play even if I use Wikitude App downloaded from Android play store. I have created architect world and loaded it on my server. Then I load it using the this.architectView.load("<URL TO AR WORLD ON MY SERVER>"); The same URL consistently works and all video drawables play well on iOS. But on Android video drawables fail to play in my app or in Wikitude App itself. I tried restarting My App, Wikitude App and restarting devices, I managed to play it only once on HTC EVE 3D device but after I restarted the App again I could not play it again. Please note, the same url to Architect world works consistently well and all video drawables play on iOS. I have also updated the iOS Wikidute SDK to a newer version today.  

 

Please advise me how to fix these issues. 

 

Below are the error messages that I get on either device when Architect World is loaded. 

 

 

E/MediaPlayer? Error (1,-2147483648)

E/MediaPlayer? error (1, -2147483648)

W/System.err? java.lang.NullPointerException

 W/System.err? at com.wikitude.architect.VideoManager.a(Unknown Source)

W/System.err? at com.wikitude.architect.ArchitectWebView.playVideoCallback(Unknown Source)

W/System.err? at com.wikitude.architect.PlatformBridge.callAsyncImpl(Native Method)

 at com.wikitude.architect.PlatformBridge.callAsyncImpl(Unknown Source)

 

 

 E/VideoManager? Exception when playing video null

 

 

Thank you very much and I hope for your support. 

 
Login or Signup to post a comment