Showing error for Intent inside IntentFilter on Mainactivity.cs

SreeeeSreeee INMember ✭✭✭✭✭

Hi,

I need to open my app by clicking a url. For that I follow the following url instructions:
https://blog.falafel.com/xamarin-android-launch-app-browser/

When I add codes IntentFilter to Mainactivity showing errors. Following is the screenshot of the error:

Any additional thing to enable the Intent?

Thanks in advance :)

Best Answer

  • SreeeeSreeee IN ✭✭✭✭✭
    Accepted Answer

    In android manifest set android:name like below:

         android:name=".MainActivity"
    

    And in Mainactivity add Name like below:

    [Activity(Name = "packagename.MainActivity")]
    

Answers

  • SreeeeSreeee INMember ✭✭✭✭✭

    Update

    Delete the code inside mainactivity and add code inside of application tag of manifest.

    My code inside application tag of manifest:

    <activity android:icon="@drawable/icon" android:name="Packagename.MainActivity" android:label="myapp">
                    <intent-filter>
                        <data android:scheme="https" android:host="www.myapp.com" />
                        <action android:name="android.intent.action.VIEW" />
                        <category android:name="android.intent.category.DEFAULT" />
                        <category android:name="android.intent.category.BROWSABLE" />
                    </intent-filter>
                </activity> 
    

    But when I open the app in that way app breaks with an exception Caused by: java.lang.NoClassDefFoundError: Class not found using the boot class loader; no stack available

    I feel some mistakes in the android:name="Packagename.MainActivity" in activity tag. Is it correct? Maybe because of this getting class not found exception?

    What is the correct format for android:name? "Packagename.MainActivity" or "Packagename.namespace.MainActivity" or any other format? Also, the app is opening when direct tapping(I mean without url tap).

  • SreeeeSreeee INMember ✭✭✭✭✭
    Accepted Answer

    In android manifest set android:name like below:

         android:name=".MainActivity"
    

    And in Mainactivity add Name like below:

    [Activity(Name = "packagename.MainActivity")]
    
Sign In or Register to comment.