Uploaded image for project: 'Appcelerator - INBOX'
  1. Appcelerator - INBOX
  2. AC-6258

Android:Error inflating class fragment

    Details

    • Type: Bug
    • Status: Resolved
    • Resolution: Needs more info
    • Affects Version/s: Appcelerator Studio 4.5.0
    • Component/s: None
    • Environment:

      For mac , appcelerator studio version 5.0.0

      Description

      i am trying to use a fragment using .xml file in appcelerator.but while inflating i am getting the below error

      [ERROR] : TiExceptionHandler: (main) [184,617] /hyperloop/android.view.LayoutInflater.js:390
      [ERROR] : TiExceptionHandler: var result = this.$native.callNativeFunction({
      [ERROR] : TiExceptionHandler: ^
      [ERROR] : TiExceptionHandler: Error: Binary XML file line #6: Binary XML file line #6: Error inflating class fragment
      [ERROR] : TiExceptionHandler: at LayoutInflater.inflate (/hyperloop/android.view.LayoutInflater.js:390:28)
      [ERROR] : TiExceptionHandler: at new Controller (/alloy/controllers/index.js:62:15)
      [ERROR] : TiExceptionHandler: at Object.exports.createController (/alloy.js:339:9)
      [ERROR] : TiExceptionHandler: at /app.js:59:7
      [ERROR] : TiExceptionHandler: at Module._runScript (ti:/module.js:613:9)
      [ERROR] : TiExceptionHandler: at Module.load (ti:/module.js:105:7)
      [ERROR] : TiExceptionHandler: at Module.loadJavascriptText (ti:/module.js:457:9)
      [ERROR] : TiExceptionHandler: at Module.loadAsFile (ti:/module.js:512:15)
      [ERROR] : TiExceptionHandler: at Module.loadAsFileOrDirectory (ti:/module.js:429:20)
      [ERROR] : TiExceptionHandler: at Module.require (ti:/module.js:256:17)
      [ERROR] : TiExceptionHandler:
      [ERROR] : V8Exception: Exception occurred at /hyperloop/android.view.LayoutInflater.js:390: Uncaught Error: Binary XML file line #6: Binary XML file line #6: Error inflating class fragment

      js FIle

      var OneSDKBuilder = require('com.aol.mobile.sdk.player.OneSDKBuilder');
      var OneSDK = require('com.aol.mobile.sdk.player.OneSDK');
      const Context = require('android.content.Context');
      const Inflater = require('android.view.LayoutInflater');
      const View = require('android.view.View');
      const Activity = require('android.app.Activity');
      const activity = new Activity(Ti.Android.currentActivity);
      const PlayerFragment = require('com.aol.mobile.sdk.player.view.PlayerFragment');
      const Fragment = require('android.app.Fragment');
      const inflater = Inflater.cast(activity.getApplicationContext().getSystemService(Context.LAYOUT_INFLATER_SERVICE));
      const resID = activity.getResources().getIdentifier('activity_player', 'layout', activity.getPackageName());
      const view = inflater.inflate(resID, null);

      // const fragment = new PlayerFragment();
      // var fm = activity.getFragmentManager();
      // fm.beginTransaction()
      // .replace(activity.getResources().getIdentifier('frame', 'id', activity.getPackageName()), fragment)
      // .commit();

      new OneSDKBuilder(activity.getApplicationContext())
      .create(new OneSDKBuilder.Callback({

      onSuccess: function(oneSDK)

      { // useSDK(oneSDK, playerFragment); console.log("success Creating SDK"); }

      ,

      onFailure: function(e) {
      console.log("Error Creating SDK"+ e);
      }}));

      $.index.open();

      xml file

      <?xml version="1.0" encoding="utf-8"?>
      <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
      xmlns:app="http://schemas.android.com/apk/res-auto"
      xmlns:tools="http://schemas.android.com/tools"
      android:layout_width="match_parent"
      android:layout_height="match_parent"
      android:id="@+id/linear">

      <FrameLayout
      android:layout_width="match_parent"
      android:layout_height="match_parent"
      android:id="@+id/frame">

      <fragment
      android:id="@+id/player_fragment"
      android:name="com.aol.mobile.sdk.player.view.PlayerFragment"
      android:layout_width="match_parent"
      android:layout_height="match_parent" />

      </FrameLayout>

      </LinearLayout>

        Attachments

          Activity

            People

            • Assignee:
              shossain Shak Hossain
              Reporter:
              mbhatt33 mbhatt33
            • Watchers:
              3 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved:

                Git Source Code