Type is not derived from a java type (StartActivity)

FranciscoGGFranciscoGG ESMember ✭✭
edited December 2015 in Xamarin.Forms

Hi friends.

I just have updated to Xamarin Forms 2, but when in my SplashActivity, the method StartActivity() is executed I am getting this error:

Here is the code of my SplashActivity:

[Activity(MainLauncher = true, NoHistory = true, Label = "VisionMobile", Theme = "@style/Theme.Splash", Icon = "@drawable/icon",
    ConfigurationChanges = ConfigChanges.ScreenSize | ConfigChanges.Orientation, ScreenOrientation = ScreenOrientation.Portrait)]
public class SplashActivity : Activity
{
    protected override void OnCreate(Bundle bundle)
    {
        base.OnCreate(bundle);
        Thread.Sleep(1000);
        StartActivity(typeof(MainActivity));
    }
}

And the code of the MainActivity:

[Activity(Icon = "@drawable/icon", Theme = "@android:style/Theme.Holo.Light",
    ConfigurationChanges = ConfigChanges.ScreenSize | ConfigChanges.Orientation, ScreenOrientation = ScreenOrientation.Portrait)]
public class MainActivity : global::Xamarin.Forms.Platform.Android.FormsApplicationActivity
{
    protected override void OnCreate(Bundle bundle)
    {
        base.OnCreate(bundle);
        global::Xamarin.Forms.Forms.Init(this, bundle);
        LoadApplication(new App());
    }
}

Some idea about what it is happening?

