Xamarin Android activity duplicated in AndroidManifest error - android

I'm working on a app in Xamarin Android and got stuck on this error, after changing target sdk/Android version from Android 9 to Android 10:
my AndroidManifest (in Visual Studio!):
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android" android:versionName="0.7.1" package="com.INCREDIBLE.Video2mp3" android:installLocation="auto" android:versionCode="3">
<uses-sdk android:minSdkVersion="21" android:targetSdkVersion="29" />
<application android:allowBackup="true" android:label="#string/app_name" android:roundIcon="#drawable/micon" android:supportsRtl="true" android:theme="#style/AppTheme" android:icon="#drawable/micon">
<activity android:name=".MainActivity" android:launchMode="singleTask">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
<intent-filter android:label="Download als mp3">
<action android:name="android.intent.action.SEND" />
<category android:name="android.intent.category.DEFAULT" />
<data android:mimeType="text/plain" />
</intent-filter>
</activity>
</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" />
</manifest>
But in the Solution folder the Manifest looks like this:
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android" android:versionName="0.7.1" package="com.INCREDIBLE.Video2mp3" android:installLocation="auto" android:versionCode="3">
<uses-sdk android:minSdkVersion="21" android:targetSdkVersion="28" />
<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" />
<application android:allowBackup="true" android:label="#string/app_name" android:roundIcon="#drawable/micon" android:supportsRtl="true" android:theme="#style/AppTheme" android:icon="#drawable/micon" android:name="android.app.Application">
<activity android:name=".MainActivity" android:launchMode="singleTask">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
<intent-filter android:label="Download als mp3">
<action android:name="android.intent.action.SEND" />
<category android:name="android.intent.category.DEFAULT" />
<data android:mimeType="text/plain" />
</intent-filter>
</activity>
<activity android:icon="#drawable/micon" android:label="#string/app_name" android:launchMode="singleTask" android:name="com.INCREDIBLE.Video2mp3.MainActivity" android:theme="#style/AppTheme">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
<provider android:name="mono.MonoRuntimeProvider" android:exported="false" android:initOrder="1999999999" android:authorities="com.INCREDIBLE.Video2mp3.mono.MonoRuntimeProvider.__mono_init__" />
</application>
</manifest>
The App should only have one Activity (MainActivity). If deleting the 'duplicated' <activity ... /> (in the file directly) I get no error massage, but the build fails anyways. Before the version changed from 9 to 10, it worked as expacted. Now (even when I change the target Version back to 9) I get stuck here.

