title: Unable to start Activity Component Error :Binary XML file line #2: Error inflating class <unknown>
body: <p>I am trying to open an activity (CryptoVars) when the user select a menu Item from the Main Activity but I get the Error of the title. </p>
  
  <p>Here is my code:</p>
  
  <p>java class:</p>
  
  <pre><code>    package com.android.python27;
  
  import android.app.Activity;
  import android.app.AlertDialog;
  import android.content.Context;
  import android.content.DialogInterface;
  import android.net.wifi.WifiInfo;
  import android.net.wifi.WifiManager;
  import android.os.Environment;
  import android.support.v7.app.AppCompatActivity;
  import android.os.Bundle;
  import android.text.InputType;
  import android.util.Log;
  import android.widget.EditText;
  import android.widget.TextView;
  import android.widget.Toast;
  
  import java.io.DataOutputStream;
  import java.io.FileOutputStream;
  import java.io.IOException;
  import java.io.InputStream;
  import java.net.MalformedURLException;
  import java.net.URL;
  import java.net.URLConnection;
  
  public class CryptoVars extends Activity {
  
      private TextView pkReceivedLabel;
      private TextView paramsReceivedLabel;
  
      private String server_info = "";
      private String my_mac = "";
  
      @Override
      protected void onCreate(Bundle savedInstanceState) {
          super.onCreate(savedInstanceState);
          setContentView(R.layout.activity_crypto_vars);
  
          pkReceivedLabel = (TextView) this.findViewById(R.id.PKreceivedLabel);
          paramsReceivedLabel = (TextView) this.findViewById(R.id.ParamsreceivedLabel);
  
          WifiManager manager = (WifiManager) getSystemService(Context.WIFI_SERVICE);
          WifiInfo info = manager.getConnectionInfo();
          setMyMAC(info.getMacAddress());
  
          createServerInfoInputDialog();
          downloadVarsFromHTTPServer();
      }
  
      public void setServerInfo(String info) {
          this.server_info = info;
      }
  
      public String getServerInfo() {
          return this.server_info;
      }
  
      public void setMyMAC(String mac) {
          this.my_mac = mac;
      }
  
      public String getMyMAC() {
          return this.my_mac;
      }
  
      public void createServerInfoInputDialog() {
          AlertDialog.Builder builder = new AlertDialog.Builder(this);
          builder.setTitle("HTTP Server info");
  
          // Set up the input
          final EditText input = new EditText(this);
          input.setInputType(InputType.TYPE_CLASS_TEXT);
          builder.setView(input);
  
          builder.setPositiveButton("OK", new DialogInterface.OnClickListener() {
              @Override
              public void onClick(DialogInterface dialog, int which) {
                  setServerInfo(input.getText().toString());
              }
          });
          builder.setNegativeButton("Cancel", new DialogInterface.OnClickListener() {
              @Override
              public void onClick(DialogInterface dialog, int which) {
                  dialog.cancel();
              }
          });
          builder.show();
      }
  
      public void downloadVarsFromHTTPServer() {
  
          String getPKrequest = "http://" + getServerInfo() + "/.pk?" + getMyMAC();
          String getParamsrequest = "http://" + getServerInfo() + "/.params?" + getMyMAC();
  
          //HTTP request for private key
          try {
  
              Log.d("HTTPrequest", "Requesting device's private key (PK)...: " + getPKrequest);
  
              URL url = new URL(getPKrequest);
              URLConnection conn = url.openConnection();
              int contentLength = conn.getContentLength();
              Log.d("contentLength", String.valueOf(contentLength));
              InputStream ins = url.openStream();
              byte data[] = new byte[1024];
              DataOutputStream fos = new DataOutputStream(new FileOutputStream(Environment.getExternalStorageDirectory() + "/myPK.key"));
              int count = 0;
              while ((count = ins.read(data)) != -1) {
                  fos.write(data, 0, count);
              }
              fos.flush();
              fos.close();
  
              Toast.makeText(this, "PK received", Toast.LENGTH_SHORT).show();
              pkReceivedLabel.setText("1.Private key received...myPK.key");
          } catch (MalformedURLException e) {
              e.printStackTrace();
          } catch (IOException e) {
              e.printStackTrace();
          }
  
          //HTTP request for crypto params
          try {
  
              Log.d("HTTPrequest", "Requesting crypto params...: " + getParamsrequest);
  
              URL url = new URL(getParamsrequest);
              URLConnection conn = url.openConnection();
              int contentLength = conn.getContentLength();
              Log.d("contentLength", String.valueOf(contentLength));
              InputStream ins = url.openStream();
              byte data[] = new byte[1024];
              DataOutputStream fos = new DataOutputStream(new FileOutputStream(Environment.getExternalStorageDirectory() + "/params.param"));
              int count = 0;
              while ((count = ins.read(data)) != -1) {
                  fos.write(data, 0, count);
              }
              fos.flush();
              fos.close();
  
              Toast.makeText(this, "Params received", Toast.LENGTH_SHORT).show();
              paramsReceivedLabel.setText("2.Params received...params.param");
          } catch (MalformedURLException e) {
              e.printStackTrace();
          } catch (IOException e) {
              e.printStackTrace();
          }
  
      }
  }
  </code></pre>
  
  <p>Android manifest file:</p>
  
  <pre><code>&lt;?xml version="1.0" encoding="utf-8"?&gt;
  &lt;manifest xmlns:android="http://schemas.android.com/apk/res/android"
      package="com.android.python27"
      android:installLocation="internalOnly"
      android:versionCode="1"
      android:versionName="1.0"&gt;
  
      &lt;supports-screens android:xlargeScreens="true" /&gt;
  
      &lt;uses-permission android:name="android.permission.INTERNET" /&gt;
      &lt;uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" /&gt;
      &lt;uses-permission
          android:name="android.permission.ACCESS_WIFI_STATE"
          android:required="true" /&gt;
      &lt;uses-permission android:name="android.permission.CHANGE_WIFI_STATE" /&gt;
  
      &lt;application
          android:name=".ScriptApplication"
          android:allowBackup="true"
          android:icon="@drawable/icon"
          android:label="@string/app_name"&gt;
          &lt;activity
              android:name=".ScriptActivity"
              android:configChanges="keyboardHidden|orientation"
              android:theme="@android:style/Theme.Translucent.NoTitleBar"&gt;
              &lt;intent-filter&gt;
                  &lt;action android:name="android.intent.action.MAIN" /&gt;
  
                  &lt;category android:name="android.intent.category.LAUNCHER" /&gt;
              &lt;/intent-filter&gt;
              &lt;intent-filter&gt;
                  &lt;action android:name="com.googlecode.android_scripting.action.ACTION_LAUNCH_FOR_RESULT" /&gt;
  
                  &lt;category android:name="android.intent.category.DEFAULT" /&gt;
              &lt;/intent-filter&gt;
          &lt;/activity&gt;
  
          &lt;service android:name=".ScriptService"&gt;
              &lt;intent-filter&gt;
                  &lt;action android:name="com.android.python27.ScriptService" /&gt;
              &lt;/intent-filter&gt;
          &lt;/service&gt;
          &lt;service android:name=".BackgroundScriptService"&gt;
              &lt;intent-filter&gt;
                  &lt;action android:name="com.android.python27.BackgroundScriptService" /&gt;
              &lt;/intent-filter&gt;
          &lt;/service&gt;
          &lt;service android:name=".StartPREService"&gt;
              &lt;intent-filter&gt;
                  &lt;action android:name="com.android.python27.StartPREService" /&gt;
              &lt;/intent-filter&gt;
          &lt;/service&gt;
          &lt;service android:name=".RpcServerService" /&gt;
  
          &lt;activity
              android:name="com.googlecode.android_scripting.activity.FutureActivity"
              android:configChanges="keyboardHidden|orientation"
              android:theme="@android:style/Theme.Translucent" /&gt;
          &lt;activity
              android:name=".DialogActivity"
              android:configChanges="keyboardHidden|orientation"
              android:theme="@android:style/Theme.Translucent.NoTitleBar" /&gt;
          &lt;activity
              android:name=".RpcServerLauncher"
              android:taskAffinity=""
              android:theme="@android:style/Theme.Translucent.NoTitleBar"&gt;
              &lt;intent-filter&gt;
                  &lt;action android:name="android.intent.action.VIEW" /&gt;
  
                  &lt;category android:name="android.intent.category.DEFAULT" /&gt;
              &lt;/intent-filter&gt;
          &lt;/activity&gt;
          &lt;activity
              android:name=".MainActivity"
              android:label="DD Transfer" /&gt;
          &lt;activity
              android:name=".Logs"
              android:label="Logs" /&gt;
          &lt;activity
              android:name=".Request"
              android:label="Request" /&gt;
          &lt;activity
              android:name=".Download"
              android:label="Download" /&gt;
          &lt;activity
              android:name=".Cache"
              android:label="Cache" /&gt;
          &lt;activity android:name=".CryptoVars"&gt;&lt;/activity&gt;
      &lt;/application&gt;
  
  &lt;/manifest&gt;
  </code></pre>
  
  <p>xml file:</p>
  
  <pre><code>&lt;?xml version="1.0" encoding="utf-8"?&gt;
  &lt;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"
      tools:context="com.android.python27.CryptoVars"&gt;
  
      &lt;TextView
          android:layout_width="300dp"
          android:layout_height="50dp"
          android:textAppearance="?android:attr/textAppearanceMedium"
          android:text= "1."
          android:id="@+id/PKreceivedLabel"
          android:textColor="#FF0000"
          android:layout_alignParentTop="true"
          android:layout_alignParentLeft="true"
          android:layout_alignParentStart="true"
          android:layout_marginTop="71dp" /&gt;
  
      &lt;TextView
          android:layout_width="300dp"
          android:layout_height="50dp"
          android:textAppearance="?android:attr/textAppearanceMedium"
          android:text= "2."
          android:id="@+id/ParamsreceivedLabel"
          android:textColor="#FF0000"
          android:layout_below="@+id/PKreceivedLabel"
          android:layout_alignParentLeft="true"
          android:layout_alignParentStart="true"
          android:layout_marginTop="116dp" /&gt;
  
  &lt;/RelativeLayout&gt;
  </code></pre>
  
  <p>And here is the Error I get:</p>
  
  <pre><code>java.lang.RuntimeException: Unable to start activity ComponentInfo{com.android.python27/com.android.python27.CryptoVars}: android.view.InflateException: Binary XML file line #2: Error inflating class &lt;unknown&gt;
                                                                      at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2092)
                                                                      at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2117)
                                                                      at android.app.ActivityThread.access$700(ActivityThread.java:134)
                                                                      at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1218)
                                                                      at android.os.Handler.dispatchMessage(Handler.java:99)
                                                                      at android.os.Looper.loop(Looper.java:137)
                                                                      at android.app.ActivityThread.main(ActivityThread.java:4867)
                                                                      at java.lang.reflect.Method.invokeNative(Native Method)
                                                                      at java.lang.reflect.Method.invoke(Method.java:511)
                                                                      at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:1007)
                                                                      at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:774)
                                                                      at dalvik.system.NativeStart.main(Native Method)
                                                                   Caused by: android.view.InflateException: Binary XML file line #2: Error inflating class &lt;unknown&gt;
                                                                      at android.view.LayoutInflater.createView(LayoutInflater.java:613)
                                                                      at com.android.internal.policy.impl.PhoneLayoutInflater.onCreateView(PhoneLayoutInflater.java:56)
                                                                      at android.view.LayoutInflater.onCreateView(LayoutInflater.java:660)
                                                                      at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:685)
                                                                      at android.view.LayoutInflater.inflate(LayoutInflater.java:466)
                                                                      at android.view.LayoutInflater.inflate(LayoutInflater.java:396)
                                                                      at android.view.LayoutInflater.inflate(LayoutInflater.java:352)
                                                                      at com.android.internal.policy.impl.PhoneWindow.setContentView(PhoneWindow.java:316)
                                                                      at android.app.Activity.setContentView(Activity.java:1901)
                                                                      at com.android.python27.CryptoVars.onCreate(CryptoVars.java:37)
                                                                      at android.app.Activity.performCreate(Activity.java:5047)
                                                                      at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1094)
                                                                      at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2056)
                                                                      at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2117) 
                                                                      at android.app.ActivityThread.access$700(ActivityThread.java:134) 
                                                                      at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1218) 
                                                                      at android.os.Handler.dispatchMessage(Handler.java:99) 
                                                                      at android.os.Looper.loop(Looper.java:137) 
                                                                      at android.app.ActivityThread.main(ActivityThread.java:4867) 
                                                                      at java.lang.reflect.Method.invokeNative(Native Method) 
                                                                      at java.lang.reflect.Method.invoke(Method.java:511) 
                                                                      at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:1007) 
                                                                      at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:774) 
                                                                      at dalvik.system.NativeStart.main(Native Method) 
                                                                   Caused by: java.lang.reflect.InvocationTargetException
                                                                      at java.lang.reflect.Constructor.constructNative(Native Method)
                                                                      at java.lang.reflect.Constructor.newInstance(Constructor.java:417)
                                                                      at android.view.LayoutInflater.createView(LayoutInflater.java:587)
                                                                      at com.android.internal.policy.impl.PhoneLayoutInflater.onCreateView(PhoneLayoutInflater.java:56) 
                                                                      at android.view.LayoutInflater.onCreateView(LayoutInflater.java:660) 
                                                                      at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:685) 
                                                                      at android.view.LayoutInflater.inflate(LayoutInflater.java:466) 
                                                                      at android.view.LayoutInflater.inflate(LayoutInflater.java:396) 
                                                                      at android.view.LayoutInflater.inflate(LayoutInflater.java:352) 
                                                                      at com.android.internal.policy.impl.PhoneWindow.setContentView(PhoneWindow.java:316) 
                                                                      at android.app.Activity.setContentView(Activity.java:1901) 
                                                                      at com.android.python27.CryptoVars.onCreate(CryptoVars.java:37) 
                                                                      at android.app.Activity.performCreate(Activity.java:5047) 
                                                                      at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1094) 
                                                                      at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2056) 
                                                                      at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2117) 
                                                                      at android.app.ActivityThread.access$700(ActivityThread.java:134) 
                                                                      at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1218) 
                                                                      at android.os.Handler.dispatchMessage(Handler.java:99) 
                                                                      at android.os.Looper.loop(Looper.java:137) 
                                                                      at android.app.ActivityThread.main(ActivityThread.java:4867) 
                                                                      at java.lang.reflect.Method.invokeNative(Native Method) 
                                                                      at java.lang.reflect.Method.invoke(Method.java:511) 
                                                                      at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:1007) 
                                                                      at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:774) 
                                                                      at dalvik.system.NativeStart.main(Native Method) 
                                                                   Caused by: java.lang.UnsupportedOperationException: Can't convert to dimension: type=0x1
                                                                      at android.content.res.TypedArray.getDimensionPixelSize(TypedArray.java:463)
                                                                      at android.view.View.&lt;init&gt;(View.java:3411)
                                                                      at android.view.View.&lt;init&gt;(View.java:3342)
                                                                      at android.view.ViewGroup.&lt;init&gt;(ViewGroup.java:426)
                                                                      at android.widget.RelativeLayout.&lt;init&gt;(RelativeLayout.java:184)
                                                                      at java.lang.reflect.Constructor.constructNative(Native Method) 
                                                                      at java.lang.reflect.Constructor.newInstance(Constructor.java:417) 
                                                                      at android.view.LayoutInflater.createView(LayoutInflater.java:587) 
                                                                      at com.android.internal.policy.impl.PhoneLayoutInflater.onCreateView(PhoneLayoutInflater.java:56) 
                                                                      at android.view.LayoutInflater.onCreateView(LayoutInflater.java:660) 
                                                                      at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:685) 
                                                                      at android.view.LayoutInflater.inflate(LayoutInflater.java:466) 
                                                                      at android.view.LayoutInflater.inflate(LayoutInflater.java:396) 
                                                                      at android.view.LayoutInflater.inflate(LayoutInflater.java:352) 
                                                                      at com.android.internal.policy.impl.PhoneWindow.setContentView(PhoneWindow.java:316) 
                                                                      at android.app.Activity.setContentView(Activity.java:1901) 
                                                                      at com.android.python27.CryptoVars.onCreate(CryptoVars.java:37) 
                                                                      at android.app.Activity.performCreate(Activity.java:5047) 
                                                                      at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1094) 
                                                                      at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2056) 
                                                                      at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2117) 
                                                                      at android.app.ActivityThread.access$700(ActivityThread.java:134) 
                                                                      at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1218) 
                                                                      at android.os.Handler.dispatchMessage(Handler.java:99) 
                                                                      at android.os.Looper.loop(Looper.java:137) 
                                                                      at android.app.ActivityThread.main(ActivityThread.java:4867) 
                                                                      at java.lang.reflect.Method.invokeNative(Native Method) 
                                                                      at java.lang.reflect.Method.invoke(Method.java:511)
  </code></pre>
  
  <p>Dimens xml:</p>
  
  <pre><code>&lt;resources&gt;
  &lt;!-- Example customization of dimensions originally defined in res/values/dimens.xml
       (such as screen margins) for screens with more than 820dp of available width. This
       would include 7" and 10" devices in landscape (~960dp and ~1280dp respectively). --&gt;
  &lt;dimen name="activity_horizontal_margin"&gt;64dp&lt;/dimen&gt;
  </code></pre>
  
  <p></p>
  
  <p>Any advice would be helpful and deeply appreciated.</p>