1

Okay, so I've tried to import my unity project as a single activity in Android Studio.
I've followed this tutorial but I kept getting an error at step 6:
"Unable to resolve dependency for ‘:app@debug/compileClasspath’: Could not resolve project..."

So I turned to another tutorial on a different way to import the aar package to my main project file in android studio.

Now, using both of the tutorials together, I managed to put something together that will compile without an error.

This is my main activity, where I want to start the unity activity on a button click:

public class MainActivity extends AppCompatActivity {

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

public void startUnity(View view){
    Intent intent = new Intent(this.getApplicationContext(), UnityPlayerActivity.class);
    startActivity(intent);
}
}

The UnityPlayerActivity class is recognized by Android Studio, but when I run the app, I get this exception:
"Caused by: android.content.ActivityNotFoundException: Unable to find explicit activity class {com.zackguetta.foodiedoodie/com.unity3d.player.UnityPlayerActivity}; have you declared this activity in your AndroidManifest.xml?"

How do I fix this? I thought the merge of the manifests would take care of this.

*note: I'm using Android Studio 3.0.1 if it means anything to you (maybe some compatibility issues arise)
*second note: Yes, I went through the other similar topics, none seemed to have the answer, so please don't mark as a duplicate right away.

  • Not a duplicate? Have you tried [this](https://stackoverflow.com/questions/38980792/exporting-and-running-unity3d-project-to-android-studio/39008549#39008549)? – Programmer Jan 11 '18 at 18:05

1 Answers1

1

Add it to your AndroidManifest.xml. Write this line inside <application> tags:

<activity android:name=".unity3d.player.UnityPlayerActivity" />
Cristian
  • 370
  • 3
  • 8