In Xamarin, you don't need to explicitly register Activities in the Manifest. You can delete all activity code from the manifest and use Attributes in the source file like so:
[Activity(MainLauncher = true, LaunchMode = LaunchMode.SingleTask)]
[IntentFilter(new[] { "android.intent.action.SEND" }, Label = "Download als mp3", Categories = new[] { "android.intent.category.DEFAULT" }, DataMimeType = "text/plain")]
public class MainActivity: Activity
{
Note: You may be doing both due to which a second entry for the activity maybe gets added to the manifest when you build the project

Related

ERROR in android studio of Multiple entries with same key

ERROR: Multiple entries with same key: android:appComponentFactory=REPLACE and android:appComponentFactory=REPLACE
this error comes when i try to sync the gradle.
this error is after i updated android studio to latest version
here is mainfest
<?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.hoogle.news">
<uses-permission android:name="android.permission.ACCESS_WIFI_STATE"/>
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE"/>
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE"/>
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
<uses-permission android:name="android.permission.INTERNET" />
<uses-permission android:name="android.permission.ACCESS_FINE_LOCATION"/>
<application
android:icon="#mipmap/ic_app"
android:label="#string/app_name"
android:roundIcon="#mipmap/ic_app_round"
android:supportsRtl="true"
android:configChanges="keyboardHidden|orientation|screenSize"
android:theme="#style/Theme.AppCompat.NoActionBar"
tools:replace="android:appComponentFactory,android:appComponentFactory,android:appComponentFactory">
<activity
android:name=".FullscreenActivity"
android:configChanges="orientation|keyboardHidden|screenSize"
android:label="#string/app_name"
android:theme="#style/FullscreenTheme">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<action android:name="android.intent.action.VIEW" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
<activity
android:name=".isNetworkAvailable"
android:label="#string/app_name"
android:theme="#style/Theme.AppCompat.Light.NoActionBar.FullScreen">
<intent-filter>
<action android:name="android.net.wifi.WIFI_STATE_CHANGED" />
<action android:name="android.net.conn.CONNECTIVITY_CHANGE" />
<action android:name="android.intent.action.MAIN" />
</intent-filter>
</activity>
<activity
android:name=".MainActivity"
android:label="#string/app_name"
android:configChanges="keyboardHidden|orientation|screenSize"
android:theme="#style/Theme.AppCompat.Light.NoActionBar.FullScreen">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
</intent-filter>
</activity>
</application>
</manifest>
just delete this line under application to solve multiple error entries and merged mainfest error
tools:replace="android:appComponentFactory,android:appComponentFactory,android:appComponentFactory">

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.

Android app not showing in the device apps dashboard

My app doesn't appear in the apps dashboard and if I open it from the Applications list in the settings, the "start" button is disabled, I suspect is a misconfiguration in my AndroidManifest.xml but have no idea what exactly is wrong in it.
This is the code of my manifest file.
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.designhunter"
android:versionCode="1"
android:versionName="1.0">
<uses-permission android:name="android.permission.INTERNET" />
<uses-permission android:name="android.permission.SYSTEM_ALERT_WINDOW" />
<uses-sdk
android:minSdkVersion="16"
android:targetSdkVersion="22" />
<application
android:name=".MainApplication"
android:allowBackup="true"
android:icon="#mipmap/ic_launcher"
android:label="#string/app_name"
android:theme="#style/AppTheme">
<activity
android:name=".MainActivity"
android:configChanges="keyboard|keyboardHidden|orientation|screenSize"
android:label="#string/app_name"
android:launchMode="singleTask">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<action android:name="android.intent.action.VIEW" />
<category android:name="android.intent.category.DEFAULT" />
<category android:name="android.intent.category.BROWSABLE" />
<category android:name="android.intent.category.LAUNCHER" />
<data android:host="auth-callback" android:scheme="designhunter" />
</intent-filter>
</activity>
<activity android:name="com.facebook.react.devsupport.DevSettingsActivity" />
</application>
According to this Action main does not expect to receive it data, but you have data tag. If you remove it (and the view action because it is required) it should work

You should have a com.dropbox.client2.android.AuthActivity with the scheme:XXXXXXXX

I am trying to upload a text file to my Dropbox, but it shows an error in manifest.
This is my Manifest file and the logcat error, what am I doing wrong can anyone help me please...
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.example.ondropbox"
android:versionCode="1"
android:versionName="1.0" >
<uses-sdk
android:minSdkVersion="8"
android:targetSdkVersion="17" />
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />
<uses-permission android:name="android.permission.ACCESS_COARSE_LOCATION"></uses-permission>
<uses-permission android:name="android.permission.ACCESS_FINE_LOCATION"></uses-permission>
<uses-permission android:name="android.permission.ACCESS_LOCATION_EXTRA_COMMANDS"></uses-permission>
<uses-permission android:name="android.permission.ACCESS_MOCK_LOCATION"></uses-permission>
<uses-permission android:name="android.permission.INTERNET"></uses-permission>
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE"></uses-permission>
<uses-permission android:name="android.permission.READ_PHONE_STATE" />
<application
android:allowBackup="true"
android:icon="#drawable/ic_launcher"
android:label="#string/app_name"
android:theme="#style/AppTheme" >
<activity
android:name="com.example.ondropbox.MainActivity"
android:launchMode="singleTask"
android:configChanges="orientation|keyboard" >
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
<data android:scheme="db-5qiq4z06ikagxfb" />
<category android:name="android.intent.category.BROWSABLE"/>
<category android:name="android.intent.category.DEFAULT" />
</intent-filter>
</activity>
</application>
</manifest>
The Error is:
**java.lang.IllegalStateException: URI scheme in your app's manifest is not set up correctly. You should have a com.dropbox.client2.android.AuthActivity with the scheme: db-5qiq4z06ikagxfb**
What should I do?
Thanks for any kind of help.
because you are missing to add activity,,,
<activity
android:name="com.example.ondropbox.MainActivity"
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="com.dropbox.client2.android.AuthActivity"
android:configChanges="orientation|keyboard"
android:launchMode="singleTask" >
<intent-filter>
<data android:scheme="db-5qiq4z06ikagxfb" />
<action android:name="android.intent.action.VIEW" />
<category android:name="android.intent.category.BROWSABLE" />
<category android:name="android.intent.category.DEFAULT" />
</intent-filter>
</activity>
and you are done.
I had a very similar issue after migrating my app from Dropbox API v1 to v2. I used an official tutorial for migration - https://www.dropbox.com/developers/reference/migration-guide, but there are no word about Android, only basic examples in Java. So I opened this GitHub repo and used it as reference - https://github.com/dropbox/dropbox-sdk-java/tree/master/examples/android.
But in new API they changed a package of AuthActivity and I forgot to check, so had a Runtime crash - Unable to find com.dropbox.core.android.AuthActivity.
The solution is to change old package to new one - com.dropbox.client2.android.AuthActivity to com.dropbox.core.android.AuthActivity.

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