0

I am running into a "Fatal exception error" in Android Studio. I have created an app, that when a button is clicked is supposed to launch a unity project that I have imported into Android Studio in a .aar format. It's throwing a Fatal exception error that I am unsure of how to solve. The app launches fine but when I press the button it crashes. The logcat print out is below:

2020-05-05 21:40:56.094 24376-24376/? D/OpenGLRenderer: Skia GL Pipeline
2020-05-05 21:40:56.131 24376-24406/? I/Adreno: QUALCOMM build                   : 4c638fb, I557c585805
    Build Date                       : 10/06/18
    OpenGL ES Shader Compiler Version: EV031.25.03.01
    Local Branch                     : 
    Remote Branch                    : 
    Remote Branch                    : 
    Reconstruct Branch               : 
2020-05-05 21:40:56.131 24376-24406/? I/Adreno: Build Config                     : S L 6.0.7 AArch64
2020-05-05 21:40:56.134 24376-24406/? I/Adreno: PFP: 0x005ff112, ME: 0x005ff066
2020-05-05 21:40:56.136 24376-24406/? I/ConfigStore: android::hardware::configstore::V1_0::ISurfaceFlingerConfigs::hasWideColorDisplay retrieved: 0
2020-05-05 21:40:56.137 24376-24406/? I/ConfigStore: android::hardware::configstore::V1_0::ISurfaceFlingerConfigs::hasHDRDisplay retrieved: 0
2020-05-05 21:40:56.137 24376-24406/? I/OpenGLRenderer: Initialized EGL, version 1.4
2020-05-05 21:40:56.137 24376-24406/? D/OpenGLRenderer: Swap behavior 2
2020-05-05 21:41:00.711 24376-24376/com.jonathan.vrtest3 W/ActivityThread: handleWindowVisibility: no activity for token android.os.BinderProxy@da7daa7
2020-05-05 21:41:00.738 24376-24376/com.jonathan.vrtest3 E/onathan.vrtest: Invalid ID 0x00000000.
2020-05-05 21:41:00.738 24376-24376/com.jonathan.vrtest3 D/AndroidRuntime: Shutting down VM
2020-05-05 21:41:00.740 24376-24376/com.jonathan.vrtest3 E/AndroidRuntime: FATAL EXCEPTION: main
    Process: com.jonathan.vrtest3, PID: 24376
    java.lang.RuntimeException: Unable to start activity ComponentInfo{com.jonathan.vrtest3/com.unity3d.player.UnityPlayerActivity}: android.content.res.Resources$NotFoundException: String resource ID #0x0
        at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:3047)
        at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:3182)
        at android.app.servertransaction.LaunchActivityItem.execute(LaunchActivityItem.java:78)
        at android.app.servertransaction.TransactionExecutor.executeCallbacks(TransactionExecutor.java:108)
        at android.app.servertransaction.TransactionExecutor.execute(TransactionExecutor.java:68)
        at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1916)
        at android.os.Handler.dispatchMessage(Handler.java:106)
        at android.os.Looper.loop(Looper.java:193)
        at android.app.ActivityThread.main(ActivityThread.java:6898)
        at java.lang.reflect.Method.invoke(Native Method)
        at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:537)
        at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:858)
     Caused by: android.content.res.Resources$NotFoundException: String resource ID #0x0
        at android.content.res.Resources.getText(Resources.java:348)
        at android.content.res.Resources.getString(Resources.java:441)
        at com.unity3d.player.UnityPlayer.GetGlViewContentDescription(Unknown Source:20)
        at com.unity3d.player.UnityPlayer.<init>(Unknown Source:226)
        at com.unity3d.player.UnityPlayerActivity.onCreate(UnityPlayerActivity.java:41)
        at android.app.Activity.performCreate(Activity.java:7149)
        at android.app.Activity.performCreate(Activity.java:7140)
        at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1288)
        at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:3027)
        at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:3182) 
        at android.app.servertransaction.LaunchActivityItem.execute(LaunchActivityItem.java:78) 
        at android.app.servertransaction.TransactionExecutor.executeCallbacks(TransactionExecutor.java:108) 
        at android.app.servertransaction.TransactionExecutor.execute(TransactionExecutor.java:68) 
        at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1916) 
        at android.os.Handler.dispatchMessage(Handler.java:106) 
        at android.os.Looper.loop(Looper.java:193) 
        at android.app.ActivityThread.main(ActivityThread.java:6898) 
        at java.lang.reflect.Method.invoke(Native Method) 
        at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:537) 
        at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:858) 
