How to integrate AndroidManifest.xml? - android

So I need to integrate unity with android feature like connect to 3rd party app.
So I made .apk build after working at eclipse, but how to integrate between 2 AndroidManifest files?
First reference one is,
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.mygame.plugin"
android:versionCode="1"
android:versionName="1.0" >
<uses-sdk
android:minSdkVersion="8"
android:targetSdkVersion="21" />
<application
android:allowBackup="true"
android:icon="#drawable/ic_launcher"
android:label="#string/app_name" >
<activity
android:name=".MainActivity"
android:label="#string/app_name" >
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
<intent-filter>
<data android:scheme="ka67492508561297" />
<action android:name="android.intent.action.VIEW" />
<category android:name="android.intent.category.BROWSABLE" />
<category android:name="android.intent.category.DEFAULT" />
</intent-filter>
</activity>
<activity android:name="com.kakao.unity.plugin.ThirdPartyPostStoryActivity" android:windowSoftInputMode="stateAlwaysVisible" android:theme="#android:style/Theme.Translucent.NoTitleBar"/>
</application>
<uses-permission android:name="android.permission.INTERNET" />
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />
<uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE" />
<uses-permission android:name="android.permission.GET_ACCOUNTS" />
and the main one my game currently uses is
<?xml version="1.0" encoding="utf-8"?>
<manifest
xmlns:android="http://schemas.android.com/apk/res/android"
package="com.mygame.mygame1"
android:installLocation="preferExternal"
android:theme="#android:style/Theme.NoTitleBar"
android:versionCode="2"
android:versionName="1.01">
<supports-screens
android:smallScreens="true"
android:normalScreens="true"
android:largeScreens="true"
android:xlargeScreens="true"
android:anyDensity="true"/>
<uses-sdk
android:minSdkVersion="9"
android:targetSdkVersion="22" />
<application
android:allowBackup="true"
android:icon="#drawable/app_icon"
android:label="#string/app_name">
<meta-data android:name="com.google.android.gms.version" android:value="#integer/google_play_services_version"/>
<activity
android:name=".MainActivity"
android:label="#string/app_name" >
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
<intent-filter>
<data android:scheme="ka7492508561297" />
<action android:name="android.intent.action.VIEW" />
<category android:name="android.intent.category.BROWSABLE" />
<category android:name="android.intent.category.DEFAULT" />
</intent-filter>
</activity>
<activity android:name="com.unity3d.player.UnityPlayerProxyActivity"
android:launchMode="singleTask"
android:label="#string/app_name"
android:configChanges="fontScale|keyboard|keyboardHidden|locale|mnc|mcc|navigation|orientation|screenLayout|screenSize|smallestScreenSize|uiMode|touchscreen">
<meta-data android:name="unityplayer.ForwardNativeEventsToDalvik" android:value="true" />
</activity>
<activity android:name="com.unity3d.player.UnityPlayerActivity"
android:launchMode="singleTask"
android:label="#string/app_name"
android:configChanges="fontScale|keyboard|keyboardHidden|locale|mnc|mcc|navigation|orientation|screenLayout|screenSize|smallestScreenSize|uiMode|touchscreen">
</activity>
<activity android:name="com.unity3d.player.UnityPlayerNativeActivity"
android:launchMode="singleTask"
android:label="#string/app_name"
android:configChanges="fontScale|keyboard|keyboardHidden|locale|mnc|mcc|navigation|orientation|screenLayout|screenSize|smallestScreenSize|uiMode|touchscreen">
<meta-data android:name="unityplayer.ForwardNativeEventsToDalvik" android:value="true" />
</activity>
<activity android:name="org.onepf.openiab.UnityProxyActivity"
android:launchMode="singleTask"
android:label="#string/app_name"
android:configChanges="fontScale|keyboard|keyboardHidden|locale|mnc|mcc|navigation|orientation|screenLayout|screenSize|smallestScreenSize|uiMode|touchscreen">
</activity>
<activity android:name="com.google.android.gms.ads.AdActivity"
android:label="#string/app_name"
android:configChanges="fontScale|keyboard|keyboardHidden|locale|mnc|mcc|navigation|orientation|screenLayout|screenSize|smallestScreenSize|uiMode|touchscreen">
</activity>
<activity android:name="com.ka.unity.plugin.ThirdPartyPostStoryActivity" android:windowSoftInputMode="stateAlwaysVisible" android:theme="#android:style/Theme.Translucent.NoTitleBar"/>
</application>
<uses-permission android:name="com.android.vending.BILLING"/>
<uses-permission android:name="android.permission.INTERNET"/>
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE"/>
<uses-permission android:name="android.permission.READ_PHONE_STATE"/>
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE"/>
<uses-permission android:name="com.sec.android.iap.permission.BILLING"/>
<uses-permission android:name="org.onepf.openiab.permission.BILLING"/>
So I merged reference one to my main one like above,
But error says,
[UnityException: Unable to start activity!
No activity in the manifest with action MAIN and category LAUNCHER. Try launching the application manually on the device.]
I still can make .apk file, and can run on my phone, but can't connect to 3rd party app when in-game button touched that should launch connection.
So strange... how should I fix?
Thanks.

