- Home /
Android Manifest Issue
I am using Unity3D 4.3.4 on a Mac.
I need to make some changes to the default androidmanifest.xml file that Unity produces.
I built my app without doing anything special yet and it runs fine on the Android device.
If I tell the build to generate an android project and then copy the androidmanifest.xml file into Plugins/Android and then build and run I get the following exception in logcat:
E/AndroidRuntime( 8539): FATAL EXCEPTION: main E/AndroidRuntime( 8539): java.lang.RuntimeException: Unable to instantiate activity ComponentInfo{com.powerteq.ultra/com.powerteq.ultra.UnityPlayerNativeActivity}: java.lang.ClassNotFoundException: Didn't find class "com.powerteq.ultra.UnityPlayerNativeActivity" on path: /data/app/com.powerteq.ultra-1.apk E/AndroidRuntime( 8539): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2106) E/AndroidRuntime( 8539): at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2230) E/AndroidRuntime( 8539): at android.app.ActivityThread.access$600(ActivityThread.java:141) E/AndroidRuntime( 8539): at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1234)
I have not made ANY changes to the xml file yet. I just copied it and built. Can someone explain and help me fix this?
Tried exporting to eclipse? (google project)
You can access the manifest and anything Android deep from there very easily.
Yes, I see you are on a $$anonymous$$ac. Not sure if there is a $$anonymous$$ac version, sorry.
Answer by Hotshot10101 · Sep 13, 2014 at 10:26 PM
Turns out that the manifest that gets created when you export to Android assumes that you will be building inside the Android SDK, so it changes the names and package identifiers to match your own.
If, on the other hand, you are using the manifest file generated when you export as part of a plugin, where you have not subclasses the UnityAndroidPlayer class then Android still wants the default package names and name of the activity.
Therefore you have to change the package name and activity name to what is defined in UnityPlayer's own java classes.
Here is my final androidmanifest.xml:
(notice the use of com.unity3d.player and UnityPlayerActivity)
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android" package="com.unity3d.player" android:theme="@android:style/Theme.NoTitleBar" android:versionName="1.0" android:versionCode="1" android:installLocation="preferExternal">
<supports-screens android:smallScreens="true" android:normalScreens="true" android:largeScreens="true" android:xlargeScreens="true" android:anyDensity="true" />
<application android:icon="@drawable/app_icon" android:label="@string/app_name" android:debuggable="false">
<activity android:label="@string/app_name" android:name="com.unity3d.player.UnityPlayerActivity" android:screenOrientation="sensorPortrait" android:launchMode="singleTask" android:configChanges="mcc|mnc|locale|touchscreen|keyboard|keyboardHidden|navigation|orientation|screenLayout|uiMode|screenSize|smallestScreenSize|fontScale">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
<meta-data android:name="unityplayer.UnityActivity" android:value="true" />
<meta-data android:name="unityplayer.ForwardNativeEventsToDalvik" android:value="false" />
</activity>
</application>
<uses-sdk android:minSdkVersion="14" android:targetSdkVersion="20" />
<uses-feature android:glEsVersion="0x00020000" />
<uses-permission android:name="android.permission.INTERNET" />
<uses-permission android:name="android.permission.ACCESS_FINE_LOCATION" />
<uses-feature android:name="android.hardware.touchscreen" />
<uses-feature android:name="android.hardware.touchscreen.multitouch" android:required="false" />
<uses-feature android:name="android.hardware.touchscreen.multitouch.distinct" android:required="false" />
</manifest>
Thank you! I'm glad you came back and posted the answer to your own question. You probably saved me hours of digging.
Thank you ! I replace my Android$$anonymous$$anifest for your and work !
Thank you ! I replace my Android$$anonymous$$anifest for your and work !
Your answer
