title: Resource Not found exception while opening Unity Project in Android studio
body: <p>Since Google warned us to provide support to 64-bit architecture, I am migrating my existing Unity Project from version <strong>Unity 5.6.6f</strong> to <strong>Unity 2018.4.1f</strong></p>
  
  <p>Upon running my project app crashes with log, </p>
  
  <pre><code>2019-06-02 20:08:27.869 14987-14987/com.example.myapplication:unityplayer E/AndroidRuntime: FATAL EXCEPTION: main
      Process: com.example.myapplication:unityplayer, PID: 14987
      java.lang.RuntimeException: Unable to start activity ComponentInfo{com.example.myapplication/com.example.myapplication.UnityActivity}: android.content.res.Resources$NotFoundException: String resource ID #0x0
          at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2747)
          at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2808)
          at android.app.ActivityThread.-wrap12(ActivityThread.java)
          at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1541)
          at android.os.Handler.dispatchMessage(Handler.java:102)
          at android.os.Looper.loop(Looper.java:165)
          at android.app.ActivityThread.main(ActivityThread.java:6375)
          at java.lang.reflect.Method.invoke(Native Method)
          at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:912)
          at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:802)
       Caused by: android.content.res.Resources$NotFoundException: String resource ID #0x0
          at android.content.res.Resources.getText(Resources.java:347)
          at android.content.res.MiuiResources.getText(MiuiResources.java:97)
          at android.content.res.Resources.getString(Resources.java:393)
          at com.unity3d.player.UnityPlayer.a(Unknown Source)
          at com.unity3d.player.UnityPlayer.&lt;init&gt;(Unknown Source)
          at com.example.myapplication.UnityActivity.onCreate(UnityActivity.java:52)
          at android.app.Activity.performCreate(Activity.java:6845)
          at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1119)
  </code></pre>
  
  <p><strong>STEPS I HAVE DONE FROM MY END</strong></p>
  
  <p>I have created a new project in Unity 2018.4.1f and changed the scripting back-end configuration to IL2CPP to support 64-bit architecture.</p>
  
  <p>Please see my configuration below.</p>
  
  <p><a href="https://i.stack.imgur.com/KrugS.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/KrugS.png" alt="enter image description here"></a></p>
  
  <p>I have changed the package name in Unity to that my Android app package name and exported the build.</p>
  
  <p>After exporting, I have pasted the Library folder, Asset folder and JniLibs folder contents (<em>which I got from exported Unity Android project</em>) to my Android project respective folders.</p>
  
  <p>My UnityActivity file in Android Studio Project,</p>
  
  <pre><code>package com.example.myapplication;
  
  import android.app.Activity;
  import android.content.Intent;
  import android.content.res.Configuration;
  import android.graphics.PixelFormat;
  import android.os.Bundle;
  import android.view.KeyEvent;
  import android.view.MotionEvent;
  import android.view.Window;
  import android.widget.FrameLayout;
  
  import com.unity3d.player.UnityPlayer;
  
  public class UnityActivity extends Activity {
  
      protected static UnityPlayer mUnityPlayer; // don't change the name of UnityPlayer.currentActivity variable; referenced from native code
  
      @Override
      protected void onCreate(Bundle savedInstanceState) {
          requestWindowFeature(Window.FEATURE_NO_TITLE);
          super.onCreate(savedInstanceState);
  
          getWindow().setFormat(PixelFormat.RGBX_8888); // &lt;--- UnityPlayer.currentActivity makes xperia play happy
          mUnityPlayer = new UnityPlayer(this);
  
          setContentView(mUnityPlayer);
  
          FrameLayout cameraLayout = findViewById(R.id.unity_player_layout);
          cameraLayout.addView(mUnityPlayer.getView());
          mUnityPlayer.requestFocus();
  
      }
  
      @Override
      protected void onNewIntent(Intent intent) {
          setIntent(intent);
      }
  
      // Quit Unity
      @Override
      protected void onDestroy() {
          if (mUnityPlayer != null) {
              mUnityPlayer.quit();
          }
          super.onDestroy();
      }
  
      // Pause Unity
      @Override
      protected void onPause() {
          super.onPause();
          System.out.println("OnPause called");
          mUnityPlayer.pause();
      }
  
      // Resume Unity
      @Override
      protected void onResume() {
          super.onResume();
          System.out.println("OnResume called");
          mUnityPlayer.resume();
      }
  
      @Override
      protected void onStop() {
          super.onStop();
          System.out.println("Onstop called");
      }
  
      // Low Memory Unity
      @Override
      public void onLowMemory() {
          super.onLowMemory();
          mUnityPlayer.lowMemory();
      }
  
      // Trim Memory Unity
      @Override
      public void onTrimMemory(int level) {
          super.onTrimMemory(level);
          if (level == TRIM_MEMORY_RUNNING_CRITICAL) {
              mUnityPlayer.lowMemory();
          }
      }
  
      // UnityPlayer.currentActivity ensures the layout will be correct.
      @Override
      public void onConfigurationChanged(Configuration newConfig) {
          super.onConfigurationChanged(newConfig);
          mUnityPlayer.configurationChanged(newConfig);
      }
  
      // Notify Unity of the focus change.
      @Override
      public void onWindowFocusChanged(boolean hasFocus) {
          super.onWindowFocusChanged(hasFocus);
          mUnityPlayer.windowFocusChanged(hasFocus);
      }
  
      // For some reason the multiple keyevent type is not supported by the ndk.
      // Force event injection by overriding dispatchKeyEvent().
      @Override
      public boolean dispatchKeyEvent(KeyEvent event) {
          if (event.getAction() == KeyEvent.ACTION_MULTIPLE)
              return mUnityPlayer.injectEvent(event);
          return super.dispatchKeyEvent(event);
      }
  
      // Pass any events not handled by (unfocused) views straight to UnityPlayer
      @Override
      public boolean onKeyUp(int keyCode, KeyEvent event) {
          return mUnityPlayer.injectEvent(event);
      }
  
      @Override
      public boolean onTouchEvent(MotionEvent event) {
          return mUnityPlayer.injectEvent(event);
      }
  
      /*API12*/
      public boolean onGenericMotionEvent(MotionEvent event) {
          return mUnityPlayer.injectEvent(event);
      }
  
      @Override
      protected void onUserLeaveHint() {
          super.onUserLeaveHint();
  
      }
  
      @Override
      public void onBackPressed() {
          super.onBackPressed();
  
          UnityPlayer.currentActivity.runOnUiThread(new Runnable() {
              @Override
              public void run() {
                  mUnityPlayer.quit();
              }
          });
  
      }
  }
  </code></pre>
  
  <p>Corresponding XML file, </p>
  
  <pre><code>&lt;?xml version="1.0" encoding="utf-8"?&gt;
  &lt;FrameLayout xmlns:android="http://schemas.android.com/apk/res/android"
      android:id="@+id/main_layout"
      android:layout_width="match_parent"
      android:layout_height="match_parent"
      android:orientation="vertical"&gt;
  
      &lt;FrameLayout
          android:id="@+id/unity_player_layout"
          android:layout_width="match_parent"
          android:layout_height="match_parent" /&gt;
  &lt;/FrameLayout&gt;
  </code></pre>
  
  <p>My AndroidManifest file looks like</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.example.myapplication"&gt;
  
      &lt;uses-feature
          android:name="android.hardware.camera"
          android:required="false" /&gt;
      &lt;uses-feature
          android:name="android.hardware.camera.autofocus"
          android:required="false" /&gt;
      &lt;uses-feature
          android:name="android.hardware.camera.front"
          android:required="false" /&gt;
      &lt;uses-feature
          android:name="android.hardware.camera.front.autofocus"
          android:required="false" /&gt;
      &lt;uses-feature
          android:glEsVersion="0x00020000"
          android:required="false" /&gt;
      &lt;uses-feature
          android:name="android.hardware.touchscreen"
          android:required="false" /&gt;
      &lt;uses-feature
          android:name="android.hardware.touchscreen.multitouch"
          android:required="false" /&gt;
      &lt;uses-feature
          android:name="android.hardware.touchscreen.multitouch.distinct"
          android:required="false" /&gt;
  
      &lt;uses-permission android:name="android.permission.CAMERA" /&gt;
      &lt;uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE" /&gt;
      &lt;uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" /&gt;
      &lt;uses-permission android:name="android.permission.INTERNET" /&gt;
      &lt;uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" /&gt;
      &lt;uses-permission android:name="android.permission.BLUETOOTH" /&gt;
      &lt;uses-permission android:name="android.permission.ACCESS_WIFI_STATE" /&gt;
      &lt;uses-permission android:name="android.permission.SYSTEM_ALERT_WINDOW" /&gt;
  
      &lt;!-- Allows access to the flashlight --&gt;
      &lt;permission
          android:name="android.permission.FLASHLIGHT"
          android:permissionGroup="android.permission-group.HARDWARE_CONTROLS"
          android:protectionLevel="normal"
          android:required="false" /&gt;
  
      &lt;application
          android:allowBackup="true"
          android:icon="@mipmap/ic_launcher"
          android:label="@string/app_name"
          android:roundIcon="@mipmap/ic_launcher_round"
          android:largeHeap="true"
          android:supportsRtl="true"
          android:theme="@style/AppTheme"
          android:usesCleartextTraffic="true"&gt;
  
          &lt;uses-library
              android:name="org.apache.http.legacy"
              android:required="false" /&gt;
  
  
          &lt;activity
              android:name=".UnityActivity"
              android:configChanges="mcc|mnc|locale|touchscreen|keyboard|keyboardHidden|navigation|orientation|screenLayout|uiMode|screenSize|smallestScreenSize|fontScale|layoutDirection"
              android:label="@string/app_name"
              android:launchMode="singleTask"
              android:process=":unityplayer"
              android:screenOrientation="landscape"&gt;
              &lt;meta-data
                  android:name="unityplayer.UnityActivity"
                  android:value="true" /&gt;
              &lt;meta-data
                  android:name="unityplayer.ForwardNativeEventsToDalvik"
                  android:value="true" /&gt;
          &lt;/activity&gt;
  
          &lt;!--
              To support devices using the TI S3D library for stereo mode we must
              add the following library.
              Devices that require this are: ODG X6
          --&gt;
          &lt;uses-library
              android:name="com.ti.s3d"
              android:required="false" /&gt; &lt;!-- To support the ODG R7 in stereo mode we must add the following library. --&gt;
          &lt;uses-library
              android:name="com.osterhoutgroup.api.ext"
              android:required="false" /&gt;
  
          &lt;activity android:name=".MainActivity"&gt;
              &lt;intent-filter&gt;
                  &lt;action android:name="android.intent.action.MAIN" /&gt;
                  &lt;action android:name="android.intent.action.VIEW" /&gt;
  
                  &lt;category android:name="android.intent.category.LAUNCHER" /&gt;
              &lt;/intent-filter&gt;
          &lt;/activity&gt;
      &lt;/application&gt;
  
  &lt;/manifest&gt;
  </code></pre>
  
  <p>Since, I am a native developer and knows little about Unity, any help to sort out this issue will be really helpful!</p>