Related

AppIcon will showed twice on device with Android App

When i install my android application on the device, the AppIcon will appear twice.
This means: there are two separate app-icons. Both icons launch the same app version. If I remove one app-icon, the other disappears also. If i reinstall them, it appears twice again.
How can i avoid this?
This is my AndroidManifest.xml:
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.******"
android:versionCode="1"
android:versionName="1.0">
<uses-permission android:name="android.permission.INTERNET" />
<uses-permission android:name="android.permission.SYSTEM_ALERT_WINDOW"/>
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE"/>
<uses-permission android:name="android.permission.ACCESS_FINE_LOCATION" />
<uses-sdk
android:minSdkVersion="16"
android:targetSdkVersion="22" />
<application
android:name=".MainApplication"
android:allowBackup="true"
android:label="#string/app_name"
android:icon="#mipmap/ic_launcher"
android:theme="#style/AppTheme">
<meta-data android:name="com.bugsnag.android.API_KEY"
android:value="524b0194108e90ae383189e509746766"/>
<activity
android:name=".MainActivity"
android:label="#string/app_name"
android:configChanges="keyboard|keyboardHidden|orientation|screenSize"
android:windowSoftInputMode="adjustResize">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
<activity android:name="com.facebook.react.devsupport.DevSettingsActivity" />
<activity
android:name=".SplashActivity"
android:theme="#style/SplashTheme">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
</application>
</manifest>
It's because of the intent-filter. Only one activity should have
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
Any activity having this intent filter will be shown in the launcher.

Cannot install application in Android Tablet

I am using Android Studio to develop an app which used Camera2 API. I can run the app in Google Nexus 9, however the app is not installed in the device and I cannot access it once I close the app. What am I doing wrong ?
Here is the manifest
<?xml version="1.0" encoding="utf-8"?>
<uses-permission android:name="android.permission.CAMERA" />
<uses-feature android:name="android.hardware.camera2.full" />
<uses-permission android:name="com.example.mapdemo.permission.MAPS_RECEIVE" />
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
<uses-permission android:name="android.permission.INTERNET" />
<uses-permission android:name="android.permission.ACCESS_COARSE_LOCATION" />
<uses-permission android:name="android.permission.ACCESS_FINE_LOCATION" />
<uses-permission android:name="com.google.android.providers.gsf.permission.READ_GSERVICES" />
<application
android:allowBackup="true"
android:icon="#drawable/ic_launcher"
android:label="#string/app_name"
android:theme="#style/AppTheme" >
<activity
android:name=".MapActivity"
android:label="#string/app_name" >
<intent-filter>
<action android:name="android.intent.action.map" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
<activity
android:name=".MainActivity"
android:label="#string/app_name" >
<intent-filter>
<action android:name="test.camera.main" />
<category android:name="android.intent.category.DEFAULT" />
</intent-filter>
</activity>
<meta-data
android:name="com.google.android.maps.v2.API_KEY"
android:value="key"/>
<meta-data
android:name="com.google.android.gms.version"
android:value="#integer/google_play_services_version" />
</application>
add the following to your < activity > in your AndroidManifest.xml
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
EDIT: added sample
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.mycompany.android.myapp"
android:versionCode="1"
android:versionName="1.0" >
<uses-sdk
android:minSdkVersion="9"
android:targetSdkVersion="21" />
<uses-permission android:name="android.permission.INTERNET" />
<application
android:icon="#drawable/ic_launcher"
android:label="#string/app_name"
android:theme="#style/Theme.AppCompat" >
<activity
android:name=".ActFirst"
android:label="#string/app_name" >
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
<activity
android:name=".ActSecond" >
</activity>
</application>
</manifest>
While running my app, I thought I had the same problem.
The problem in my app was the app_name in the strings file was different that what I thought it is. So Basically I was looking for app "X" while the name i gave is "Y".
Maybe you have the same problem.

