Search Unity

  1. Megacity Metro Demo now available. Download now.
    Dismiss Notice
  2. Unity support for visionOS is now available. Learn more in our blog post.
    Dismiss Notice

UnityException: Unable to start activity!

Discussion in 'Android' started by mwieczorek, Jan 26, 2016.

  1. mwieczorek

    mwieczorek

    Joined:
    Mar 30, 2015
    Posts:
    4
    Hello,
    I am getting a strange error when building my App on the Android platform.
    As in title:
    UnityException: Unable to start activity!
    No activity in the manifest with action MAIN and category LAUNCHER. Try launching the application manually on the device.

    But on my device (LG F70, KitKat) I can successfully install the application, but the "Open" button is disabled and I can't see a shortcut to the app.

    I've tried changing the AndroidManifest files, but with no help.

    I have recently added the UnityAds plugin and I think, that this could be the problem, but I am not sure...

    Anyone can say what should I do?
    I am working with Unity 5.0.1 x64.

    Kind regards,
    Miłosz
     
  2. liortal

    liortal

    Joined:
    Oct 17, 2012
    Posts:
    3,562
    You probably have your own custom AndroidManifest.xml (or multiple ones). Can you list its contents? you should declare 1 activity that is the MAIN activity of the game. This is what's actually called when you click the game's icon from the launcher.
     
    Sledzislaw likes this.
  3. mwieczorek

    mwieczorek

    Joined:
    Mar 30, 2015
    Posts:
    4
    I have found two AndroidManifest files that are in the Assets folder.
    First:

    <?xml version="1.0" encoding="utf-8"?>
    <manifest xmlns:android="http://schemas.android.com/apk/res/android" >
    <!-- Permisions -->
    <uses-permission android:name="android.permission.INTERNET" /> <!-- Required for AdMod, InApp purchases and Leaderboards -->
    <uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" /> <!-- Required for AdMod and Leaderboards -->
    <!--- <uses-permission android:name="android.permission.ACCESS_COARSE_LOCATION" /> Required for Amazon Ads -->
    <!--- <uses-permission android:name="android.permission.ACCESS_FINE_LOCATION" /> Required for Amazon Ads -->
    <!--- <uses-permission android:name="android.permission.ACCESS_WIFI_STATE" /> Required for Amazon Ads -->
    <!--- <uses-permission android:name="com.android.vending.BILLING" /> Required for GooglePlay IAP -->
    <!--- <uses-permission android:name="com.sec.android.iap.permission.BILLING" /> Required for Samsung IAP -->
    <!--- <uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" /> Required for Amazon IAP Testing (NOTE: You can remove this before release) -->
    <!--- <uses-permission android:name="android.permission.GET_ACCOUNTS" /> Required for GooglePlay Leaderboards and Achievements -->

    <!-- Application -->
    <application android:icon="@drawable/app_icon" android:label="@String/app_name">

    <!-- Amazon InAppPurchase receiver -->
    <receiver android:name = "com.amazon.device.iap.ResponseReceiver" >
    <intent-filter>
    <action android:name = "com.amazon.inapp.purchasing.NOTIFY" android:permission = "com.amazon.inapp.purchasing.Permission.NOTIFY"/>
    </intent-filter>
    </receiver>

    <!-- Amazon Ads -->
    <activity android:name="com.amazon.device.ads.AdActivity" android:configChanges="keyboardHidden|orientation|screenSize"/>

    <!-- GooglePlay Services Version -->
    <meta-data android:name="com.google.android.gms.version" android:value="@Integer/google_play_services_version"/>

    <!-- AdMob Activity -->
    <activity android:name="com.google.android.gms.ads.AdActivity" android:configChanges="keyboard|keyboardHidden|orientation|screenLayout|uiMode|screenSize|smallestScreenSize"/>

    <!-- GooglePlay Leaderboards and Achievements -->
    <meta-data android:name="com.google.android.gms.appstate.APP_ID" android:value="\ xxxxxxxxxxxx" /><!-- Set to your Game Services AppID -->
    <meta-data android:name="com.google.android.gms.games.APP_ID" android:value="\ xxxxxxxxxxxx" /><!-- Set to your Game Services AppID -->

    <!-- Amazon GameCircle -->
    <activity android:name="com.amazon.ags.html5.overlay.GameCircleUserInterface" android:theme="@StyLe/GCOverlay" android:hardwareAccelerated="false"></activity>
    <activity android:name="com.amazon.ags.html5.overlay.GameCircleAlertUserInterface" android:theme="@StyLe/GCAlert" android:hardwareAccelerated="false"></activity>
    <activity android:name="com.amazon.identity.auth.device.authorization.AuthorizationActivity" android:theme="@android:style/Theme.NoDisplay" android:allowTaskReparenting="true" android:launchMode="singleTask">
    <intent-filter>
    <action android:name="android.intent.action.VIEW" />
    <category android:name="android.intent.category.DEFAULT" />
    <category android:name="android.intent.category.BROWSABLE" />
    <data android:host="com.xxxx.xxxx" android:scheme="amzn" /><!-- Set to your bundle/package id -->
    </intent-filter>
    </activity>
    <receiver android:name="com.amazon.identity.auth.device.authorization.PackageIntentReceiver" android:enabled="true">
    <intent-filter>
    <action android:name="android.intent.action.PACKAGE_INSTALL" />
    <action android:name="android.intent.action.PACKAGE_ADDED" />
    <data android:scheme="package" />
    </intent-filter>
    </receiver>

    <!-- Smasung IAP -->
    <activity android:name="com.sec.android.iap.lib.activity.InboxActivity" android:theme="@StyLe/Theme.Empty" android:configChanges="orientation|screenSize"/>
    <activity android:name="com.sec.android.iap.lib.activity.PaymentActivity" android:theme="@StyLe/Theme.Empty" android:configChanges="orientation|screenSize"/>
    <activity android:name="com.sec.android.iap.lib.activity.ItemActivity" android:theme="@StyLe/Theme.Empty" android:configChanges="orientation|screenSize"/>
    </application>
    </manifest>


    And second:

    <?xml version="1.0" encoding="utf-8"?>
    <manifest xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:tools="http://schemas.android.com/tools"
    package="com.unity3d.ads.android"
    android:versionCode="1"
    android:versionName="1.0" >

    <uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
    <uses-permission android:name="android.permission.INTERNET" />

    <application>
    <activity
    android:name="com.unity3d.ads.android.view.UnityAdsFullscreenActivity"
    android:configChanges="fontScale|keyboard|keyboardHidden|locale|mnc|mcc|navigation|orientation|screenLayout|screenSize|smallestScreenSize|uiMode|touchscreen"
    android:theme="@android:style/Theme.NoTitleBar.Fullscreen"
    android:hardwareAccelerated="true"
    tools:ignore="UnusedAttribute"/>
    </application>
    </manifest>



    I cannot see here an entry with action MAIN and category LAUNCHER, but I don't know how I could change it.
    There are few AndroidManifests in the Temp folder. I have tried to update them, but with no effect (I suppose these files are overriden on every build).

    Could you tell me how could I fix the Android Manifest that is used in the final application?
     
  4. liortal

    liortal

    Joined:
    Oct 17, 2012
    Posts:
    3,562
    Are you defining any custom main activity of your own? if not, you should probably at least declare Unity's default activity in the manifest. This is the default one that comes with Unity, you can try to add this into one of the manifests:
     
    tech_intro, OronC, Aseemy and 2 others like this.
  5. mwieczorek

    mwieczorek

    Joined:
    Mar 30, 2015
    Posts:
    4
    Thank you so much for this piece of code ! :) My app finally started working :D
     
  6. StevenDeLaTorre

    StevenDeLaTorre

    Joined:
    Jan 4, 2019
    Posts:
    2
    If you are getting this error while making Oculus Quest builds here is the manifest XML to resolve it:


    Code (XML):
    1. <?xml version="1.0" encoding="utf-8" standalone="no"?>
    2. <manifest xmlns:android="http://schemas.android.com/apk/res/android"
    3.     android:installLocation="auto">
    4.     <application
    5.         android:label="@string/app_name"
    6.         android:icon="@mipmap/app_icon">
    7.         <activity
    8.             android:theme="@android:style/Theme.Black.NoTitleBar.Fullscreen"
    9.             android:configChanges="locale|fontScale|keyboard|keyboardHidden|mcc|mnc|navigation|orientation|screenLayout|screenSize|smallestScreenSize|touchscreen|uiMode"
    10.             android:launchMode="singleTask"
    11.             android:name="com.unity3d.player.UnityPlayerActivity"
    12.             android:excludeFromRecents="true">
    13.             <intent-filter>
    14.                 <action android:name="android.intent.action.MAIN"/>
    15.                 <category android:name="android.intent.category.LAUNCHER"/>
    16.             </intent-filter>
    17.         </activity>
    18.         <meta-data android:name="unityplayer.SkipPermissionsDialog" android:value="false" />
    19.         <meta-data android:name="com.samsung.android.vr.application.mode" android:value="vr_only"/>
    20.     </application>
    21. </manifest>
     
  7. kavanavak

    kavanavak

    Joined:
    Sep 30, 2015
    Posts:
    54
    At @StevenDeLaTorre
    I have the same manifest as what you're posting here, except:
    1. Instead of saying LAUNCHER it says INFO
    2. after /intent -filter and before /activity I have a some code
    3. after /application and before /manifest I have some more code

    Code (XML):
    1. </intent-filter>
    2. <meta-data android:name="com.oculus.vr.focusaware" android:value="true"/>
    3. </activity>
    Code (XML):
    1.  
    2. </application>
    3. <uses-feature android:name="android.hardware.vr.headtracking" android:required="true" android:version="1"/>
    4. </manifest>
    This was generated by Oculus > Tools within Unity.
     
  8. artygrand

    artygrand

    Joined:
    Aug 5, 2019
    Posts:
    4
    INFO is for oculus store
    LAUNCHER is for debug
     
    ubershmekel and WonkeeKim like this.
  9. stevkato

    stevkato

    Joined:
    Dec 2, 2020
    Posts:
    1
    Thanks - replacing INFO with LAUNCHER worked.
     
    LouisHong likes this.
  10. LiYiming2041

    LiYiming2041

    Joined:
    Jul 11, 2022
    Posts:
    1
    Hi, how did you replace INFO with LAUNCHER? I perhaps modify the wrong file.