2020-05-05 21:41:00.742 24376-24376/com.jonathan.vrtest3 E/AndroidRuntime: FATAL EXCEPTION: main
    Process: com.jonathan.vrtest3, PID: 24376
    java.lang.Error: FATAL EXCEPTION [main]
    Unity version     : 2019.3.12f1
    Device model      : OnePlus ONEPLUS A5000
    Device fingerprint: OnePlus/OnePlus5/OnePlus5:9/PKQ1.180716.001/2002242003:user/release-keys

    Caused by: java.lang.RuntimeException: Unable to start activity ComponentInfo{com.jonathan.vrtest3/com.unity3d.player.UnityPlayerActivity}: android.content.res.Resources$NotFoundException: String resource ID #0x0
        at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:3047)
        at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:3182)
        at android.app.servertransaction.LaunchActivityItem.execute(LaunchActivityItem.java:78)
        at android.app.servertransaction.TransactionExecutor.executeCallbacks(TransactionExecutor.java:108)
        at android.app.servertransaction.TransactionExecutor.execute(TransactionExecutor.java:68)
        at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1916)
        at android.os.Handler.dispatchMessage(Handler.java:106)
        at android.os.Looper.loop(Looper.java:193)
        at android.app.ActivityThread.main(ActivityThread.java:6898)
        at java.lang.reflect.Method.invoke(Native Method)
        at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:537)
        at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:858)
     Caused by: android.content.res.Resources$NotFoundException: String resource ID #0x0
        at android.content.res.Resources.getText(Resources.java:348)
        at android.content.res.Resources.getString(Resources.java:441)
        at com.unity3d.player.UnityPlayer.GetGlViewContentDescription(Unknown Source:20)
        at com.unity3d.player.UnityPlayer.<init>(Unknown Source:226)
        at com.unity3d.player.UnityPlayerActivity.onCreate(UnityPlayerActivity.java:41)
        at android.app.Activity.performCreate(Activity.java:7149)
        at android.app.Activity.performCreate(Activity.java:7140)
        at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1288)
        at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:3027)
        at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:3182) 
        at android.app.servertransaction.LaunchActivityItem.execute(LaunchActivityItem.java:78) 
        at android.app.servertransaction.TransactionExecutor.executeCallbacks(TransactionExecutor.java:108) 
        at android.app.servertransaction.TransactionExecutor.execute(TransactionExecutor.java:68) 
        at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1916) 
        at android.os.Handler.dispatchMessage(Handler.java:106) 
        at android.os.Looper.loop(Looper.java:193) 
        at android.app.ActivityThread.main(ActivityThread.java:6898) 
        at java.lang.reflect.Method.invoke(Native Method) 
        at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:537) 
        at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:858) 
2020-05-05 21:41:00.748 24376-24422/com.jonathan.vrtest3 D/OSTracker: OS Event: crash

And my main_activity.java is:

package com.jonathan.vrtest3;

import androidx.appcompat.app.AppCompatActivity;

import android.content.Intent;
import android.os.Bundle;
import android.view.View;
import android.widget.Button;

import com.unity3d.player.UnityPlayerActivity;

public class MainActivity extends AppCompatActivity {


    public static final String EXTRA_LOC_ID = "arguments";

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_main);

        //final Intent intent = new Intent(this, UnityPlayerActivity.class);



        ((Button) findViewById(R.id.button)).setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View view) {

                Intent intent = new Intent(MainActivity.this, UnityPlayerActivity.class);

                startActivity(intent);
            }
        });
    }
}

And my manifest file:

<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
    package="com.jonathan.vrtest3">

    <application
        android:allowBackup="true"
        android:icon="@mipmap/ic_launcher"
        android:label="@string/app_name"
        android:roundIcon="@mipmap/ic_launcher_round"
        android:supportsRtl="true"
        android:theme="@style/AppTheme">
        <activity android:name=".MainActivity">
            <intent-filter>
                <action android:name="android.intent.action.MAIN" />

                <category android:name="android.intent.category.LAUNCHER" />
            </intent-filter>
        </activity>
    </application>

</manifest>

Any help would be greatly appreciated!

1
  • SOLVED: following this solution, adding <string name="game_view_content_description">Game view</string> to my strings.xml file solved the issue. I used this tutorial
    – Overture
    Commented May 15, 2020 at 11:20

1 Answer 1

1

Your manifest is missing the activity, change it to:

AndroidManifest.xml:

<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
    package="com.jonathan.vrtest3">

    <application
        android:allowBackup="true"
        android:icon="@mipmap/ic_launcher"
        android:label="@string/app_name"
        android:roundIcon="@mipmap/ic_launcher_round"
        android:supportsRtl="true"
        android:theme="@style/AppTheme">
        <activity android:name="com.unity3d.player.UnityPlayerActivity" >
            <intent-filter>
                <action android:name="android.intent.action.DEFAULT" />
            </intent-filter>
        </activity>
        <activity android:name=".GameActivity"/>
        <activity android:name=".MainActivity">
            <intent-filter>
                <action android:name="android.intent.action.MAIN" />

                <category android:name="android.intent.category.LAUNCHER" />
            </intent-filter>
        </activity>
    </application>

</manifest>

and start the unity activity from another activity by chaining the intent with:

GameActivity.java:

class GamesActivity extends AppCompatActivity {

    @Override
    public void onCreate(Bundle savedInstanceState, PersistableBundle persistentState) {
    super.onCreate(savedInstanceState, persistentState);

    Intent intent = new Intent(this, UnityPlayerActivity.class);
    startActivity(intent);
}

}

14
  • 1
    Hi! Try this instead and not starting it from the Main activity, silly temp solution at the moment but this seemed to work for me. Haven't had time to deep dive why this issue occurs
    – Lucho
    Commented May 6, 2020 at 17:46
  • 1
    Separate file in the same folder as the MainActivity. Note the added activity in the manifest
    – Lucho
    Commented May 6, 2020 at 18:03
  • 1
    Forgot to change the kotlin code to java, post updated!
    – Lucho
    Commented May 6, 2020 at 19:25
  • 1
    so in your mainactivity do Intent intent = new Intent(this, GameActivity.class) instead. Note that this is just a temp workaround and not a solution
    – Lucho
    Commented May 6, 2020 at 19:29
  • 1
    Did you add the intent in the gameactivity?
    – Lucho
    Commented May 6, 2020 at 22:52

Not the answer you're looking for? Browse other questions tagged or ask your own question.