Supported devices is 0-Google play

Manifest:
This was working fine before some time. Now it shows 0-supported devices!
Please help me on this.
Shows these features on console though I am not using it.
android.hardware.screen.PORTRAIT
android.hardware.TOUCHSCREEN
android.hardware.WIFI
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.app.irb.wallpro"
android:versionCode="5"
android:versionName="1.0.5" >
<uses-sdk
android:minSdkVersion="8"/>
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
<uses-permission android:name="android.permission.ACCESS_WIFI_STATE" />
<uses-permission android:name="android.permission.INTERNET" />
<uses-permission android:name="android.permission.READ_PHONE_STATE" />
<!-- Include next permission if you want to allow UIL to cache images on SD card -->
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />
<uses-permission android:name="android.permission.SET_WALLPAPER_HINTS" />
<uses-permission android:name="android.permission.SET_WALLPAPER" />
<application
android:name="com.irbrothers.wallpro.ui.WallProApplication"
android:allowBackup="true"
android:icon="#drawable/app_icon"
android:label="#string/app_name"
android:theme="#style/AppTheme" >
<activity
android:name="com.irbrothers.wallpro.ui.SplashActivity"
android:label="#string/app_name"
android:screenOrientation="portrait" >
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
<activity
android:name="com.irbrothers.wallpro.ui.PropertiesActivity"
android:configChanges="orientation"
android:screenOrientation="portrait" >
</activity>
<activity
android:name="com.irbrothers.wallpro.ui.HomeActivity"
android:configChanges="orientation|screenSize"
android:launchMode="singleTask" >
</activity>
<activity
android:name="com.irbrothers.wallpro.ui.EULA"
android:configChanges="orientation|screenSize"
android:screenOrientation="portrait" >
</activity>
<activity
android:name="com.irbrothers.wallpro.ui.AboutActivity"
android:configChanges="orientation"
android:screenOrientation="portrait"
android:theme="#android:style/Theme.Black.NoTitleBar"
android:windowSoftInputMode="adjustPan" >
</activity>
<activity
android:name="com.startapp.android.publish.list3d.List3DActivity"
android:taskAffinity="com.app.irbrothers.wallpro.AppWall"
android:theme="#android:style/Theme" />
<activity
android:name="com.startapp.android.publish.AppWallActivity"
android:configChanges="orientation|keyboardHidden|screenSize"
android:taskAffinity="com.app.irbrothers.wallpro.AppWall"
android:theme="#android:style/Theme.Translucent" />
<service android:name="com.irbrothers.wallpro.alarm.NotificationService" />
<receiver android:name="com.irbrothers.wallpro.recievers.NotificationAlarmReciever" >
<intent-filter>
<action android:name="com.irbrothers.notification" />
</intent-filter>
<intent-filter>
<action android:name="android.intent.action.DATE_CHANGED" />
</intent-filter>
<intent-filter>
<action android:name="android.intent.action.TIMEZONE_CHANGED" />
</intent-filter>
<intent-filter>
<action android:name="android.intent.action.TIME_SET" />
</intent-filter>
<intent-filter>
<action android:name="android.intent.action.TIME_TICK" />
</intent-filter>
</receiver>
</application>
</manifest>
Solved
Do not use any library which is already present in framework. Ex: "json-simple" here.

Library installed as application Android