Answers

  • GeraldVersluisGeraldVersluis NLUniversity ✭✭✭✭

    That is weird, this seems just fine.
    Did you do a Clean & build?

    Please post your full stacktrace from the output.

  • FranciscoGGFranciscoGG ESMember ✭✭

    @GeraldVersluis

    Here is the Stacktrace:

    Android application is debugging.
    Loaded assembly: /storage/emulated/0/Android/data/com.elfo.visionmobile/files/.override/Elfo.VisionMobile.Droid.dll
    Loaded assembly: /storage/emulated/0/Android/data/com.elfo.visionmobile/files/.override/Acr.Support.Android.dll [External]
    Loaded assembly: /storage/emulated/0/Android/data/com.elfo.visionmobile/files/.override/Acr.UserDialogs.dll [External]
    Loaded assembly: /storage/emulated/0/Android/data/com.elfo.visionmobile/files/.override/Acr.UserDialogs.Interface.dll [External]
    Loaded assembly: /storage/emulated/0/Android/data/com.elfo.visionmobile/files/.override/AndHUD.dll [External]
    Loaded assembly: /storage/emulated/0/Android/data/com.elfo.visionmobile/files/.override/Elfo.VisionMobile.Core.Converters.Common.dll
    Loaded assembly: /storage/emulated/0/Android/data/com.elfo.visionmobile/files/.override/Elfo.VisionMobile.Core.Data.Model.dll
    Loaded assembly: /storage/emulated/0/Android/data/com.elfo.visionmobile/files/.override/Elfo.VisionMobile.Core.dll
    Loaded assembly: /storage/emulated/0/Android/data/com.elfo.visionmobile/files/.override/FormsViewGroup.dll [External]
    Loaded assembly: /storage/emulated/0/Android/data/com.elfo.visionmobile/files/.override/GalaSoft.MvvmLight.dll [External]
    Loaded assembly: /storage/emulated/0/Android/data/com.elfo.visionmobile/files/.override/GalaSoft.MvvmLight.Extras.dll [External]
    Loaded assembly: /storage/emulated/0/Android/data/com.elfo.visionmobile/files/.override/GalaSoft.MvvmLight.Platform.dll [External]
    Loaded assembly: /storage/emulated/0/Android/data/com.elfo.visionmobile/files/.override/Microsoft.Practices.ServiceLocation.dll [External]
    Loaded assembly: /storage/emulated/0/Android/data/com.elfo.visionmobile/files/.override/Newtonsoft.Json.dll [External]
    Loaded assembly: Refractored.Xam.Settings.Abstractions.dll [External]
    Loaded assembly: Refractored.Xam.Settings.dll [External]
    Loaded assembly: /storage/emulated/0/Android/data/com.elfo.visionmobile/files/.override/Splat.dll [External]
    Loaded assembly: /storage/emulated/0/Android/data/com.elfo.visionmobile/files/.override/Xamarin.Android.Support.Design.dll [External]
    Loaded assembly: /storage/emulated/0/Android/data/com.elfo.visionmobile/files/.override/Xamarin.Android.Support.v4.dll [External]
    Loaded assembly: /storage/emulated/0/Android/data/com.elfo.visionmobile/files/.override/Xamarin.Android.Support.v7.AppCompat.dll [External]
    Loaded assembly: /storage/emulated/0/Android/data/com.elfo.visionmobile/files/.override/Xamarin.Android.Support.v7.CardView.dll [External]
    Loaded assembly: /storage/emulated/0/Android/data/com.elfo.visionmobile/files/.override/Xamarin.Android.Support.v7.MediaRouter.dll [External]
    Loaded assembly: /storage/emulated/0/Android/data/com.elfo.visionmobile/files/.override/Xamarin.Android.Support.v7.RecyclerView.dll [External]
    Loaded assembly: /storage/emulated/0/Android/data/com.elfo.visionmobile/files/.override/Xamarin.Forms.Core.dll [External]
    Loaded assembly: /storage/emulated/0/Android/data/com.elfo.visionmobile/files/.override/Xamarin.Forms.Platform.Android.dll [External]
    Loaded assembly: /storage/emulated/0/Android/data/com.elfo.visionmobile/files/.override/Xamarin.Forms.Platform.dll [External]
    Loaded assembly: /storage/emulated/0/Android/data/com.elfo.visionmobile/files/.override/Xamarin.Forms.Xaml.dll [External]
    Loaded assembly: /storage/emulated/0/Android/data/com.elfo.visionmobile/files/.override/System.Diagnostics.Tracing.dll [External]
    Loaded assembly: /storage/emulated/0/Android/data/com.elfo.visionmobile/files/.override/System.Reflection.Emit.dll [External]
    Loaded assembly: /storage/emulated/0/Android/data/com.elfo.visionmobile/files/.override/System.Reflection.Emit.ILGeneration.dll [External]
    Loaded assembly: /storage/emulated/0/Android/data/com.elfo.visionmobile/files/.override/System.Reflection.Emit.Lightweight.dll [External]
    Loaded assembly: /storage/emulated/0/Android/data/com.elfo.visionmobile/files/.override/System.ServiceModel.Security.dll [External]
    Loaded assembly: /storage/emulated/0/Android/data/com.elfo.visionmobile/files/.override/System.Threading.Timer.dll [External]
    Loaded assembly: /storage/emulated/0/Android/data/com.elfo.visionmobile/files/.override/Elfo.VisionMobile.Core.Data.Services.dll
    Loaded assembly: /storage/emulated/0/Android/data/com.elfo.visionmobile/files/.override/Elfo.VisionMobile.Core.Data.WCF.dll
    Loaded assembly: /storage/emulated/0/Android/data/com.elfo.visionmobile/files/.override/AutoMapper.dll [External]
    Loaded assembly: /storage/emulated/0/Android/data/com.elfo.visionmobile/files/.override/Elfo.VisionMobile.Core.Messaging.SignalR.dll
    Loaded assembly: /storage/emulated/0/Android/data/com.elfo.visionmobile/files/.override/VPAdmin.SignalR.dll [External]
    Loaded assembly: /storage/emulated/0/Android/data/com.elfo.visionmobile/files/.override/Microsoft.AspNet.SignalR.Client.dll [External]
    Loaded assembly: /storage/emulated/0/Android/data/com.elfo.visionmobile/files/.override/System.Net.Http.Extensions.dll [External]
    Loaded assembly: /storage/emulated/0/Android/data/com.elfo.visionmobile/files/.override/VPAdmin.Barcode.dll [External]
    Loaded assembly: /storage/emulated/0/Android/data/com.elfo.visionmobile/files/.override/System.ServiceModel.Internals.dll [External]
    Loaded assembly: Mono.Android.dll [External]
    Loaded assembly: System.Core.dll [External]
    Loaded assembly: MonoDroidConstructors [External]
    Loaded assembly: /storage/emulated/0/Android/data/com.elfo.visionmobile/files/.override/System.Runtime.dll [External]
    Resolved pending breakpoint at 'SplashActivity.cs:24,1' to void Elfo.VisionMobile.Droid.SplashActivity.OnCreate (Android.OS.Bundle bundle) [0x00014].
    Resolved pending breakpoint at 'SplashActivity.cs:25,1' to void Elfo.VisionMobile.Droid.SplashActivity.OnCreate (Android.OS.Bundle bundle) [0x00025].
    Resolved pending breakpoint at 'SplashActivity.cs:23,1' to void Elfo.VisionMobile.Droid.SplashActivity.OnCreate (Android.OS.Bundle bundle) [0x00009].
    Loaded assembly: /storage/emulated/0/Android/data/com.elfo.visionmobile/files/.override/System.ObjectModel.dll [External]
    Loaded assembly: System.dll [External]
    12-22 12:02:40.636 E/Zygote (15177): MountEmulatedStorage()
    12-22 12:02:40.636 E/Zygote (15177): v2
    12-22 12:02:40.636 I/SELinux (15177): Function: selinux_compare_spd_ram, SPD-policy is existed. and_ver=SEPF_SM-T533_4.4.4 ver=A046
    12-22 12:02:40.636 I/libpersona(15177): KNOX_SDCARD checking this for 10396
    12-22 12:02:40.636 I/libpersona(15177): KNOX_SDCARD not a persona
    12-22 12:02:40.646 I/SELinux (15177): Function: selinux_compare_spd_ram , priority [2] , priority version is VE=SEPF_SM-T533_5.1.1_0035
    12-22 12:02:40.646 E/SELinux (15177): [DEBUG] get_category: variable seinfo: default sensitivity: NULL, cateogry: NULL
    12-22 12:02:40.676 D/TimaKeyStoreProvider(15177): TimaSignature is unavailable
    12-22 12:02:40.676 D/ActivityThread(15177): Added TimaKeyStore provider
    12-22 12:02:40.736 I/MultiDex(15177): VM with version 2.1.0 has multidex support
    12-22 12:02:40.736 I/MultiDex(15177): install
    12-22 12:02:40.736 I/MultiDex(15177): VM has multidex support, MultiDex support library is disabled.
    12-22 12:02:40.746 W/monodroid(15177): Using override path: /data/data/com.elfo.visionmobile/files/.override
    12-22 12:02:40.746 W/monodroid(15177): Using override path: /storage/emulated/0/Android/data/com.elfo.visionmobile/files/.override
    12-22 12:02:40.746 W/monodroid(15177): Trying to load sgen from: /data/data/com.elfo.visionmobile/files/.override/libmonosgen-2.0.so
    12-22 12:02:40.746 W/monodroid(15177): Trying to load sgen from: /storage/emulated/0/Android/data/com.elfo.visionmobile/files/.override/libmonosgen-2.0.so
    12-22 12:02:40.746 W/monodroid(15177): Trying to load sgen from: /data/app/com.elfo.visionmobile-1/lib/arm/libmonosgen-2.0.so
    12-22 12:02:40.756 W/monodroid-debug(15177): Trying to initialize the debugger with options: --debugger-agent=transport=dt_socket,loglevel=0,address=127.0.0.1:8859,server=y,embedding=1
    12-22 12:02:40.846 W/monodroid-debug(15177): Accepted stdout connection: 25
    12-22 12:02:41.836 W/monodroid-gc(15177): GREF GC Threshold: 46080
    12-22 12:02:42.916 W/ResourceType(15177): Failure getting entry for 0x01080ad8 (t=7 e=2776) (error -75)
    12-22 12:02:42.916 D/SecWifiDisplayUtil(15177): Metadata value : none
    Unhandled Exception:

    System.ArgumentException: type
    Parameter name: Type is not derived from a java type.

  • FranciscoGGFranciscoGG ESMember ✭✭

    somebody has an idea? :)

  • 15mgm1515mgm15 USMember ✭✭✭✭

    I am having the same exact issue with latest Stable channel but using Xamarin.Forms latest pre release (2.3.5.256 pre 6) really weird since it is not consistent.

  • 15mgm1515mgm15 USMember ✭✭✭✭

    Found the solution, check on your Android configurations that you have enabled the "Use Shared Mono runtime"

  • ossentooossentoo GBMember ✭✭

    @15mgm15, that will work for debug configuration building. But surely that will introduce the same crash when the app is run in release mode?

  • WojciechBoczarskiWojciechBoczarski USUniversity ✭✭

    @ossentoo said:
    @15mgm15, that will work for debug configuration building. But surely that will introduce the same crash when the app is run in release mode?

    That's correct. This error results when you disable "Use Shared Mono runtime". However I need to have it disabled, as UITest needs to have it disable for run.

    Anyone found any solution?

  • 15mgm1515mgm15 USMember ✭✭✭✭

    @WojciechBoczarski Did you found a solution for this?

  • 15mgm1515mgm15 USMember ✭✭✭✭

    Never mind, the solution for me was:

    StartActivity(new Intent(Application.Context, typeof(MainActivity)));

Sign In or Register to comment.