I have two android projects, one of them I'm using as library. I've created .aar file to use it as library in project. And it's working :). But I've a problem. It installs two apps with the same name in device. Any suggestion?
Application Manifest
<uses-permission android:name="android.permission.INTERNET" />
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />
<uses-permission android:name="com.google.android.providers.gsf.permission.READ_GSERVICES" />
<!--
The ACCESS_COARSE/FINE_LOCATION permissions are not required to use
Google Maps Android API v2, but are recommended.
-->
<uses-permission android:name="android.permission.ACCESS_COARSE_LOCATION" />
<uses-permission android:name="android.permission.ACCESS_FINE_LOCATION" />
<application
android:allowBackup="true"
android:icon="#drawable/ic_launcher"
android:label="#string/app_name"
android:theme="#style/AppTheme">
<activity
android:name="package"
android:label="#string/app_name" >
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
<meta-data
android:name="com.google.android.gms.version"
android:value="#integer/google_play_services_version" />
<meta-data
android:name="com.google.android.maps.v2.API_KEY"
android:value="#string/google_maps_key" />
<activity
android:name="net.riinvest.riinvest.Harta"
android:label="#string/title_activity_maps" >
</activity>
<activity
android:name="package"
android:label="#string/title_activity_kontakti" >
</activity>
</application>
</manifest>
Application that I use as library Manifest
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package=""
android:versionCode="1"
android:versionName="1.0" >
<uses-sdk android:minSdkVersion="12" android:targetSdkVersion="17" />
<uses-permission android:name="android.permission.INTERNET"/><!--For connection to server-->
<uses-permission android:name="android.permission.RECEIVE_BOOT_COMPLETED"/><!--For RiProfService broadcasting-->
<uses-permission android:name="android.permission.INTERACT_ACROSS_USERS_FULL"/>
<supports-screens
android:smallScreens="true"
android:normalScreens="true"
android:largeScreens="true"
android:anyDensity="true"
/>
<application
android:allowBackup="true"
android:icon="#drawable/riiprof_logo"
android:label="#string/app_name"
android:theme="#style/DeviceDefault">
<activity
android:name=""
android:label="#string/app_name"
android:windowSoftInputMode="stateHidden|adjustResize"
android:configChanges="locale|keyboardHidden|orientation|screenSize">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
</application>
</manifest>
Thanks in advance.
Best Regards
Remove this part from your library's AndroidManifest:
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
Its showing 2 launcher icons as both your library manifest and application manifest have following:
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
This instructs to enable the activity to be launched by a launcher icon directly. If you remove this from your library manifest. That should fix it. Hope it helps.

wrong activity is started in android app

I am trying to fix the issue for hours but I couldn't. The app is not launching activity I mentioned in the manifest, see following
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="green.thumbup"
android:versionCode="1"
android:versionName="1.1" >
<uses-sdk
android:minSdkVersion="12"
android:targetSdkVersion="17" />
<uses-feature
android:glEsVersion="0x00020000"
android:required="true" />
<uses-permission android:name="android.permission.INTERNET" />
<uses-permission android:name="android.permission.ACCESS_COARSE_LOCATION" />
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />
<uses-permission android:name="com.google.android.providers.gsf.permission.READ_GSERVICES" />
<uses-permission android:name="android.permission.ACCESS_FINE_LOCATION" />
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
<permission
android:name="green.thumbup.permission.MAPS_RECEIVE"
android:protectionLevel="signature" />
<supports-screens android:anyDensity="true" />
<uses-permission android:name="android.permission.CALL_PHONE" />
<uses-permission android:name="android.permission.ACCESS_MOCK_LOCATION" />
<application
android:icon="#drawable/app_icon"
android:label="#string/app_name"
android:theme="#style/AppTheme" >
<meta-data
android:name="com.google.android.maps.v2.API_KEY"
android:value="" />
<activity android:name=".driver.DriverMap" >
</activity>
<activity android:name=".driver.Journey" >
</activity>
<activity android:name=".journey.PassengerDestination" >
</activity>
<activity android:name=".login.Login" >
</activity>
<activity android:name=".passenger.PassengerDestination" >
</activity>
<activity android:name=".passenger.PassengerInfo" >
</activity>
<activity android:name=".users.RegisterUser" >
</activity>
<activity android:name=".users.UserChoice" >
</activity>
<activity android:name=".driver.ThumbUpGoogleMap" >
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
</application>
</manifest>
ThumbUpGoogleMap is in green.thumbup.driver.ThumbUpGoogleMap package.The application is always launching Loging activity from green.thumbup.login.Login, which is old main activity. Login was launch in the previous build but I completely removed and rebuilding the application.
I tried following but not success
I cleaned the code multiple times
I created a new AVD
I change activity path to android:name="green.thumbup.driver.ThumbUpGoogleMap"
Also tried
This is driving me crazy, any hint, suggestion would be of great help
Please write these two lines with activity declaration. And try to give full name for activity instead of just
.driver.ThumbUpGoogleMap
<activity android:name="green.thumbup.driver.ThumbUpGoogleMap" >
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
And remove <action android:name="android.intent.action.MAIN" /> from your Main Activity declaration.
Try this
<activity android:name=".driver.ThumbUpGoogleMap" >
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
EDIT:
If this doesnt solves the issue.. make this 4 lines
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
are used only once in the manifest file between any activity tags

Categories

Resources